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

Method onRender

Engine/source/gui/editor/guiSeparatorCtrl.cpp:89–141  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

87
88//--------------------------------------------------------------------------
89void GuiSeparatorCtrl::onRender(Point2I offset, const RectI &updateRect)
90{
91 Parent::onRender( offset, updateRect );
92
93 if( mInvisible )
94 return;
95
96 if( mText.isNotEmpty() && mSeparatorType != separatorTypeVertical )
97 {
98 // If text is present and we have a left margin, then draw some separator, then the
99 // text, and then the rest of the separator.
100
101 S32 posx = offset.x + mMargin;
102 S32 fontheight = mProfile->mFont->getHeight();
103 S32 seppos = (fontheight - 2) / 2 + offset.y;
104 if( mTextLeftMargin > 0 )
105 {
106 RectI rect( Point2I( posx, seppos ), Point2I( mTextLeftMargin, 2 ) );
107 renderSlightlyLoweredBox(rect, mProfile);
108 posx += mTextLeftMargin;
109 }
110
111 GFX->getDrawUtil()->setBitmapModulation( mProfile->mFontColor );
112 posx = GFX->getDrawUtil()->drawText(mProfile->mFont, Point2I(posx,offset.y), mText, mProfile->mFontColors);
113
114 RectI rect( Point2I( posx, seppos ), Point2I( getWidth() - posx + offset.x, 2 ) );
115
116 // Space text and separator a bit apart at right end.
117
118 rect.point.x += 2;
119 rect.extent.x -= 2;
120
121 if( rect.extent.x > 0 )
122 renderSlightlyLoweredBox( rect, mProfile );
123 }
124 else
125 {
126 if( mSeparatorType == separatorTypeHorizontal )
127 {
128 S32 seppos = getHeight() / 2 + offset.y;
129 RectI rect(Point2I(offset.x + mMargin ,seppos),Point2I(getWidth() - (mMargin * 2),2));
130 renderSlightlyLoweredBox(rect, mProfile);
131 }
132 else
133 {
134 S32 seppos = getWidth() / 2 + offset.x;
135 RectI rect(Point2I(seppos, offset.y + mMargin),Point2I(2, getHeight() - (mMargin * 2)));
136 renderSlightlyLoweredBox(rect, mProfile);
137 }
138 }
139
140 renderChildControls(offset, updateRect);
141}
142
143

Callers

nothing calls this directly

Calls 9

renderSlightlyLoweredBoxFunction · 0.85
getWidthFunction · 0.85
setBitmapModulationMethod · 0.80
getDrawUtilMethod · 0.80
Point2IClass · 0.50
getHeightFunction · 0.50
isNotEmptyMethod · 0.45
getHeightMethod · 0.45
drawTextMethod · 0.45

Tested by

no test coverage detected