OpenTTD Source 20241224-master-gee860a5c8e
|
Hierarchical widgets, also known as nested widgets, are widgets stored in a tree. More...
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 | 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 | NWidgetScrollbar |
Nested widget to display and control a scrollbar in a window. More... | |
class | NWidgetLeaf |
Leaf widget. More... | |
Hierarchical widgets, also known as nested widgets, are widgets stored in a tree.
At the leafs of the tree are (mostly) the 'real' widgets visible to the user. At higher levels, widgets get organized in container widgets, until all widgets of the window are merged.
A leaf widget is one of
The purpose of a leaf widget is to provide interaction with the user by displaying settings, and/or allowing changing the settings.
A container widget is one of
The purpose of a container widget is to structure its leafs and sub-containers to allow proper resizing.
The first 'computation' is the creation of the nested widgets tree by calling the constructors of the widgets listed above and calling Add()
for every child, or by means of specifying the tree as a collection of nested widgets parts and instantiating the tree from the array.
After the creation step,
Computations in the nested widgets take place as follows:
After the second step, the current size of the widgets are set to the smallest size.
To resize, perform the last step with the new window size. This can be done as often as desired. When the smallest size of at least one widget changes, the whole procedure has to be redone from the start.