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

Method onRender

Engine/source/gui/controls/guiPopUpCtrl.cpp:865–1144  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

863
864//------------------------------------------------------------------------------
865void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
866{
867 TORQUE_UNUSED(updateRect);
868 Point2I localStart;
869
870 if ( mScrollDir != GuiScrollCtrl::None )
871 autoScroll();
872
873 GFXDrawUtil* drawUtil = GFX->getDrawUtil();
874
875 RectI baseRect( offset, getExtent() );
876 if ( mInAction )
877 {
878 S32 left = baseRect.point.x, right = baseRect.point.x + baseRect.extent.x - 1;
879 S32 top = baseRect.point.y, bottom = baseRect.point.y + baseRect.extent.y - 1;
880
881 // Do we render a bitmap border or lines?
882 if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() )
883 {
884 if (mProfile->mBitmapArrayRects[0].extent.y < baseRect.extent.y)
885 {
886 //if our bitmap is smaller than the height of our ctrl, we'll nudge it towards the center
887 U32 nudge = (baseRect.extent.y - mProfile->mBitmapArrayRects[0].extent.y) / 2;
888 baseRect.point.y += nudge;
889 }
890 // Render the fixed, filled in border
891 renderFixedBitmapBordersFilled(baseRect, 3, mProfile );
892
893 }
894 else
895 {
896 //renderSlightlyLoweredBox(r, mProfile);
897 drawUtil->drawRectFill(baseRect, mProfile->mFillColor );
898 }
899
900 // Draw a bitmap over the background?
901 if ( mBitmap[Depressed] )
902 {
903 RectI rect(offset, mBitmapBounds);
904 drawUtil->clearBitmapModulation();
905 drawUtil->drawBitmapStretch( mBitmap[Depressed], rect );
906 }
907 else if ( mBitmap[Normal] )
908 {
909 RectI rect(offset, mBitmapBounds);
910 drawUtil->clearBitmapModulation();
911 drawUtil->drawBitmapStretch( mBitmap[Normal], rect );
912 }
913
914 // Do we render a bitmap border or lines?
915 if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
916 {
917 drawUtil->drawLine(left, top, left, bottom, colorWhite );
918 drawUtil->drawLine(left, top, right, top, colorWhite );
919 drawUtil->drawLine(left + 1, bottom, right, bottom, mProfile->mBorderColor );
920 drawUtil->drawLine(right, top + 1, right, bottom - 1, mProfile->mBorderColor );
921 }
922

Callers

nothing calls this directly

Calls 15

getWidthFunction · 0.85
beginFunction · 0.85
endFunction · 0.85
getDrawUtilMethod · 0.80
getChildrenProfileMethod · 0.80
drawRectFillMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapStretchMethod · 0.80
drawRectMethod · 0.80
getStrWidthMethod · 0.80
setBitmapModulationMethod · 0.80

Tested by

no test coverage detected