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

Method setSelectedPath

Engine/source/gui/controls/guiFileTreeCtrl.cpp:398–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398bool GuiFileTreeCtrl::setSelectedPath( const char* path )
399{
400 if( !path )
401 return false;
402
403 // Since we only list one deep on paths, we need to add the path to the tree just incase it isn't already indexed in the tree
404 // or else we wouldn't be able to select a path we hadn't previously browsed to. :)
405 if( _isDirInMainDotCsPath( path ) )
406 addPathToTree( path );
407
408 // see if we have a child that matches what we want
409 for(U32 i = 0; i < mItems.size(); i++)
410 {
411 if( dStricmp( mItems[i]->getValue(), path ) == 0 )
412 {
413 Item* item = mItems[i];
414 AssertFatal(item,"GuiFileTreeCtrl::setSelectedPath - Item Index Bad, Fatal Mistake!!!");
415 item->setExpanded( true );
416 clearSelection();
417 setItemSelected( item->getID(), true );
418 // make sure all of it's parents are expanded
419 S32 parent = getParentItem( item->getID() );
420 while( parent != 0 )
421 {
422 setItemExpanded( parent, true );
423 parent = getParentItem( parent );
424 }
425 // Rebuild our tree just incase we've oops'd
426 buildVisibleTree();
427 scrollVisible( item );
428 }
429 }
430 return false;
431}

Callers 1

Calls 6

_isDirInMainDotCsPathFunction · 0.85
dStricmpFunction · 0.85
sizeMethod · 0.45
getValueMethod · 0.45
setExpandedMethod · 0.45
getIDMethod · 0.45

Tested by

no test coverage detected