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

Method onRender

Engine/source/gui/controls/guiMLTextCtrl.cpp:433–488  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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