MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / renderButton

Method renderButton

Engine/source/gui/buttons/guiIconButtonCtrl.cpp:228–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
229{
230 bool highlight = mMouseOver;
231 bool depressed = mDepressed;
232
233 ColorI fontColor = mActive ? (highlight ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
234
235 RectI boundsRect(offset, getExtent());
236
237 GFXDrawUtil *drawer = GFX->getDrawUtil();
238
239 if (mDepressed || mStateOn)
240 {
241 // If there is a bitmap array then render using it.
242 // Otherwise use a standard fill.
243 if(mProfile->mUseBitmapArray && mProfile->mBitmapArrayRects.size())
244 renderBitmapArray(boundsRect, statePressed);
245 else
246 renderSlightlyLoweredBox(boundsRect, mProfile);
247 }
248 else if(mMouseOver && mActive)
249 {
250 // If there is a bitmap array then render using it.
251 // Otherwise use a standard fill.
252 if(mProfile->mUseBitmapArray && mProfile->mBitmapArrayRects.size())
253 renderBitmapArray(boundsRect, stateMouseOver);
254 else
255 renderSlightlyRaisedBox(boundsRect, mProfile);
256 }
257 else
258 {
259 // If there is a bitmap array then render using it.
260 // Otherwise use a standard fill.
261 if(mProfile->mUseBitmapArray && mProfile->mBitmapArrayRects.size())
262 {
263 if(mActive)
264 renderBitmapArray(boundsRect, stateNormal);
265 else
266 renderBitmapArray(boundsRect, stateDisabled);
267 }
268 else
269 {
270 drawer->drawRectFill(boundsRect, mProfile->mFillColorNA);
271 drawer->drawRect(boundsRect, mProfile->mBorderColorNA);
272 }
273 }
274
275 Point2I textPos = offset;
276 if(depressed)
277 textPos += Point2I(1,1);
278
279 RectI iconRect( 0, 0, 0, 0 );
280
281 // Render the icon
282 if ( mTextureNormal && mIconLocation != GuiIconButtonCtrl::IconLocNone )
283 {
284 // Render the normal bitmap
285 drawer->clearBitmapModulation();

Callers

nothing calls this directly

Calls 15

renderSlightlyLoweredBoxFunction · 0.85
renderSlightlyRaisedBoxFunction · 0.85
getWidthFunction · 0.85
getDrawUtilMethod · 0.80
drawRectFillMethod · 0.80
drawRectMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapStretchMethod · 0.80
setBitmapModulationMethod · 0.80
Point2IClass · 0.50
getHeightFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected