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