All Vision2 containers inherit EV_CONTAINER
A container is a Vision2 widget that may contain other widgets. Some containers such as EV_CELL may only hold one widget while containers such as EV_BOX may hold multiple widgets. As a container is of type EV_WIDGET, this means that a container may be placed within a container. A list of the classes held within the container cluster can be found here. Windows inherit from EV_CELL and are therefore classed as containers also.
Note: Containers may only contain other widgets. Items may only be placed in certain primitives. For example, an EV_LIST_ITEM may be contained in an EV_LIST.
Wherever possible, Vision2 containers reuse the container structures provided by Base. This provides three main advantages:
For example, EV_CONTAINER inherits BOX and COLLECTION. Descendents of EV_CONTAINER such as EV_BOX may also inherit other structures from Base.
The main role of a container is to position its children in a certain way, an EV_HORIZONTAL_BOX for example positions it children side by side along the horizontal axis, to get vertical stacking you would use an EV_VERTICAL_BOX.
An code example of adding widgets to a container is as follows.
The mapping of a Vision2 container interface is very close to that of containers in Base, such as a linked list.
Note: When a widget is added to a container, the container is the parent of the widget.
The size of a widget in a container is always at least its minimum size. By default, when a widget is added to a container it is expandable. This means that if the container gets bigger, the widget will expand to fit the extra space. This convenient functionality means that you don't have to worry about handling the size of the widget (such as when a user alters the size of a window) as this is all performed automatically. If, on the other hand, you decide you want the widget to remain at a certain size (its minimum size), EV_BOX contains the convenient call disable_item_resize.
Note: The exception to this is: EV_FIXED, EV_VIEWPORT and EV_SCROLLABLE_AREA which do actually allow their contents to be larger than their current size.