| 151 | //----------------------------------------------------------------------------- |
| 152 | |
| 153 | void GuiCheckBoxCtrl::autoSize() |
| 154 | { |
| 155 | U32 width, height; |
| 156 | U32 bmpArrayRect0Width = 0; |
| 157 | |
| 158 | if( !mAwake ) |
| 159 | { |
| 160 | mProfile->incLoadCount(); |
| 161 | |
| 162 | if( !mProfile->mBitmapArrayRects.size() ) |
| 163 | mProfile->constructBitmapArray(); |
| 164 | if( mProfile->mBitmapArrayRects.size() ) |
| 165 | bmpArrayRect0Width = mProfile->mBitmapArrayRects[ 0 ].extent.x; |
| 166 | } |
| 167 | |
| 168 | U32 bmpWidth = bmpArrayRect0Width + 2 + mIndent; |
| 169 | U32 strWidth = mProfile->mFont->getStrWidthPrecise( mButtonText ); |
| 170 | |
| 171 | width = bmpWidth + strWidth + 2; |
| 172 | |
| 173 | U32 bmpHeight = mProfile->mBitmapArrayRects[0].extent.y; |
| 174 | U32 fontHeight = mProfile->mFont->getHeight(); |
| 175 | |
| 176 | height = getMax( bmpHeight, fontHeight ) + 4; |
| 177 | |
| 178 | setExtent( width, height ); |
| 179 | |
| 180 | if( !mAwake ) |
| 181 | mProfile->decLoadCount(); |
| 182 | } |
| 183 | |
| 184 | //============================================================================= |
| 185 | // API. |