44 GUITableNode::GUITableNode(
54 const string& backgroundImage,
56 const GUIColor& backgroundImageEffectColorMul,
57 const GUIColor& backgroundImageEffectColorAdd,
64 GUIParentNode(screenNode, parentNode, id, flow, overflowX, overflowY, alignments, requestedConstraints, backgroundColor, backgroundImage, backgroundImageScale9Grid, backgroundImageEffectColorMul, backgroundImageEffectColorAdd, border, padding, showOn, hideOn, tooltip)
81 for (
auto i = 0; i <
subNodes.size(); i++) {
83 if (guiSubNode->conditionsMet ==
false)
continue;
87 auto contentWidth = guiSubNode->getAutoWidth();
88 if (contentWidth > width) {
100 for (
auto i = 0; i <
subNodes.size(); i++) {
102 if (guiSubNode->conditionsMet ==
false)
continue;
106 height += guiSubNode->getAutoHeight();
120 auto nodesHeight = 0;
121 auto finalNodesHeight = 0;
122 for (
auto i = 0; i <
subNodes.size(); i++) {
124 if (guiSubNode->conditionsMet ==
false)
continue;
131 nodesHeight += guiSubNode->computedConstraints.height;
132 finalNodesHeight += guiSubNode->computedConstraints.height;
135 auto verticalStarPixelRest = 0.0f;
136 for (
auto i = 0; i <
subNodes.size(); i++) {
138 if (guiSubNode->conditionsMet ==
false)
continue;
140 auto nodeStarHeight = (
static_cast<float>(height) -
static_cast<float>(nodesHeight)) /
static_cast<float>(starCount);
141 auto nodeStarHeightInt =
static_cast<int>(nodeStarHeight);
142 verticalStarPixelRest += nodeStarHeight - nodeStarHeightInt;
143 if (
static_cast<int>(verticalStarPixelRest) > 0) {
144 nodeStarHeightInt +=
static_cast<int>(verticalStarPixelRest);
145 verticalStarPixelRest -=
static_cast<int>(verticalStarPixelRest);
147 guiSubNode->requestedConstraints.height = nodeStarHeightInt;
148 guiSubNode->computedConstraints.height = nodeStarHeightInt;
149 if (guiSubNode->computedConstraints.height < 0) {
150 guiSubNode->computedConstraints.height = 0;
152 finalNodesHeight += guiSubNode->computedConstraints.height;
154 required_dynamic_cast<GUIParentNode*>(guiSubNode)->layoutSubNodes();
159 for (
auto i = 0; i <
subNodes.size(); i++) {
161 if (guiSubNode->conditionsMet ==
false)
continue;
166 for (
auto i = 0; i <
subNodes.size(); i++) {
168 if (guiSubNode->conditionsMet ==
false)
continue;
169 guiSubNode->computedConstraints.alignmentTop =
border.
top +
padding.
top + ((height - finalNodesHeight) / 2);
173 for (
auto i = 0; i <
subNodes.size(); i++) {
175 if (guiSubNode->conditionsMet ==
false)
continue;
176 guiSubNode->computedConstraints.alignmentTop = (height - finalNodesHeight);
183 for (
auto i = 0; i <
subNodes.size(); i++) {
185 guiSubNode->computeContentAlignment();
196 for (
auto i = 0; i <
subNodes.size(); i++) {
198 if (guiSubNode->conditionsMet ==
false)
continue;
199 guiSubNode->setTop(top);
203 top += guiSubNode->computedConstraints.height;
212 for (
auto i = 0; i <
subNodes.size(); i++) {
214 if (guiSubNode->conditionsMet ==
false)
continue;
215 guiSubNode->setLeft(left);
217 left += guiSubNode->computedConstraints.width;
223 for (
auto guiTableRowNode:
subNodes) {
224 auto guiTableCellNode = required_dynamic_cast<GUITableCellNode*>((required_dynamic_cast<GUITableRowNode*>(guiTableRowNode))->
subNodes.at(x));
225 if (guiTableCellNode->conditionsMet ==
false)
continue;
226 const auto& requestedConstaints = guiTableCellNode->getRequestsConstraints();
231 maxWidth = Math::max(maxWidth, guiTableCellNode->getAutoWidth());
234 maxWidth = Math::max(maxWidth, guiTableCellNode->getContentWidth());
242 for (
auto guiTableCellNode: required_dynamic_cast<GUITableRowNode*>(
subNodes.at(y))->subNodes) {
243 if (guiTableCellNode->conditionsMet ==
false)
continue;
244 const auto& requestedConstaints = guiTableCellNode->getRequestsConstraints();
249 maxHeight = Math::max(maxHeight, guiTableCellNode->getAutoHeight());
252 maxHeight = Math::max(maxHeight, guiTableCellNode->getContentHeight());
GUI element node conditions.
GUI node horizontal alignment enum.
GUI node vertical alignment enum.
static STATIC_DLL_IMPEXT GUINode_AlignmentVertical * BOTTOM
static STATIC_DLL_IMPEXT GUINode_AlignmentVertical * CENTER
static STATIC_DLL_IMPEXT GUINode_AlignmentVertical * TOP
static STATIC_DLL_IMPEXT GUINode_Flow * FLOATING
GUI node requested constraints requested constraints type enum.
static STATIC_DLL_IMPEXT GUINode_RequestedConstraints_RequestedConstraintsType * STAR
static STATIC_DLL_IMPEXT GUINode_RequestedConstraints_RequestedConstraintsType * PIXEL
static STATIC_DLL_IMPEXT GUINode_RequestedConstraints_RequestedConstraintsType * AUTO
virtual void setLeft(int left)
Set computed left.
GUINode_ComputedConstraints computedConstraints
virtual void setTop(int top)
Set computed top.
GUINode_RequestedConstraints requestedConstraints
GUINode_Alignments alignments
GUI parent node overflow enum.
GUI parent node base class thats supporting child nodes.
virtual void computeHorizontalChildrenAlignment()
Compute horizontal children alignment.
virtual void layoutSubNodes()
Layout sub nodes.
vector< GUINode * > subNodes
GUI screen node that represents a screen that can be rendered via GUI system.
const string getNodeType() override
int getContentWidth() override
int getContentHeight() override
void setTop(int top) override
Set computed top.
void setLeft(int left) override
Set computed left.
int getTableCellMaxHeight(int y)
int getTableCellMaxWidth(int x)
bool isContentNode() override
void layoutSubNodes() override
Layout sub nodes.
GUINode_AlignmentVertical * vertical
GUI node computed constraints.
GUI node requested constraints entity.
GUINode_RequestedConstraints_RequestedConstraintsType * topType
GUINode_RequestedConstraints_RequestedConstraintsType * leftType
GUI node scale 9 grid entity.