class GUIPanel

Represents a GUI panel that you can use for free placement of GUI elements within its bounds.

Public

Constructors

GUIPanel

GUIPanel() = default

GUIPanel

GUIPanel(PrivatelyConstruct, const GUIPanelContent &content, const String &styleClass, const GUISizeConstraints &sizeConstraints)

Methods

~GUIPanel

~GUIPanel() noexcept = default

SetDepthRange

void SetDepthRange(i16 depth = 0, u16 depthRangeMinimum = -1, u16 depthRangeMaximum = -1)

Changes values that control at which depth is GUI panel and its children rendered.

depth
Determines rendering order of the GUI panel. Panels with lower depth will be rendered in front of panels with higher depth. Provided depth is relative to depth of the parent GUI panel (if any).
depthRangeMinimum
Minimum range of depths that children of this GUI panel can have. If any panel has depth outside of the range [depth - depthRangeMinimum, depth + depthRangeMaximum] it will be clamped to nearest extreme. Value of -1 means infinite range.
depthRangeMaximum
Maximum range of depths that children of this GUI panel can have. If any panel has depth outside of the range [depth - depthRangeMinimum, depth + depthRangeMaximum] it will be clamped to nearest extreme. Value of -1 means infinite range.

staticGetGuiTypeName

static const String &GetGuiTypeName()

Returns type name of the GUI element used for finding GUI element styles.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

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

staticCreate

static GUIElementType *Create(const ContentType &contents, const String &styleClass, const TInlineArray<GUIOption, 4> &options)

Creates a new GUI element.

contents
Structure describing the contents of the GUI element to create.
styleClass
Style class that will be used for determining GUI element visuals from the current style sheet. If no class is provided, default style is determined based on GUI element type.
options
Additional options that control GUI element size and position. This will override options set in the style sheet.

Internal

Methods

UpdateOptimalLayoutSizes

void UpdateOptimalLayoutSizes() override

Calculates optimal sizes of all child elements, as determined by their style and layout options.

This is performed recursively over all child elements, starting with the bottom-most child element. This should be called before UpdateLayoutRecursive().

GetChildRelativeLayoutAreas

void GetChildRelativeLayoutAreas(const GUILogicalSize &layoutSize, GUILogicalPoint *outElementPositions, GUILogicalSize *outElementSizes, u32 elementCount, const Vector<GUIConstrainedSizeRange> &sizeRanges) const

Calculates positions & sizes of all elements in the layout.

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

layoutSize
Size of the parent layout area to position the child elements in.
outElementPositions
Array to hold output positions. Must be the same size as the number of child elements.
outElementSizes
Array to hold output areas. Must be the same size as the number of child elements.
elementCount
Size of the element positions/sizes arrays.
sizeRanges
Ranges of possible sizes used for the child elements. Array must be same size as elements array.

CalculateRelativeElementArea

GUILogicalArea CalculateRelativeElementArea(const GUILogicalSize &layoutSize, const GUIElement *element, const GUIConstrainedSizeRange &sizeRange) const

Calculates the size of the provided child within this layout with the provided dimensions.

GetChildConstrainedSizeRange

GUIConstrainedSizeRange GetChildConstrainedSizeRange(const GUIElement *element) const

Calculates an element size range for the provided child of the GUI panel.

Will return cached bounds so make sure to update optimal size ranges before calling.

UpdateLayoutForChildren

void UpdateLayoutForChildren() override

Calculates sizes and relative positions for all child elements.

Should be preceded with a call to UpdateOptimalLayoutSizes().

UpdateDepthRangeInternal

void UpdateDepthRangeInternal(GUILayoutData &data)

Updates the provided depth range by taking into consideration the depth range of the panel.

This depth range should be passed on to child elements of the panel.

Protected

Fields

mDepthOffset

i16 mDepthOffset

mDepthRangeMin

u16 mDepthRangeMin

mDepthRangeMax

u16 mDepthRangeMax