Skip to content

DIWNE::Stack

Stack is a helper layout class that manages a set of vertically or horizontally aligned DIWNE panels. More...

#include "DIWNE/Core/Layout/Stack.h"

Inherits from DIWNE::Layout

Inherited by DIWNE::HStack, DIWNE::VStack

Public Types

Name
enumMode { HORIZONTAL, VERTICAL}

Public Functions

Name
Stack(NodeEditor & editor, Mode mode)<br>Create a stack.
Stack(NodeEditor & editor, Mode mode, DiwnePanel * panel)<br>Create a stack for a specified DIWNE panel, this allows the usage of the spring() method.
voidbegin()<br>Begin the stack, should be called before beginItem().
DiwnePanel *beginItem()<br>Begins the next stack item.
voidend()<br>End the stack, called after begin().
voidendItem()
voidsetSpacing(float spacing)
boolspring(float relSize)<br>Adds a spring corresponding to the layout to the enclosing DIWNE panel.

Additional inherited members

Public Functions inherited from DIWNE::Layout

Name
Layout() =default
Layout(DiwnePanel * panel)

Protected Attributes inherited from DIWNE::Layout

Name
DiwnePanel *m_panel <br>Panel associated with this layout.

Detailed Description

cpp
class DIWNE::Stack;
class DIWNE::Stack;

Stack is a helper layout class that manages a set of vertically or horizontally aligned DIWNE panels.

Depending on the mode, the width or height of the panels is synced together, and they are aligned to be next to, or above each other. The stack can be used standalone to align items with fixed spacings, or it can be used within another enclosing DIWNE panel so that springs can be used as spacing.

Public Types Documentation

enum Mode

EnumeratorValueDescription
HORIZONTAL
VERTICAL

Public Functions Documentation

function Stack

cpp
inline explicit Stack(
    NodeEditor & editor,
    Mode mode
)
inline explicit Stack(
    NodeEditor & editor,
    Mode mode
)

Create a stack.

function Stack

cpp
inline explicit Stack(
    NodeEditor & editor,
    Mode mode,
    DiwnePanel * panel
)
inline explicit Stack(
    NodeEditor & editor,
    Mode mode,
    DiwnePanel * panel
)

Create a stack for a specified DIWNE panel, this allows the usage of the spring() method.

function begin

cpp
void begin()
void begin()

Begin the stack, should be called before beginItem().

function beginItem

cpp
DiwnePanel * beginItem()
DiwnePanel * beginItem()

Begins the next stack item.

Return: Panel managing the new item.

In vertical mode, the starting X coordinate of items is locked and vertical springs can be used between items. It is the opposite for horizontal mode.

function end

cpp
void end()
void end()

End the stack, called after begin().

function endItem

cpp
void endItem()
void endItem()

function setSpacing

cpp
inline void setSpacing(
    float spacing
)
inline void setSpacing(
    float spacing
)

function spring

cpp
bool spring(
    float relSize
)
bool spring(
    float relSize
)

Adds a spring corresponding to the layout to the enclosing DIWNE panel.

See: DiwnePanel::spring()

Return: Whether the spring was truly added.

Should be called between items and requires the Stack to have a reference to the enclosing panel.


Updated on 2025-05-31 at 12:55:31 +0000