class GUILayout

Inherits: GUIElement

Base class for layout GUI element.

Layout element positions and sizes any child elements according to element styles and layout options.

Public

Constructors

GUILayout

GUILayout() = default

GUILayout

GUILayout(const String &styleClass, const GUISizeConstraints &dimensions)

Methods

~GUILayout

virtual ~GUILayout() noexcept = default

AddElement

void AddElement(GUIElement *element)

Adds a new element to the layout after all existing elements.

RemoveElement

void RemoveElement(GUIElement *element)

Removes the specified element from the layout.

RemoveElementAt

void RemoveElementAt(u32 index)

Removes a child element at the specified index.

InsertElement

void InsertElement(u32 index, GUIElement *element)

Inserts a GUI element before the element at the specified index.

GetChildCount

u32 GetChildCount() const

Returns the number of children in the layout.

GetChild

GUIElement *GetChild(u32 index) const

Returns a child element at the specified index, or null if the index is not valid.

Clear

void Clear()

Removes all child elements and destroys them.

SetEnableCulling

void SetEnableCulling(bool enable)

Enables/disables culling of child elements.

If culling is enabled all child elements that are fully outside of the parent visible bounds will be marked as culled. Culled elements will never have their contents or mesh updated, their absolute coordinate will not be updated and they wont be drawn This is useful for layouts with a large amount of children, but comes with an overhead so it is disabled by default. Note this has no impact on layout update, which may still be expensive with many elements.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

Returns an interface you can use to access class' Run Time Type Information.

Internal

Methods

GetConstrainedSizeRange

GUIConstrainedSizeRange GetConstrainedSizeRange() const override

Returns element size constrained by its size constraints.

This is different from CalculateConstrainedSize() because this method may return cached size.

GetChildrenConstrainedSizes

const Vector<GUIConstrainedSizeRange> &GetChildrenConstrainedSizes() const

Returns a size ranges for all children that was cached during the last GUIElementBase::_updateOptimalLayoutSizes call.

CalculateUnconstrainedOptimalSize

GUILogicalSize CalculateUnconstrainedOptimalSize() const override

Calculates the optimal size for the GUI element, ignoring size constraints.

UpdateAbsoluteCoordinates

void UpdateAbsoluteCoordinates(const GUIPhysicalPointF &parentOrigin, float parentScale, const GUIPhysicalAreaF &parentVisibleArea) override

Updates the absolute coordinates of the GUI element using the currently assigned relative coordinates and the provided .

Also calculates the visible area clip rectangle and marks culled elements if they have no visible area. This should be called after updating the layout (as layout update calculates the needed relative coordinates). This may also be called independently of layout update, which is useful for scroll areas that then do not require a full layout pass to scroll their children.

parentOrigin
Absolute origin to add to the relative coordinates, in order to determine the absolute element coordinates.
parentScale
Scale of the parent GUI element.
parentVisibleArea
Absolute visible (clipped) area though which this element may be seen. This will be used for culling and clipping.

GetVisibleChildren

const TInlineArray<GUIElement *, 4> &GetVisibleChildren() const override

Returns all children that can be seen through the parent's visible area (i.e. all elements that are not culled or explicitly made invisible).

Note this may return all child elements on GUI elements that do not support culling. Only well defined after layout update.

Protected

Methods

RegisterChildElement

void RegisterChildElement(GUIElement *element) override

Registers a new child element.

UnregisterChildElement

void UnregisterChildElement(GUIElement *element) override

Unregisters an existing child element.

UpdateAbsoluteCoordinatesForChildren

void UpdateAbsoluteCoordinatesForChildren() override

Calls UpdateAbsoluteCoordinates() on all child elements.

Fields

mChildConstrainedSizeRanges

Vector<GUIConstrainedSizeRange> mChildConstrainedSizeRanges

mConstrainedSizeRange

GUIConstrainedSizeRange mConstrainedSizeRange

mCulling

UPtr<GUICulling> mCulling