| 168 | } |
| 169 | |
| 170 | bool GuiIconButtonCtrl::resize(const Point2I &newPosition, const Point2I &newExtent) |
| 171 | { |
| 172 | if ( !mAutoSize || !mProfile->mFont ) |
| 173 | return Parent::resize( newPosition, newExtent ); |
| 174 | |
| 175 | Point2I autoExtent( mMinExtent ); |
| 176 | |
| 177 | if ( mIconLocation != IconLocNone ) |
| 178 | { |
| 179 | autoExtent.y = mBitmap.getHeight() + mButtonMargin.y * 2; |
| 180 | autoExtent.x = mBitmap.getWidth() + mButtonMargin.x * 2; |
| 181 | } |
| 182 | |
| 183 | if ( mTextLocation != TextLocNone && mButtonText && mButtonText[0] ) |
| 184 | { |
| 185 | U32 strWidth = mProfile->mFont->getStrWidthPrecise( mButtonText ); |
| 186 | |
| 187 | if ( mTextLocation == TextLocLeft || mTextLocation == TextLocRight ) |
| 188 | { |
| 189 | autoExtent.x += strWidth + mTextMargin * 2; |
| 190 | } |
| 191 | else // Top, Bottom, Center |
| 192 | { |
| 193 | strWidth += mTextMargin * 2; |
| 194 | if ( strWidth > autoExtent.x ) |
| 195 | autoExtent.x = strWidth; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | return Parent::resize( newPosition, autoExtent ); |
| 200 | } |
| 201 | |
| 202 | void GuiIconButtonCtrl::setBitmap(const char *name) |
| 203 | { |
nothing calls this directly
no test coverage detected