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

Method onRenderCell

Engine/source/gui/controls/guiPopUpCtrlEx.cpp:235–306  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

233
234//------------------------------------------------------------------------------
235void GuiPopupTextListCtrlEx::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver)
236{
237 Point2I size;
238 getCellSize( size );
239
240 // Render a background color for the cell
241 if ( mouseOver )
242 {
243 RectI cellR( offset.x, offset.y, size.x, size.y );
244 GFX->getDrawUtil()->drawRectFill( cellR, mProfile->mFillColorHL );
245 }
246 else if ( selected )
247 {
248 RectI cellR( offset.x, offset.y, size.x, size.y );
249 GFX->getDrawUtil()->drawRectFill( cellR, mProfile->mFillColorSEL );
250 }
251
252 // Define the default x offset for the text
253 U32 textXOffset = offset.x + mProfile->mTextOffset.x;
254
255 // Do we also draw a colored box beside the text?
256 ColorI boxColor;
257 bool drawbox = mPopUpCtrl->getColoredBox( boxColor, mList[cell.y].id );
258 if ( drawbox )
259 {
260 Point2I coloredboxsize( 15, 10 );
261 RectI r( offset.x + mProfile->mTextOffset.x, offset.y + 2, coloredboxsize.x, coloredboxsize.y );
262 GFX->getDrawUtil()->drawRectFill( r, boxColor );
263 GFX->getDrawUtil()->drawRect( r, ColorI( 0, 0, 0 ) );
264
265 textXOffset += coloredboxsize.x + mProfile->mTextOffset.x;
266 }
267
268 // Render 'Group' background
269 if ( mList[cell.y].id == -1)
270 {
271 RectI cellR( offset.x, offset.y, size.x, size.y );
272 GFX->getDrawUtil()->drawRectFill( cellR, mProfile->mFillColorHL );
273 }
274
275 ColorI fontColor;
276 mPopUpCtrl->getFontColor( fontColor, mList[cell.y].id, selected, mouseOver );
277
278 GFX->getDrawUtil()->setBitmapModulation( fontColor );
279 //GFX->drawText( mFont, Point2I( offset.x + 4, offset.y ), mList[cell.y].text );
280
281 // Get the number of columns in the cell
282 S32 colcount = getColumnCount(mList[cell.y].text, "\t");
283
284 // Are there two or more columns?
285 if(colcount >= 2)
286 {
287 char buff[256];
288
289 // Draw the first column
290 getColumn(mList[cell.y].text, buff, 0, "\t");
291 GFX->getDrawUtil()->drawText( mFont, Point2I( textXOffset, offset.y ), buff ); // Used mTextOffset as a margin for the text list rather than the hard coded value of '4'.
292

Callers

nothing calls this directly

Calls 13

getCellSizeFunction · 0.85
drawRectFillMethod · 0.80
getDrawUtilMethod · 0.80
drawRectMethod · 0.80
setBitmapModulationMethod · 0.80
getStrWidthMethod · 0.80
getColumnCountFunction · 0.70
getColumnFunction · 0.70
ColorIClass · 0.50
Point2IClass · 0.50
getColoredBoxMethod · 0.45
getFontColorMethod · 0.45

Tested by

no test coverage detected