add getters for AxisLayout

This commit is contained in:
HJfod 2023-02-11 12:06:01 +02:00
parent 3fb8c2be83
commit 676b96a34f
2 changed files with 51 additions and 5 deletions

View file

@ -103,16 +103,26 @@ protected:
public:
void apply(CCNode* on) override;
/**
* Sets where to align the target node's children on the cross-axis (Y for
* Row, X for Column)
*/
AxisLayout* setCrossAxisAlignment(AxisAlignment align);
Axis getAxis() const;
AxisAlignment getAxisAlignment() const;
AxisAlignment getCrossAxisAlignment() const;
float getGap() const;
bool getAxisReverse() const;
bool getCrossAxisReverse() const;
bool getAutoScale() const;
bool getGrowCrossAxis() const;
bool getCrossAxisOverflow() const;
/**
* Sets where to align the target node's children on the main axis (X for
* Row, Y for Column)
*/
AxisLayout* setAxisAlignment(AxisAlignment align);
/**
* Sets where to align the target node's children on the cross-axis (Y for
* Row, X for Column)
*/
AxisLayout* setCrossAxisAlignment(AxisAlignment align);
/**
* The spacing between the children of the node this layout applies to.
* Measured as the space between their edges, not centres. Does not apply

View file

@ -335,6 +335,42 @@ void AxisLayout::apply(CCNode* on) {
AxisLayout::AxisLayout(Axis axis) : m_axis(axis) {}
Axis AxisLayout::getAxis() const {
return m_axis;
}
AxisAlignment AxisLayout::getCrossAxisAlignment() const {
return m_crossAlignment;
}
AxisAlignment AxisLayout::getAxisAlignment() const {
return m_axisAlignment;
}
float AxisLayout::getGap() const {
return m_gap;
}
bool AxisLayout::getAxisReverse() const {
return m_axisReverse;
}
bool AxisLayout::getCrossAxisReverse() const {
return m_crossReverse;
}
bool AxisLayout::getAutoScale() const {
return m_autoScale;
}
bool AxisLayout::getGrowCrossAxis() const {
return m_growCrossAxis;
}
bool AxisLayout::getCrossAxisOverflow() const {
return m_allowCrossAxisOverflow;
}
AxisLayout* AxisLayout::setCrossAxisAlignment(AxisAlignment align) {
m_crossAlignment = align;
return this;