| 2438 | //----------------------------------------------------------------------------- |
| 2439 | |
| 2440 | bool GuiTreeViewCtrl::setItemExpanded(S32 itemId, bool expand) |
| 2441 | { |
| 2442 | Item * item = getItem(itemId); |
| 2443 | if(!item) |
| 2444 | { |
| 2445 | Con::errorf(ConsoleLogEntry::General, "GuiTreeViewCtrl::setItemExpanded: invalid item id!"); |
| 2446 | return(false); |
| 2447 | } |
| 2448 | |
| 2449 | if(item->isExpanded() == expand) |
| 2450 | return(true); |
| 2451 | |
| 2452 | item->setExpanded(expand); |
| 2453 | |
| 2454 | // expand parents |
| 2455 | if(expand) |
| 2456 | { |
| 2457 | while (item) |
| 2458 | { |
| 2459 | if (!item->isInspectorData() && item->mState.test(Item::VirtualParent)) |
| 2460 | onVirtualParentExpand(item); |
| 2461 | |
| 2462 | scrollVisible(item); |
| 2463 | item = item->mParent; |
| 2464 | } |
| 2465 | } |
| 2466 | else |
| 2467 | { |
| 2468 | if(item->mState.test(Item::VirtualParent)) |
| 2469 | onVirtualParentCollapse(item); |
| 2470 | |
| 2471 | item->setExpanded(false); |
| 2472 | } |
| 2473 | |
| 2474 | //if (!item->isInspectorData() && item->mState.test(Item::VirtualParent)) |
| 2475 | // onVirtualParentExpand(item); |
| 2476 | |
| 2477 | mFlags.set(RebuildVisible); |
| 2478 | |
| 2479 | return(true); |
| 2480 | } |
| 2481 | |
| 2482 | |
| 2483 | //----------------------------------------------------------------------------- |
no test coverage detected