| 150 | // -------------------------------------------------------------------------------------------------------------------- |
| 151 | |
| 152 | Size<uint> VerticallyStackedHorizontalLayout::adjustSize(const uint padding) |
| 153 | { |
| 154 | uint biggestWidth = 0; |
| 155 | uint totalHeight = 0; |
| 156 | |
| 157 | // iterate all widgets to find which one is the biggest (horizontally) |
| 158 | for (HorizontalLayoutIterator it=items.begin(), end=items.end(); it != end; ++it) |
| 159 | { |
| 160 | HorizontalLayout* const l(*it); |
| 161 | uint width = 0; |
| 162 | uint height = 0; |
| 163 | |
| 164 | for (SubWidgetWithSizeHintIterator it2=l->widgets.begin(), end2=l->widgets.end(); it2 != end2; ++it2) |
| 165 | { |
| 166 | SubWidgetWithSizeHint& s(*it2); |
| 167 | |
| 168 | if (width != 0) |
| 169 | width += padding; |
| 170 | |
| 171 | width += s.widget->getWidth(); |
| 172 | height = std::max(height, s.widget->getHeight()); |
| 173 | } |
| 174 | |
| 175 | biggestWidth = std::max(biggestWidth, width); |
| 176 | |
| 177 | if (totalHeight != 0) |
| 178 | totalHeight += padding; |
| 179 | |
| 180 | totalHeight += height; |
| 181 | } |
| 182 | |
| 183 | // now make all horizontal lines the same width |
| 184 | for (HorizontalLayoutIterator it=items.begin(), end=items.end(); it != end; ++it) |
| 185 | { |
| 186 | HorizontalLayout* const l(*it); |
| 187 | l->setSize(biggestWidth, padding); |
| 188 | } |
| 189 | |
| 190 | return Size<uint>(biggestWidth, totalHeight); |
| 191 | } |
| 192 | |
| 193 | void VerticallyStackedHorizontalLayout::setAbsolutePos(const int x, int y, const uint padding) |
| 194 | { |