30 m_cellSize =
Size(16,16);
41 if(node->tag() ==
"cell-size")
43 else if(node->tag() ==
"cell-width")
45 else if(node->tag() ==
"cell-height")
47 else if(node->tag() ==
"cell-spacing")
49 else if(node->tag() ==
"num-columns")
51 else if(node->tag() ==
"num-lines")
53 else if(node->tag() ==
"fit-children")
55 else if(node->tag() ==
"auto-spacing")
57 else if(node->tag() ==
"flow")
84 int numColumns = m_numColumns;
85 if(m_flow && m_cellSize.
width() > 0) {
86 numColumns = (clippingRect.
width() + m_cellSpacing) / (m_cellSize.
width() + m_cellSpacing);
88 m_numColumns = numColumns;
89 m_numLines = std::ceil(widgets.size() / (
float)numColumns);
96 int cellSpacing = m_cellSpacing;
97 if(m_autoSpacing && numColumns > 1)
98 cellSpacing = (clippingRect.
width() - numColumns * m_cellSize.
width()) / (numColumns - 1);
101 int preferredHeight = 0;
103 if(!widget->isExplicitlyVisible())
106 int line = index / numColumns;
107 int column = index % numColumns;
108 Point virtualPos =
Point(column * (m_cellSize.
width() + cellSpacing), line * (m_cellSize.
height() + cellSpacing));
109 preferredHeight = virtualPos.
y + m_cellSize.
height();
112 dest.
expand(-widget->getMarginTop(), -widget->getMarginRight(), -widget->getMarginBottom(), -widget->getMarginLeft());
114 if(widget->setRect(dest))
119 if(m_numLines > 0 && index >= m_numColumns * m_numLines)
124 if(m_fitChildren && preferredHeight != parentWidget->
getHeight()) {
127 parentWidget->
setHeight(preferredHeight);