| 285 | } |
| 286 | |
| 287 | void GuiStackControl::stackHorizontal(bool fromLeft) |
| 288 | { |
| 289 | if( empty() ) |
| 290 | return; |
| 291 | |
| 292 | S32 begin, end, step; |
| 293 | if ( fromLeft ) |
| 294 | { |
| 295 | // Stack from Child0 at left to ChildN at right |
| 296 | begin = 0; |
| 297 | end = size(); |
| 298 | step = 1; |
| 299 | } |
| 300 | else |
| 301 | { |
| 302 | // Stack from ChildN at left to Child0 at right |
| 303 | begin = size()-1; |
| 304 | end = -1; |
| 305 | step = -1; |
| 306 | } |
| 307 | |
| 308 | // Place each visible child control |
| 309 | S32 maxHeight = 0; |
| 310 | Point2I curPos(0, 0); |
| 311 | for ( S32 i = begin; i != end; i += step ) |
| 312 | { |
| 313 | GuiControl * gc = dynamic_cast<GuiControl*>( at(i) ); |
| 314 | if ( gc && gc->isVisible() ) |
| 315 | { |
| 316 | // Add padding between controls |
| 317 | if ( curPos.x > 0 ) |
| 318 | curPos.x += mPadding; |
| 319 | |
| 320 | Point2I childPos = curPos; |
| 321 | if ( !mChangeChildPosition ) |
| 322 | childPos.y = gc->getTop(); |
| 323 | |
| 324 | Point2I childSize( gc->getExtent() ); |
| 325 | if ( mChangeChildSizeToFit ) |
| 326 | childSize.y = getHeight(); |
| 327 | |
| 328 | gc->resize( childPos, childSize ); |
| 329 | |
| 330 | curPos.x += gc->getWidth(); |
| 331 | maxHeight = getMax( maxHeight, childPos.y + childSize.y ); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | if ( mDynamicSize ) |
| 336 | { |
| 337 | // Conform our size to the sum of the child sizes. |
| 338 | Point2I newPos( getPosition() ); |
| 339 | Point2I newSize( curPos.x, mDynamicNonStackExtent ? maxHeight : getHeight() ); |
| 340 | |
| 341 | newSize.setMax( getMinExtent() ); |
| 342 | |
| 343 | // Grow the stack left instead of right? |
| 344 | if ( mDynamicPos ) |
nothing calls this directly
no test coverage detected