|
OpenTTD Source
1.10.0-RC1
|
Definitions about widgets. More...
#include "core/alloc_type.hpp"#include "core/bitmath_func.hpp"#include "core/math_func.hpp"#include "strings_type.h"#include "gfx_type.h"#include "window_type.h"Go to the source code of this file.
Data Structures | |
| class | NWidgetBase |
| Baseclass for nested widgets. More... | |
| class | NWidgetResizeBase |
| Base class for a resizable nested widget. More... | |
| class | NWidgetCore |
| Base class for a 'real' widget. More... | |
| class | NWidgetContainer |
| Baseclass for container widgets. More... | |
| class | NWidgetStacked |
| Stacked widgets, widgets all occupying the same space in the window. More... | |
| class | NWidgetPIPContainer |
| Container with pre/inter/post child space. More... | |
| class | NWidgetHorizontal |
| Horizontal container. More... | |
| class | NWidgetHorizontalLTR |
| Horizontal container that doesn't change the direction of the widgets for RTL languages. More... | |
| class | NWidgetVertical |
| Vertical container. More... | |
| class | NWidgetMatrix |
| Matrix container with implicitly equal sized (virtual) sub-widgets. More... | |
| class | NWidgetSpacer |
| Spacer widget. More... | |
| class | NWidgetBackground |
| Nested widget with a child. More... | |
| class | NWidgetViewport |
| Nested widget to display a viewport in a window. More... | |
| class | Scrollbar |
| Scrollbar data structure. More... | |
| class | NWidgetScrollbar |
| Nested widget to display and control a scrollbar in a window. More... | |
| class | NWidgetLeaf |
| Leaf widget. More... | |
| struct | NWidgetPartDataTip |
| Widget part for storing data and tooltip information. More... | |
| struct | NWidgetPartWidget |
| Widget part for storing basic widget information. More... | |
| struct | NWidgetPartPaddings |
| Widget part for storing padding. More... | |
| struct | NWidgetPartPIP |
| Widget part for storing pre/inter/post spaces. More... | |
| struct | NWidgetPartTextLines |
| Widget part for storing minimal text line data. More... | |
| struct | NWidgetPart |
| Partial widget specification to allow NWidgets to be written nested. More... | |
Typedefs | |
| typedef NWidgetBase * | NWidgetFunctionType(int *biggest_index) |
| Pointer to function returning a nested widget. More... | |
Functions | |
| static uint | ComputeMaxSize (uint base, uint max_space, uint step) |
| Return the biggest possible size of a nested widget. More... | |
| static NWidgetPart | SetResize (int16 dx, int16 dy) |
| Widget part function for setting the resize step. More... | |
| static NWidgetPart | SetMinimalSize (int16 x, int16 y) |
| Widget part function for setting the minimal size. More... | |
| static NWidgetPart | SetMinimalTextLines (uint8 lines, uint8 spacing, FontSize size=FS_NORMAL) |
| Widget part function for setting the minimal text lines. More... | |
| static NWidgetPart | SetFill (uint fill_x, uint fill_y) |
| Widget part function for setting filling. More... | |
| static NWidgetPart | EndContainer () |
| Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL). | |
| static NWidgetPart | SetDataTip (uint32 data, StringID tip) |
| Widget part function for setting the data and tooltip. More... | |
| static NWidgetPart | SetMatrixDataTip (uint8 cols, uint8 rows, StringID tip) |
| Widget part function for setting the data and tooltip of WWT_MATRIX widgets. More... | |
| static NWidgetPart | SetPadding (uint8 top, uint8 right, uint8 bottom, uint8 left) |
| Widget part function for setting additional space around a widget. More... | |
| static NWidgetPart | SetPadding (uint8 padding) |
| Widget part function for setting a padding. More... | |
| static NWidgetPart | SetPIP (uint8 pre, uint8 inter, uint8 post) |
| Widget part function for setting a pre/inter/post spaces. More... | |
| static NWidgetPart | SetScrollbar (int index) |
| Attach a scrollbar to a widget. More... | |
| static NWidgetPart | NWidget (WidgetType tp, Colours col, int16 idx=-1) |
| Widget part function for starting a new 'real' widget. More... | |
| static NWidgetPart | NWidget (WidgetType tp, NWidContainerFlags cont_flags=NC_NONE) |
| Widget part function for starting a new horizontal container, vertical container, or spacer widget. More... | |
| static NWidgetPart | NWidgetFunction (NWidgetFunctionType *func_ptr) |
| Obtain a nested widget (sub)tree from an external source. More... | |
| NWidgetContainer * | MakeNWidgets (const NWidgetPart *parts, int count, int *biggest_index, NWidgetContainer *container) |
| Construct a nested widget tree from an array of parts. More... | |
| NWidgetContainer * | MakeWindowNWidgetTree (const NWidgetPart *parts, int count, int *biggest_index, NWidgetStacked **shade_select) |
| Make a nested widget tree for a window from a parts array. More... | |
| NWidgetBase * | MakeCompanyButtonRows (int *biggest_index, int widget_first, int widget_last, int max_length, StringID button_tooltip) |
| Make a number of rows with button-like graphics, for enabling/disabling each company. More... | |
Variables | |
| static const int | WIDGET_LIST_END = -1 |
| indicate the end of widgets' list for vararg functions | |
Definitions about widgets.
Definition in file widget_type.h.
| typedef NWidgetBase* NWidgetFunctionType(int *biggest_index) |
Pointer to function returning a nested widget.
| biggest_index | Pointer to storage for collecting the biggest index used in the nested widget. |
*biggest_index must contain the value of the biggest index in the returned tree. Definition at line 902 of file widget_type.h.
| enum ArrowWidgetValues |
Values for an arrow widget.
Definition at line 34 of file widget_type.h.
| enum MatrixWidgetValues |
Bits of the WWT_MATRIX widget data.
Definition at line 23 of file widget_type.h.
| enum NWidContainerFlags |
Nested widget container flags,.
| Enumerator | |
|---|---|
| NCB_EQUALSIZE | Containers should keep all their (resizing) children equally large. |
| NC_NONE | All flags cleared. |
| NC_EQUALSIZE | Value of the NCB_EQUALSIZE flag. |
Definition at line 423 of file widget_type.h.
| enum NWidgetDisplay |
Nested widget flags that affect display and interaction with 'real' widgets.
| Enumerator | |
|---|---|
| NDB_LOWERED | Widget is lowered (pressed down) bit. |
| NDB_DISABLED | Widget is disabled (greyed out) bit. |
| NDB_NO_TRANSPARENCY | Viewport is never transparent. |
| NDB_SHADE_GREY | Shade viewport to grey-scale. |
| NDB_SHADE_DIMMED | Display dimmed colours in the viewport. |
| NDB_DROPDOWN_ACTIVE | Dropdown menu of the button dropdown widget is active.
|
| NDB_SCROLLBAR_UP | Up-button is lowered bit. |
| NDB_SCROLLBAR_DOWN | Down-button is lowered bit. |
| NDB_HIGHLIGHT | Highlight of widget is on. |
| ND_LOWERED | Bit value of the lowered flag. |
| ND_DISABLED | Bit value of the disabled flag. |
| ND_HIGHLIGHT | Bit value of the highlight flag. |
| ND_NO_TRANSPARENCY | Bit value of the 'no transparency' flag. |
| ND_SHADE_GREY | Bit value of the 'shade to grey' flag. |
| ND_SHADE_DIMMED | Bit value of the 'dimmed colours' flag. |
| ND_DROPDOWN_ACTIVE | Bit value of the 'dropdown active' flag. |
| ND_SCROLLBAR_UP | Bit value of the 'scrollbar up' flag. |
| ND_SCROLLBAR_DOWN | Bit value of the 'scrollbar down' flag. |
| ND_SCROLLBAR_BTN | Bit value of the 'scrollbar up' or 'scrollbar down' flag. |
Definition at line 249 of file widget_type.h.
| enum SizingType |
Different forms of sizing nested widgets, using NWidgetBase::AssignSizePosition()
| Enumerator | |
|---|---|
| ST_SMALLEST | Initialize nested widget tree to smallest size. Also updates current_x and current_y. |
| ST_RESIZE | Resize the nested widget tree. |
Definition at line 109 of file widget_type.h.
Display planes with zero size for NWidgetStacked.
Definition at line 385 of file widget_type.h.
| enum WidgetType |
Window widget types, nested widget types, and nested widget part types.
| Enumerator | |
|---|---|
| WWT_EMPTY | Empty widget, place holder to reserve space in widget array. |
| WWT_PANEL | Simple depressed panel. |
| WWT_INSET | Pressed (inset) panel, most commonly used as combo box text area. |
| WWT_IMGBTN | (Toggle) Button with image |
| WWT_IMGBTN_2 | (Toggle) Button with diff image when clicked |
| WWT_ARROWBTN | (Toggle) Button with an arrow |
| WWT_TEXTBTN | (Toggle) Button with text |
| WWT_TEXTBTN_2 | (Toggle) Button with diff text when clicked |
| WWT_LABEL | Centered label. |
| WWT_TEXT | Pure simple text. |
| WWT_MATRIX | Grid of rows and columns.
|
| WWT_FRAME | Frame. |
| WWT_CAPTION | Window caption (window title between closebox and stickybox) |
| WWT_DEBUGBOX | NewGRF debug box (at top-right of a window, between WWT_CAPTION and WWT_SHADEBOX) |
| WWT_SHADEBOX | Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX) |
| WWT_DEFSIZEBOX | Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX) |
| WWT_STICKYBOX | Sticky box (at top-right of a window, after WWT_DEFSIZEBOX) |
| WWT_RESIZEBOX | Resize box (normally at bottom-right of a window) |
| WWT_CLOSEBOX | Close box (at top-left of a window) |
| WWT_DROPDOWN | Drop down list. |
| WWT_EDITBOX | a textbox for typing |
| WWT_LAST | Last Item. use WIDGETS_END to fill up padding!! |
| NWID_HORIZONTAL | Horizontal container. |
| NWID_HORIZONTAL_LTR | Horizontal container that doesn't change the order of the widgets for RTL languages. |
| NWID_VERTICAL | Vertical container. |
| NWID_MATRIX | Matrix container. |
| NWID_SPACER | Invisible widget that takes some space. |
| NWID_SELECTION | Stacked widgets, only one visible at a time (eg in a panel with tabs). |
| NWID_VIEWPORT | Nested widget containing a viewport. |
| NWID_BUTTON_DROPDOWN | Button with a drop-down. |
| NWID_HSCROLLBAR | Horizontal scrollbar. |
| NWID_VSCROLLBAR | Vertical scrollbar. |
| WPT_RESIZE | Widget part for specifying resizing. |
| WPT_MINSIZE | Widget part for specifying minimal size. |
| WPT_MINTEXTLINES | Widget part for specifying minimal number of lines of text. |
| WPT_FILL | Widget part for specifying fill. |
| WPT_DATATIP | Widget part for specifying data and tooltip. |
| WPT_PADDING | Widget part for specifying a padding. |
| WPT_PIPSPACE | Widget part for specifying pre/inter/post space for containers. |
| WPT_ENDCONTAINER | Widget part to denote end of a container. |
| WPT_FUNCTION | Widget part for calling a user function. |
| WPT_SCROLLBAR | Widget part for attaching a scrollbar. |
| WWT_PUSHBTN | Normal push-button (no toggle button) with custom drawing. |
| WWT_PUSHTXTBTN | Normal push-button (no toggle button) with text caption. |
| WWT_PUSHIMGBTN | Normal push-button (no toggle button) with image caption. |
| WWT_PUSHARROWBTN | Normal push-button (no toggle button) with arrow caption. |
Definition at line 44 of file widget_type.h.
|
inlinestatic |
Return the biggest possible size of a nested widget.
| base | Base size of the widget. |
| max_space | Available space for the widget. |
| step | Stepsize of the widget. |
Definition at line 796 of file widget_type.h.
| NWidgetBase* MakeCompanyButtonRows | ( | int * | biggest_index, |
| int | widget_first, | ||
| int | widget_last, | ||
| int | max_length, | ||
| StringID | button_tooltip | ||
| ) |
Make a number of rows with button-like graphics, for enabling/disabling each company.
| biggest_index | Storage for collecting the biggest index used in the returned tree. |
| widget_first | The first widget index to use. |
| widget_last | The last widget index to use. |
| max_length | Maximal number of company buttons in one row. |
| button_tooltip | The tooltip-string of every button. |
*biggest_index contains the largest used index in the tree. Definition at line 2862 of file widget.cpp.
Referenced by MakeCompanyButtonRowsAIDebug(), MakeCompanyButtonRowsGraphGUI(), MakeCompanyButtonRowsLinkGraphGUI(), and NWidgetFunction().