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

Method reparentItems

Engine/source/gui/controls/guiTreeViewCtrl.cpp:4496–4840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4494}
4495
4496void GuiTreeViewCtrl::reparentItems(Vector<Item*> selectedItems, Item* newParent)
4497{
4498 for (S32 i = 0; i < selectedItems.size(); i++)
4499 {
4500 Item* item = selectedItems[i];
4501
4502 if (mDebug)
4503 Con::printf("----------------------------");
4504
4505 // clear old highlighting of the item
4506 item->mState.clear(Item::MouseOverBmp | Item::MouseOverText);
4507
4508 // move the selected item to the newParent
4509 Item * oldParent = item->mParent;
4510 // Snag the current parent set if any for future reference
4511 SimSet * parentSet = NULL;
4512
4513 if (oldParent != nullptr && oldParent->isInspectorData())
4514 {
4515 parentSet = dynamic_cast<SimSet*>(oldParent->getObject());
4516 }
4517 else
4518 {
4519 // parent is probably script data so we search up the tree for a
4520 // set to put our object in
4521 Item* temp = oldParent;
4522 while (temp)
4523 {
4524 if (temp->isInspectorData())
4525 break;
4526 temp = temp->mParent;
4527 }
4528 // found an ancestor who is an inspectorData
4529 if (temp)
4530 {
4531 if (temp->isInspectorData())
4532 parentSet = dynamic_cast<SimSet*>(temp->getObject());
4533 }
4534 }
4535
4536 // unlink from the current position in the list
4537 unlinkItem(item);
4538
4539 // update the parent's children
4540
4541 // check if we an only child
4542 if (item->mParent && item->mParent->mChild == item)
4543 {
4544 if (item->mNext)
4545 item->mParent->mChild = item->mNext;
4546 else
4547 item->mParent->mChild = NULL;
4548 }
4549
4550 if (mDragMidPoint != NomDragMidPoint)
4551 {
4552
4553 //if it is below an expanded tree, place as last item in the tree

Callers 1

Calls 13

printfFunction · 0.85
isInspectorDataMethod · 0.80
isParentMethod · 0.80
getIdMethod · 0.65
sizeMethod · 0.45
clearMethod · 0.45
getObjectMethod · 0.45
isExpandedMethod · 0.45
testMethod · 0.45
lastMethod · 0.45
removeObjectMethod · 0.45
reOrderMethod · 0.45

Tested by

no test coverage detected