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

Method autoSize

Engine/source/gui/buttons/guiCheckBoxCtrl.cpp:153–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151//-----------------------------------------------------------------------------
152
153void 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.

Callers 1

onAddMethod · 0.80

Calls 8

getMaxFunction · 0.85
setExtentFunction · 0.85
incLoadCountMethod · 0.80
constructBitmapArrayMethod · 0.80
getStrWidthPreciseMethod · 0.80
decLoadCountMethod · 0.80
sizeMethod · 0.45
getHeightMethod · 0.45

Tested by 1

onAddMethod · 0.64