This documents an old version of bs::framework. Click here to see the latest release.
GUILayoutY Class Reference

Description

Represents a vertical layout that will layout out its child elements top to bottom.

Inherits GUILayout.

Methods

 GUILayoutY (const GUIDimensions &dimensions)
 
Internal
void _updateOptimalLayoutSizes () override
 Calculate optimal sizes of all child layout elements. More...
 
LayoutSizeRange _calculateLayoutSizeRange () const override
 Calculates element size range constrained by its layout options. More...
 
void _getElementAreas (const Rect2I &layoutArea, Rect2I *elementAreas, UINT32 numElements, const Vector< LayoutSizeRange > &sizeRanges, const LayoutSizeRange &mySizeRange) const override
 Calculates positions & sizes of all elements in the layout. More...
 
- Methods inherited from GUILayout
 GUILayout (const GUIDimensions &dimensions)
 
template<class Type , class... Args>
TypeaddNewElement (Args &&...args)
 Creates a new element and adds it to the layout after all existing elements. More...
 
template<class Type , class... Args>
TypeinsertNewElement (UINT32 idx, Args &&...args)
 Creates a new element and inserts it before the element at the specified index. More...
 
void addElement (GUIElementBase *element)
 Adds a new element to the layout after all existing elements. More...
 
void removeElement (GUIElementBase *element)
 Removes the specified element from the layout. More...
 
void removeElementAt (UINT32 idx)
 Removes a child element at the specified index. More...
 
void insertElement (UINT32 idx, GUIElementBase *element)
 Inserts a GUI element before the element at the specified index. More...
 
void clear ()
 Removes all child elements and destroys them. More...
 
UINT32 getNumChildren () const
 Returns number of child elements in the layout. More...
 
LayoutSizeRange _getLayoutSizeRange () const override
 Returns element size range constrained by its layout options. More...
 
LayoutSizeRange _getCachedSizeRange () const
 Returns a size range that was cached during the last GUIElementBase::_updateOptimalLayoutSizes call. More...
 
const Vector< LayoutSizeRange > & _getCachedChildSizeRanges () const
 Returns a size ranges for all children that was cached during the last GUIElementBase::_updateOptimalLayoutSizes call.
 
Vector2I _getOptimalSize () const override
 Returns previously calculated optimal size for this element. More...
 
const RectOffset_getPadding () const override
 Returns element padding that determines how far apart to space out this element from other elements in a layout. More...
 
Type _getType () const override
 Returns specific sub-type of this object. More...
 
- Methods inherited from GUIElementBase
 GUIElementBase (const GUIDimensions &dimensions)
 
void setPosition (INT32 x, INT32 y)
 Sets element position relative to parent GUI panel. More...
 
void setWidth (UINT32 width)
 Sets element width in pixels. More...
 
void setFlexibleWidth (UINT32 minWidth=0, UINT32 maxWidth=0)
 Sets element width in pixels. More...
 
void setHeight (UINT32 height)
 Sets element height in pixels. More...
 
void setSize (UINT32 width, UINT32 height)
 Sets width and height of a GUI element in pixels. More...
 
void setFlexibleHeight (UINT32 minHeight=0, UINT32 maxHeight=0)
 Sets element height in pixels. More...
 
virtual void resetDimensions ()
 Resets element dimensions to their initial values dictated by the element's style. More...
 
void setVisible (bool visible)
 Hides or shows this element and recursively applies the same state to all the child elements. More...
 
void setActive (bool active)
 Activates or deactives this element and recursively applies the same state to all the child elements. More...
 
void setDisabled (bool disabled)
 Disables or enables the element. More...
 
Rect2I getBounds (GUIPanel *relativeTo=nullptr)
 Returns non-clipped bounds of the GUI element. More...
 
void setBounds (const Rect2I &bounds)
 Sets the bounds of the GUI element. More...
 
Rect2I getGlobalBounds ()
 Returns non-clipped bounds of the GUI element. More...
 
Rect2I getScreenBounds () const
 Returns non-clipped bounds of the GUI element in screenspace. More...
 
virtual Rect2I getVisibleBounds ()
 Returns non-clipped visible bounds of the GUI element (bounds exclude the margins). More...
 
virtual void _updateLayout (const GUILayoutData &data)
 Updates child elements positions, sizes, clip rectangles and depths so they fit into the provided bounds, while respecting their layout options. More...
 
virtual void _setLayoutData (const GUILayoutData &data)
 Updates layout data that determines GUI elements final position & depth in the GUI widget. More...
 
const GUILayoutData_getLayoutData () const
 Retrieves layout data that determines GUI elements final position & depth in the GUI widget. More...
 
void _setParent (GUIElementBase *parent)
 Sets a new parent for this element. More...
 
UINT32 _getNumChildren () const
 Returns number of child elements. More...
 
GUIElementBase_getChild (UINT32 idx) const
 Return the child element at the specified index. More...
 
const GUIDimensions_getDimensions () const
 Returns layout options that determine how is the element positioned and sized. More...
 
GUIElementBase_getParent () const
 Returns parent GUI base element. More...
 
GUIElementBase_getUpdateParent () const
 Returns the parent element whose layout needs to be updated when this elements contents change. More...
 
GUIWidget_getParentWidget () const
 Returns parent GUI widget, can be null. More...
 
bool _isVisible () const
 Checks if element is visible or hidden. More...
 
bool _isActive () const
 Checks if element is active or inactive. More...
 
bool _isDisabled () const
 Checks if element is disabled. More...
 
void _setVisible (bool visible)
 Internal version of setVisible() that doesn't modify local visibility, instead it is only meant to be called on child elements of the element whose visibility was modified.
 
void _setActive (bool active)
 Internal version of setActive() that doesn't modify local state, instead it is only meant to be called on child elements of the element whose state was modified. More...
 
void _setDisabled (bool disabled)
 Internal version of setDisabled() that doesn't modify local state, instead it is only meant to be called on child elements of the element whose state was modified. More...
 
virtual void _changeParentWidget (GUIWidget *widget)
 Changes the active GUI element widget. More...
 
void _registerChildElement (GUIElementBase *element)
 Registers a new child element. More...
 
void _unregisterChildElement (GUIElementBase *element)
 Unregisters an existing child element. More...
 
virtual bool _isDestroyed () const
 Checks if element has been destroyed and is queued for deletion. More...
 
void _markLayoutAsDirty ()
 Marks the element's dimensions as dirty, triggering a layout rebuild. More...
 
void _markContentAsDirty ()
 Marks the element's contents as dirty, which causes the sprite meshes to be recreated from scratch. More...
 
void _markMeshAsDirty ()
 Mark only the elements that operate directly on the sprite mesh without requiring the mesh to be recreated as dirty. More...
 
bool _isDirty () const
 Returns true if elements contents have changed since last update. More...
 
void _markAsClean ()
 Marks the element contents to be up to date (meaning it's processed by the GUI system). More...
 

Static methods

static GUILayoutYcreate ()
 Creates a new vertical layout. More...
 
static GUILayoutYcreate (const GUIOptions &options)
 Creates a new vertical layout. More...
 
- Static methods inherited from GUILayout
static void destroy (GUILayout *layout)
 Destroy the layout. More...
 

Additional Inherited Members

- Public Types inherited from GUIElementBase
enum  Type {
  Layout, Element, FixedSpace, FlexibleSpace,
  Panel
}
 Valid types of GUI base elements. More...
 
- Protected Types inherited from GUIElementBase
enum  GUIElementFlags {
  GUIElem_Dirty = 0x01, GUIElem_Hidden = 0x02, GUIElem_Inactive = 0x04, GUIElem_HiddenSelf = 0x08,
  GUIElem_InactiveSelf = 0x10, GUIElem_Disabled = 0x20, GUIElem_DisabledSelf = 0x40
}
 Flags that signal the state of the GUI element. More...
 

Method documentation

◆ _calculateLayoutSizeRange()

LayoutSizeRange _calculateLayoutSizeRange ( ) const
overridevirtual

Calculates element size range constrained by its layout options.

Reimplemented from GUIElementBase.

◆ _getElementAreas()

void _getElementAreas ( const Rect2I layoutArea,
Rect2I elementAreas,
UINT32  numElements,
const Vector< LayoutSizeRange > &  sizeRanges,
const LayoutSizeRange mySizeRange 
) const
overridevirtual

Calculates positions & sizes of all elements in the layout.

This method expects a pre-allocated array to store the data in.

Parameters
[in]layoutAreaParent layout area to position the child elements in.
[out]elementAreasArray to hold output areas. Must be the same size as the number of child elements.
[in]numElementsSize of the element areas array.
[in]sizeRangesRanges of possible sizes used for the child elements. Array must be same size as elements array.
[in]mySizeRangeSize range of this element.

Reimplemented from GUIElementBase.

◆ _updateLayoutInternal()

void _updateLayoutInternal ( const GUILayoutData data)
overrideprotectedvirtual

Updates child elements positions, sizes, clip rectangles and depths so they fit into the provided bounds, while respecting their layout options.

Parameters
[in]dataLayout data containing the necessary bounds and restrictions to use for calculating the child element layout data.

Reimplemented from GUIElementBase.

◆ _updateOptimalLayoutSizes()

void _updateOptimalLayoutSizes ( )
overridevirtual

Calculate optimal sizes of all child layout elements.

Reimplemented from GUIElementBase.

◆ create() [1/2]

static GUILayoutY* create ( )
static

Creates a new vertical layout.

◆ create() [2/2]

static GUILayoutY* create ( const GUIOptions options)
static

Creates a new vertical layout.

Parameters
[in]optionsOptions that allow you to control how is the element positioned and sized.