| 134 | } |
| 135 | |
| 136 | void WrapPanel::simpleArrange() |
| 137 | { |
| 138 | IntCoord coordAvailable(0, 0, getWidth(), getHeight()); |
| 139 | IntPoint currentPosition = coordAvailable.point(); |
| 140 | |
| 141 | int maxLineHeight = 0; |
| 142 | bool hasAnyWidget = false; |
| 143 | size_t startLineIndex = 0; |
| 144 | |
| 145 | size_t count = getChildCount(); |
| 146 | for (size_t index = 0; index < count; ++index) |
| 147 | { |
| 148 | Widget* child = getChildAt(index); |
| 149 | IntSize size = Panel::getDesiredSize(child); |
| 150 | |
| 151 | if (((currentPosition.left + size.width) > coordAvailable.width)) |
| 152 | { |
| 153 | if (hasAnyWidget) |
| 154 | { |
| 155 | alignChildLine( |
| 156 | startLineIndex, |
| 157 | index, |
| 158 | IntCoord(coordAvailable.left, currentPosition.top, coordAvailable.width, maxLineHeight), |
| 159 | currentPosition.left - mSpacer.width); |
| 160 | |
| 161 | currentPosition.left = 0; |
| 162 | currentPosition.top += maxLineHeight + mSpacer.height; |
| 163 | maxLineHeight = 0; |
| 164 | |
| 165 | startLineIndex = index; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | currentPosition.left += size.width + mSpacer.width; |
| 170 | maxLineHeight = (std::max)(size.height, maxLineHeight); |
| 171 | |
| 172 | hasAnyWidget = true; |
| 173 | } |
| 174 | |
| 175 | if (startLineIndex < count) |
| 176 | alignChildLine( |
| 177 | startLineIndex, |
| 178 | count, |
| 179 | IntCoord(coordAvailable.left, currentPosition.top, coordAvailable.width, maxLineHeight), |
| 180 | currentPosition.left - mSpacer.width); |
| 181 | } |
| 182 | |
| 183 | IntSize WrapPanel::floatMeasure(const IntSize& _sizeAvailable) |
| 184 | { |