Space

This is a space, a basic container for other nodes.

Nodes are laid in a column (vframe) or in a row (hframe).

Space only acts as a container and doesn't implement styles and doesn't take focus. It's very useful as a helper for building layout, while Frame remains to provide styling.

Constructors

this
this(Node[] nodes)

Create the space and fill it with given nodes.

this
this(Range range)

Create the space using nodes from the given range.

Members

Aliases

directionHorizontal
alias directionHorizontal = horizontal
Undocumented in source.
horizontal
alias horizontal = isHorizontal
Undocumented in source.

Functions

childOffset
Vector2 childOffset(Vector2 currentOffset, Vector2 childSpace)

Calculate the offset for the next node, given the childSpace result for its previous sibling.

childSpace
Vector2 childSpace(Node child, Vector2 available, bool stateful)

Get space for a child.

drawImpl
void drawImpl(Rectangle , Rectangle area)
Undocumented in source. Be warned that the author may not have intended to support it.
filterChildren
auto filterChildren()

List children in the space, removing all nodes queued for deletion beforehand.

hoveredImpl
bool hoveredImpl(Rectangle , Vector2 )

Space does not take hover; isHovered is always false.

opOpAssign
void opOpAssign(T nodes)

Add children.

resizeImpl
void resizeImpl(Vector2 available)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

children
Children children;

Children of this frame.

isHorizontal
bool isHorizontal;

Defines in what directions children of this frame should be placed.

Inherited Members

From Node

NodeAlign (from fluid.structs)
enum NodeAlign via public import fluid.structs : NodeAlign, Layout;
Undocumented in source.
Layout (from fluid.structs)
struct Layout via public import fluid.structs : NodeAlign, Layout;

Node parameter for setting the node layout.

Align (from fluid.structs)
enum NodeAlign via public import fluid.structs : Align = NodeAlign;
Undocumented in source.
Extra
class Extra
Undocumented in source.
tree
LayoutTree* tree;

Tree data for the node. Note: requires at least one draw before this will work.

layout
Layout layout;

Layout for this node.

tags
TagList tags;

Tags assigned for this node.

toRemove
bool toRemove;

If true, this node will be removed from the tree on the next draw.

ignoreMouse
bool ignoreMouse;

If true, mouse focus will be disabled for this node, so mouse signals will "go through" to its parents, as if the node wasn't there. The node will still detect hover like normal.

minSize
auto minSize;

Minimum size of the node.

theme
inout(Theme) theme [@property getter]

Get the current theme.

theme
Theme theme [@property setter]

Set the theme.

style
inout(Style) style [@property getter]

Current style, used for sizing. Does not include any changes made by when clauses or callbacks.

isHidden
bool isHidden [@property getter]

Check if the node is hidden.

isHidden
bool isHidden [@property setter]

Set the visibility

opEquals
bool opEquals(Node otherNode)
Undocumented in source. Be warned that the author may not have intended to support it.
show
This show()

Show the node.

hide
This hide()

Hide the node.

disable
This disable()

Disable this node.

enable
This enable()

Enable this node.

backend
inout(FluidBackend) backend()
Undocumented in source. Be warned that the author may not have intended to support it.
backend
FluidBackend backend(FluidBackend backend)
Undocumented in source. Be warned that the author may not have intended to support it.
io
alias io = backend
Undocumented in source.
toggleShow
void toggleShow()

Toggle the node's visibility.

remove
void remove()

Remove this node from the tree before the next draw.

isHovered
bool isHovered [@property getter]

Check if this node is hovered.

isDisabled
inout(bool) isDisabled()

Check if this node is disabled.

isDisabledInherited
bool isDisabledInherited()

Checks if the node is disabled, either by self, or by any of its ancestors. Updated when drawn.

queueAction
void queueAction(TreeAction action)

Queue an action to perform within this node's branch.

resizePending
bool resizePending()

True if this node is pending a resize.

updateSize
void updateSize()

Recalculate the window size before next draw.

draw
void draw()

Draw this node as a root node.

_focusPrevNext
void _focusPrevNext(FluidInputAction actionType)

Switch to the previous or next focused item

_focusDirection
void _focusDirection(FluidInputAction action)

Switch focus towards a specified direction.

draw
void draw(Rectangle space)

Draw this node at the specified location from within of another (parent) node.

resize
void resize(LayoutTree* tree, Theme theme, Vector2 space)

Recalculate the minimum node size and update the minSize property.

resizeImpl
void resizeImpl(Vector2 space)

Ditto

drawImpl
void drawImpl(Rectangle paddingBox, Rectangle contentBox)

Draw this node.

hoveredImpl
bool hoveredImpl(Rectangle rect, Vector2 mousePosition)

Check if the node is hovered.

ImplHoveredRect
alias ImplHoveredRect = implHoveredRect
Undocumented in source.
implHoveredRect
deprecated mixintemplate implHoveredRect()
Undocumented in source.
pickStyle
Style pickStyle()

Get the current style.

reloadStyles
void reloadStyles()

Reload style from the current theme.

toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

import fluid;

// A vspace will align all its content in a column
vspace(
    label("First entry"),
    label("Second entry"),
    label("Third entry"),
);

// hspace will lay out the nodes in a row
hspace(
    label("One, "),
    label("Two, "),
    label("Three!"),
);

// Combine them to quickly build layouts!
vspace(
    label("Are you sure you want to proceed?"),
    hspace(
        button("Yes", delegate { }),
        button("Cancel", delegate { }),
    ),
);

Meta