.. include:: headings.inc .. _WrapSizer: ========================================================================================================================================== |phoenix_title| **WrapSizer** ========================================================================================================================================== A wrap sizer lays out its items in a single line, like a box sizer -- as long as there is space available in that direction. Once all available space in the primary direction has been used, a new line is added and items are added there. So a wrap sizer has a primary orientation for adding items, and adds lines as needed in the secondary direction. .. seealso:: :ref:`BoxSizer`, :ref:`Sizer`, :ref:`Sizers Overview ` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **WrapSizer** .. raw:: html

Inheritance diagram of WrapSizer

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~WrapSizer.__init__` Constructor for a :ref:`WrapSizer`. :meth:`~WrapSizer.CalcMin` Implements the calculation of a box sizer's minimal. :meth:`~WrapSizer.InformFirstDirection` Not used by an application. :meth:`~WrapSizer.IsSpaceItem` Can be overridden in the derived classes to treat some normal items as spacers. :meth:`~WrapSizer.RecalcSizes` Implements the calculation of a box sizer's dimensions and then sets the size of its children (calling :meth:`Window.SetSize` if the child is a window). ================================================================================ ================================================================================ | |api| Class API =============== .. class:: WrapSizer(BoxSizer) A wrap sizer lays out its items in a single line, like a box sizer -- as long as there is space available in that direction. **Possible constructors**:: WrapSizer(orient=HORIZONTAL, flags=WRAPSIZER_DEFAULT_FLAGS) .. method:: __init__(self, orient=HORIZONTAL, flags=WRAPSIZER_DEFAULT_FLAGS) Constructor for a :ref:`WrapSizer`. `orient` determines the primary direction of the sizer (the most common case being ``HORIZONTAL`` ). The flags parameter can be a combination of the values ``EXTEND_LAST_ON_EACH_LINE`` which will cause the last item on each line to use any remaining space on that line and ``REMOVE_LEADING_SPACES`` which removes any spacer elements from the beginning of a row. Both of these flags are on by default. :param `orient`: :type `orient`: int :param `flags`: :type `flags`: int .. method:: CalcMin(self) Implements the calculation of a box sizer's minimal. It is used internally only and must not be called by the user. Documented for information. :rtype: :ref:`Size` .. method:: InformFirstDirection(self, direction, size, availableOtherDir) Not used by an application. This is the mechanism by which sizers can inform sub-items of the first determined size component. The sub-item can then better determine its size requirements. Returns ``True`` if the information was used (and the sub-item min size was updated). :param `direction`: :type `direction`: int :param `size`: :type `size`: int :param `availableOtherDir`: :type `availableOtherDir`: int :rtype: `bool` .. method:: IsSpaceItem(self, item) Can be overridden in the derived classes to treat some normal items as spacers. This method is used to determine whether the given `item` should be considered to be a spacer for the purposes of ``REMOVE_LEADING_SPACES`` implementation. By default only returns ``True`` for the real spacers. :param `item`: :type `item`: SizerItem :rtype: `bool` .. method:: RecalcSizes(self) Implements the calculation of a box sizer's dimensions and then sets the size of its children (calling :meth:`Window.SetSize` if the child is a window). It is used internally only and must not be called by the user (call :meth:`Layout` if you want to resize). Documented for information.