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

Method onRender

Engine/source/gui/controls/guiMLTextCtrl.cpp:429–484  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

427
428//--------------------------------------------------------------------------
429void GuiMLTextCtrl::onRender(Point2I offset, const RectI& updateRect)
430{
431 Parent::onRender(offset, updateRect);
432
433 GFXDrawUtil *drawer = GFX->getDrawUtil();
434
435 // draw all the bitmaps
436 for(BitmapRef *walk = mBitmapRefList; walk; walk = walk->next)
437 {
438 RectI screenBounds = *walk;
439 screenBounds.point += offset;
440 if(!screenBounds.overlaps(updateRect))
441 continue;
442
443 drawer->clearBitmapModulation();
444 drawer->drawBitmap(walk->bitmap->bitmapObject, screenBounds.point);
445 //GFX->drawRectFill(screenBounds, mProfile->mFillColor);
446 }
447
448 offset += mProfile->mTextOffset;
449
450 // draw all the text and dividerStyles
451 for(Line *lwalk = mLineList; lwalk; lwalk = lwalk->next)
452 {
453 RectI lineRect(offset.x, offset.y + lwalk->y, getWidth(), lwalk->height);
454
455 if(!lineRect.overlaps(updateRect))
456 continue;
457
458 if(lwalk->divStyle)
459 drawer->drawRectFill(lineRect, mProfile->mFillColorHL);
460
461 for(Atom *awalk = lwalk->atomList; awalk; awalk = awalk->next)
462 {
463 if(!mSelectionActive || mSelectionEnd < awalk->textStart || mSelectionStart >= awalk->textStart + awalk->len)
464 drawAtomText(false, awalk->textStart, awalk->textStart + awalk->len, awalk, lwalk, offset);
465 else
466 {
467 U32 selectionStart = getMax(awalk->textStart, mSelectionStart);
468 U32 selectionEnd = getMin(awalk->textStart + awalk->len, mSelectionEnd + 1);
469
470 // draw some unselected text
471 if(selectionStart > awalk->textStart)
472 drawAtomText(false, awalk->textStart, selectionStart, awalk, lwalk, offset);
473
474 // draw the selection
475 drawAtomText(true, selectionStart, selectionEnd, awalk, lwalk, offset);
476
477 if(selectionEnd < awalk->textStart + awalk->len)
478 drawAtomText(false, selectionEnd, awalk->textStart + awalk->len, awalk, lwalk, offset);
479 }
480 }
481 }
482
483 drawer->clearBitmapModulation();
484}
485
486//--------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 7

getWidthFunction · 0.85
getMaxFunction · 0.85
getDrawUtilMethod · 0.80
overlapsMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapMethod · 0.80
drawRectFillMethod · 0.80

Tested by

no test coverage detected