NodeSlot

A "node slot" node, which displays the node given to it. Allows safely swapping nodes in the layout by reference, even during drawing. Useful for creating tabs and menus.

Because NodeSlot does not inherit from T, it uses the single-parameter overload of simpleConstructor.

Constructors

this
this(NodeParams params, T node)

Create a new node slot and optionally place a node within.

this
deprecated this(Layout layout, T node)

Create a new slot and place a node in it.

this
deprecated this(T node)
Undocumented in source.
this
deprecated this(Layout layout)

Create a new empty slot.

Members

Functions

clear
void clear()

Remove the assigned node from the slot.

drawImpl
void drawImpl(Rectangle paddingBox, Rectangle contentBox)
Undocumented in source. Be warned that the author may not have intended to support it.
hoveredImpl
bool hoveredImpl(Rectangle rect, Vector2 position)
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
typeof(this) opAssign(T value)

Change the node in the slot.

pickStyle
inout(Style) pickStyle()
Undocumented in source. Be warned that the author may not have intended to support it.
resizeImpl
void resizeImpl(Vector2 space)
Undocumented in source. Be warned that the author may not have intended to support it.
swapSlots
void swapSlots(Slot other)

Swap contents of the two slots.

Mixins

__anonymous
mixin DefineStyles

NodeSlot defines its own styles, which will only apply to the slot itself, not the contents. Most of the styling options will have no effect, but padding and margin will.

Variables

value
T value;

Node placed in the slot.

Inherited Members

From Node

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

Node core constructor parameters, to be passed from node to node.

Layout (from fluid.structs)
struct Layout via public import fluid.structs : NodeAlign, NodeParams, Layout;

Represents a node's layout

Align (from fluid.structs)
enum NodeAlign via public import fluid.structs : Align = NodeAlign, Params = NodeParams;
Undocumented in source.
Params (from fluid.structs)
struct NodeParams via public import fluid.structs : Align = NodeAlign, Params = NodeParams;

Node core constructor parameters, to be passed from node to node.

__anonymous
mixin DefineStyles!("style", q{ Style.init })

This node defines a single style, style, which also works as a default style for all other nodes. However, rather than for that, the purpose of this style is to define the convention of style being the node's default, idle style.

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.

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.

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.

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
mixintemplate implHoveredRect()
Undocumented in source.
pickStyle
inout(Style) pickStyle()

Get the current style.

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

Examples

import fluid;

NodeSlot!Label slot1, slot2;

// Slots can be empty, with no node inside
auto root = vspace(
    label("Hello, "),
    slot1 = nodeSlot!Label(.layout!"fill"),
    label(" and "),
    slot2 = nodeSlot!Label(.layout!"fill"),
);

// Slots can be assigned other nodes
slot1 = label("John");

slot2 = button("Jane", delegate {

    // Slot contents can be swapped with a single call
    slot1.swapSlots(slot2);

});

// Slots can be reassigned at any time
slot1 = label("Joe");

// Their values can also be removed
slot1.clear();

Meta