|Constructor for a new widget container. |
|void||updateWidgets (bool update, bool draw, bool forceRedraw)|
|Updates all the widgets contained. More...|
|void||addWidget (PHN_Widget &widget)|
|Adds a single widget. More...|
|void||removeWidget (PHN_Widget &widget)|
|Removes a single widget. More...|
|Removes all contained widgets. More...|
|PHN_Widget *||widget (int index)|
|Gets the widget stored at an index. |
|const int||widgetCount ()|
|Gets how many widgets are stored. |
|Removes all child widgets from this container without handling proper redrawing. More...|
|void||setWidgetCapacity (int capacity)|
|Resizes the internal array of widgets to a new capacity. More...|
|Sets whether added widgets are deleted (were added with new) |
A container for storing multiple PHN_Widget instances.
The adding and removing of widgets is handled in such a way that they are properly (re)drawn. Removing a widget fills its contents with the background color set to erase it properly. Switching between what widgets are displayed is made easier this way. It is a more efficient alternative to filling the entire screen with a color and redrawing the other widgets.
A widget itself can also hold multiple child-widgets, which are drawn and updated with the parent widget. If you, for example, need to combine multiple widgets together into a single user control, such as a keyboard, this can be done that way.
Make sure to set the bounds right after constructing a widget. It is best to set the colors afterwards (unless defaults are used) and then any other widget properties that have to be set. Please read the documentation/examples of a widget before use to find out which functions have to be called before use. Rule of thumb: widgets that have a range or dimensions require these functions to be called before it can be used properly.
|void PHN_WidgetContainer::addWidget||(||PHN_Widget &||widget||)|
Adds a single widget.
The widget is not drawn until the root display is updated.
Removes all child widgets from this container without handling proper redrawing.
Use this when the container has to be deleted from memory. After silently clearing the container is not to be used again.
Removes all contained widgets.
The removed widgets are not un-drawn until the root display is updated.
|void PHN_WidgetContainer::removeWidget||(||PHN_Widget &||widget||)|
Removes a single widget.
The removed widget is not un-drawn until the root display is updated.
Resizes the internal array of widgets to a new capacity.
Widgets falling outside the range are undrawn and deleted (if specified)
Updates all the widgets contained.
|[in]||update||Whether to logic-update the widgets|
|[in]||draw||Whether to draw invalidated widgets|
|[in]||forceRedraw||Whether to force draw the widgets|