MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / resize

Method resize

Engine/source/gui/buttons/guiIconButtonCtrl.cpp:170–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170bool 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
202void GuiIconButtonCtrl::setBitmap(const char *name)
203{

Callers

nothing calls this directly

Calls 4

getStrWidthPreciseMethod · 0.80
resizeFunction · 0.50
getHeightMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected