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.

@safe
alias nodeSlot(alias T) = simpleConstructor!(NodeSlot!T)

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