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

Method getDisplayText

Engine/source/gui/controls/guiTreeViewCtrl.cpp:482–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480//-----------------------------------------------------------------------------
481
482void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf)
483{
484 FrameAllocatorMarker txtAlloc;
485
486 //if we're doing the special case of forcing the item text, just skip the rest of this junk
487 if (mState.test(ForceItemName))
488 {
489 StringTableEntry text = (mScriptInfo.mText) ? mScriptInfo.mText : StringTable->EmptyString();
490 dStrncpy(buf, text, bufLen);
491 return;
492 }
493
494 if( mState.test( InspectorData ) )
495 {
496 SimObject *pObject = getObject();
497 if( pObject )
498 {
499 const char* pObjName = pObject->getName();
500 const char* pInternalName = pObject->getInternalName();
501
502 bool hasInternalName = pInternalName && pInternalName[0];
503 bool hasObjectName = pObjName && pObjName[0];
504
505 const char* pClassName = pObject->getClassName();
506
507 if( showInternalNameOnly() )
508 dSprintf( buf, bufLen, "%s", hasInternalName ? pInternalName : "(none)" );
509 else if( showObjectNameOnly() )
510 {
511 if( !hasObjectName && mState.test( ShowClassNameForUnnamed ) )
512 dSprintf( buf, bufLen, "%s", pClassName );
513 else
514 dSprintf( buf, bufLen, "%s", hasObjectName ? pObjName : "(none)" );
515 }
516 else
517 {
518 char* ptr = buf;
519 int len = bufLen;
520
521 if( mState.test( ShowObjectId ) )
522 {
523 S32 n = dSprintf( ptr, len, "%d: ", pObject->getId() );
524 ptr += n;
525 len -= n;
526 }
527
528 if( mState.test( ShowClassName ) )
529 {
530 S32 n;
531 if( hasObjectName && mState.test( ShowObjectName ) )
532 n = dSprintf( ptr, len, "%s - ", pClassName );
533 else
534 n = dSprintf( ptr, len, "%s", pClassName );
535
536 ptr += n;
537 len -= n;
538 }
539

Callers 5

IMPLEMENT_CALLBACKFunction · 0.80
_buildItemMethod · 0.80
_hitTestMethod · 0.80
onRenderCellMethod · 0.80
renderTooltipMethod · 0.80

Calls 9

dStrncpyFunction · 0.85
dSprintfFunction · 0.85
getTextFunction · 0.85
EmptyStringMethod · 0.80
getInternalNameMethod · 0.80
getIdMethod · 0.65
testMethod · 0.45
getNameMethod · 0.45
getClassNameMethod · 0.45

Tested by

no test coverage detected