Options for controlling the behaviour of individual nodes in an AxisLayout
Class AxisLayoutOptions
#include <Geode/ui/Layout.hpp>
Examples1
auto node = CCNode::create();
// this node will have 10 units of spacing between it and the next one
node->setLayoutOptions(
AxisLayoutOptions::create()
->setNextGap(10.f)
);
someNodeWithALayout->addChild(node);
Public static methods1
staticgeode::AxisLayoutOptions*create()
Public member functions23
std::optional<bool>getAutoScale()const
floatgetMaxScale()const
floatgetMinScale()const
boolhasExplicitMaxScale()const
boolhasExplicitMinScale()const
floatgetRelativeScale()const
std::optional<float>getLength()const
std::optional<float>getPrevGap()const
std::optional<float>getNextGap()const
boolgetBreakLine()const
boolgetSameLine()const
intgetScalePriority()const
std::optional<geode::AxisAlignment>getCrossAxisAlignment()const
geode::AxisLayoutOptions*setScaleLimits(,)
Set the limits to what the node can be scaled to. Passing std::nullopt
uses the parent layout’s default min / max scales
geode::AxisLayoutOptions*setRelativeScale(floatscale)
Set the relative scale of this node compared to other nodes if it’s contained in an auto-scaled layout. Default is 1
geode::AxisLayoutOptions*setAutoScale()
Set auto-scaling for this node, overriding the layout’s auto-scale setting. If nullopt, the layout’s auto-scale options will be used
geode::AxisLayoutOptions*setLength()
Set an absolute length for this node. If nullopt, the length will be dynamically calculated based on content size
geode::AxisLayoutOptions*setPrevGap()
Override the default gap in the layout between this node and the previous one. If nullopt, the default gap of the layout will be used
geode::AxisLayoutOptions*setNextGap()
Override the default gap in the layout between this node and the next one. If nullopt, the default gap of the layout will be used
geode::AxisLayoutOptions*setBreakLine(boolenable)
If enabled, the node will always cause a growable axis layout to break into a new line even if the current line could’ve fit the next node
geode::AxisLayoutOptions*setSameLine(boolenable)
If enabled, the node will be forced to be on the same line as the previous node even if doing this would overflow
geode::AxisLayoutOptions*setScalePriority(intpriority)
Set the scale priority of this node. Nodes with higher priority will be scaled down first before nodes with lower priority when an auto-scaled layout attempts to fit its contents. Default is AXISLAYOUT_DEFAULT_PRIORITY
ℹ For optimal performance, the priorities should all be close to each other with no gaps
geode::AxisLayoutOptions*setCrossAxisAlignment()
Override the cross axis alignment for this node in the layout