本文整理汇总了C++中HierarchyTreeNode类的典型用法代码示例。如果您正苦于以下问题:C++ HierarchyTreeNode类的具体用法?C++ HierarchyTreeNode怎么用?C++ HierarchyTreeNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HierarchyTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StorePreviousParents
void ChangeNodeHeirarchy::StorePreviousParents()
{
for (HierarchyTreeNode::HIERARCHYTREENODESIDLIST::iterator iter = items.begin();
iter != items.end();
++iter)
{
HierarchyTreeNode* node = HierarchyTreeController::Instance()->GetTree().GetNode((*iter));
if (!node)
{
continue;
}
HierarchyTreeNode* parentNode = node->GetParent();
if (!parentNode)
{
continue;
}
HierarchyTreeNode::HIERARCHYTREENODEID addAfter = HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;
HierarchyTreeNode::HIERARCHYTREENODEID lastId = HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;
const HierarchyTreeNode::HIERARCHYTREENODESLIST& childs = parentNode->GetChildNodes();
for (HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator citer = childs.begin();
citer != childs.end();
++citer)
{
if (node == (*citer))
addAfter = lastId;
lastId = (*citer)->GetId();
}
// The Previous Parents are stored in the "item ID - parent ID" map.
this->previousParents.insert(std::make_pair(*iter, PreviousState(parentNode->GetId(), addAfter)));
}
}
示例2: StringToWString
// Initialize the control(s) attached.
void UIButtonMetadata::InitializeControl(const String& controlName, const Vector2& position)
{
BaseMetadata::InitializeControl(controlName, position);
int paramsCount = this->GetParamsCount();
for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++)
{
UIButton* button = dynamic_cast<UIButton*>(this->treeNodeParams[i].GetUIControl());
WideString controlText = StringToWString(button->GetName());
HierarchyTreeNode* activeNode = GetTreeNode(i);
// Initialize the button for all states.
int statesCount = UIControlStateHelper::GetUIControlStatesCount();
for (int stateID = 0; stateID < statesCount; stateID ++)
{
UIControl::eControlState state = UIControlStateHelper::GetUIControlState(stateID);
button->SetStateFont(state, EditorFontManager::Instance()->GetDefaultFont());
button->SetStateText(state, controlText);
// Button is state-aware.
activeNode->GetExtraData().SetLocalizationKey(controlText, state);
}
// Define some properties for the reference state.
button->SetStateDrawType(GetReferenceState(), UIControlBackground::DRAW_SCALE_TO_RECT);
}
}
示例3: switch
void DeleteSelectedNodeCommand::DecrementUnsavedChanges()
{
switch (type)
{
case TYPE_PLATFORM:
case TYPE_SCREEN:
HierarchyTreeController::Instance()->GetTree().GetNode((parentId))->DecrementUnsavedChanges();
break;
case TYPE_AGGREGATOR:
HierarchyTreeController::Instance()->GetTree().GetNode((parentId))->DecrementUnsavedChanges();
for (Set<HierarchyTreeNode::HIERARCHYTREENODEID>::iterator it = parentsOfRemovingAggregatorControls.begin();
it != parentsOfRemovingAggregatorControls.end();
++it)
{
HierarchyTreeNode* node = HierarchyTreeController::Instance()->GetTree().GetNode(*it);
if (node)
{
node->DecrementUnsavedChanges();
}
}
break;
case TYPE_CONTROLS:
default:
BaseCommand::DecrementUnsavedChanges();
break;
}
}
示例4: item
void HierarchyTreeControl::HandleDropHierarchyMimeData(QDropEvent *event, const HierarchyTreeControlMimeData* mimeData)
{
HierarchyTreeNode::HIERARCHYTREENODEID insertInTo = HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;
HierarchyTreeNode::HIERARCHYTREENODEID insertAfter = HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;
if (!GetMoveItemID(event, insertInTo, insertAfter))
return;
HierarchyTreeNode* parentNode = HierarchyTreeController::Instance()->GetTree().GetNode(insertInTo);
if (!parentNode)
{
parentNode = (HierarchyTreeNode*) HierarchyTreeController::Instance()->GetTree().GetRootNode();
insertInTo = parentNode->GetId();
}
if (!mimeData->IsDropEnable(parentNode))
{
return;
}
//Copy current selected item(s) if ctrl key is pressed during drag
if (event->keyboardModifiers() == Qt::ControlModifier)
{
CopyPasteController::Instance()->CopyControls(HierarchyTreeController::Instance()->GetActiveControlNodes());
CopyPasteController::Instance()->Paste(parentNode);
}
else //Otherwise move item(s)
{
HierarchyTreeNode::HIERARCHYTREENODESIDLIST items = mimeData->GetItems();
ChangeNodeHeirarchy* cmd = new ChangeNodeHeirarchy(insertInTo, insertAfter, items);
CommandsController::Instance()->ExecuteCommand(cmd);
SafeRelease(cmd);
}
}
示例5: ReturnNodeToScene
void HierarchyTreeController::ReturnNodeToScene(const HierarchyTreeNode::HIERARCHYTREENODESLIST& nodesToReturn)
{
for (HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator iter = nodesToReturn.begin();
iter != nodesToReturn.end(); iter ++)
{
HierarchyTreeNode* nodeToReturn = (*iter);
if (nodeToReturn)
{
nodeToReturn->ReturnTreeNodeToScene();
UnregisterNodeDeletedFromScene(nodeToReturn);
}
}
emit HierarchyTreeUpdated();
ResetSelectedControl();
// Select the first one, if any.
if (nodesToReturn.size() == 0 )
{
return;
}
HierarchyTreeControlNode* controlNode = dynamic_cast<HierarchyTreeControlNode*>(nodesToReturn.front());
if (controlNode)
{
SelectControl(controlNode);
}
}
示例6: GetParent
void HierarchyTreeNode::PrepareRemoveFromSceneInformation()
{
if (!GetParent())
{
this->redoParentNode = NULL;
this->redoPreviousNode = NULL;
return;
}
this->redoParentNode = GetParent();
this->redoPreviousNode = NULL;
HierarchyTreeNode* parentNode = GetParent();
// Look for the Redo Node in the Children List, and remember the previous one.
// This is needed to restore the previous node position in case of Redo.
for (List<HierarchyTreeNode*>::const_iterator iter = parentNode->GetChildNodes().begin();
iter != parentNode->GetChildNodes().end(); iter ++)
{
if ((*iter == this) && (iter != parentNode->GetChildNodes().begin()))
{
iter --;
this->redoPreviousNode = (*iter);
break;
}
}
}
示例7: Execute
void ChangeNodeHeirarchy::Execute()
{
HierarchyTreeNode* targetNode = HierarchyTreeController::Instance()->GetTree().GetNode(targetNodeID);
HierarchyTreeNode* insertAfterNode = HierarchyTreeController::Instance()->GetTree().GetNode(afterNodeID);
if (!targetNode)
{
// Possible in Redo case if some changes in tree were made.
return;
}
for (HierarchyTreeNode::HIERARCHYTREENODESIDLIST::iterator iter = items.begin();
iter != items.end();
++iter)
{
HierarchyTreeNode* node = HierarchyTreeController::Instance()->GetTree().GetNode((*iter));
if (node)
{
if (dynamic_cast<HierarchyTreeScreenNode*>(node))
{
HierarchyTreeNode* sourceNode = node->GetParent();
if (sourceNode != targetNode)
{
HierarchyTreeNode::HIERARCHYTREENODESLIST screens;
screens.push_back(node);
HierarchyTreeController::Instance()->DeleteNodesFiles(screens);
}
}
//YZ backlight parent rect
bool isNodeSelected = false;
HierarchyTreeControlNode* controlNode = dynamic_cast<HierarchyTreeControlNode*>(node);
if (controlNode)
{
isNodeSelected = HierarchyTreeController::Instance()->IsControlSelected(controlNode);
HierarchyTreeController::Instance()->UnselectControl(controlNode);
}
node->SetParent(targetNode, insertAfterNode);
//insertAfterNode = node;
if (isNodeSelected)
{
HierarchyTreeController::Instance()->SelectControl(controlNode);
}
}
}
HierarchyTreeController::Instance()->EmitHierarchyTreeUpdated(false);
HierarchyTreeController::Instance()->ResetSelectedControl();
}
示例8: PrepareRedoInformation
void CreateControlCommand::PrepareRedoInformation()
{
// Clone the current control node, remember the pointer to the previous node in the list
// to restore the position of the node removed in case of Redo.
HierarchyTreeNode* createdNode = HierarchyTreeController::Instance()->GetTree().GetNode(this->createdControlID);
if (!createdNode || !createdNode->GetParent())
{
this->redoNode = NULL;
return;
}
createdNode->PrepareRemoveFromSceneInformation();
this->redoNode = createdNode;
}
示例9: GetTreeNode
void BaseMetadata::SetStateDirtyForProperty(UIControl::eControlState controlState, const QString& propertyName,
bool value)
{
// Perform set for all nodes.
int paramsCount = this->GetParamsCount();
for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++)
{
HierarchyTreeNode* treeNode = GetTreeNode(i);
if (!treeNode)
{
continue;
}
treeNode->GetExtraData().SetStatePropertyDirty(controlState, propertyName, value);
}
}
示例10: DVASSERT
DeleteSelectedNodeCommand::DeleteSelectedNodeCommand(const HierarchyTreeNode::HIERARCHYTREENODESLIST& nodes, bool needDeleteFiles)
{
this->nodes = nodes;
this->deleteFiles = needDeleteFiles;
DVASSERT(nodes.empty() == false);
HierarchyTreeNode* itemNode = nodes.front();
DetectType(itemNode);
if (type == TYPE_AGGREGATOR)
{
StoreParentsOfRemovingAggregatorControls(nodes);
}
parentId = itemNode->GetParent()->GetId();
}
示例11: Rollback
void ChangeNodeHeirarchy::Rollback()
{
for (PARENTNODESMAPITER iter = previousParents.begin(); iter != previousParents.end(); iter ++)
{
HierarchyTreeNode* currentNode = HierarchyTreeController::Instance()->GetTree().GetNode(iter->first);
HierarchyTreeNode* prevParentNode = HierarchyTreeController::Instance()->GetTree().GetNode(iter->second.parent);
HierarchyTreeNode* prevAddedAfter = HierarchyTreeController::Instance()->GetTree().GetNode(iter->second.addedAfter);
if (!currentNode || !prevParentNode)
{
continue;
}
currentNode->SetParent(prevParentNode, prevAddedAfter);
}
HierarchyTreeController::Instance()->EmitHierarchyTreeUpdated();
}
示例12: IsAggregatorOrScreenNamePresent
bool HierarchyTreePlatformNode::IsAggregatorOrScreenNamePresent(const QString& candidatName)
{
for (HIERARCHYTREENODESLIST::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
HierarchyTreeNode* node = (*iter);
HierarchyTreeAggregatorNode* aggregator = dynamic_cast<HierarchyTreeAggregatorNode*>(node);
HierarchyTreeScreenNode* screen = dynamic_cast<HierarchyTreeScreenNode*>(node);
if (NULL == aggregator && NULL == screen)
{
continue;
}
if(node->GetName().compare(candidatName) == 0)
{
return true;
}
}
return false;
}
示例13: IsNameExist
bool HierarchyTreeScreenNode::IsNameExist(const QString &name, const HierarchyTreeNode *parent) const
{
if (!parent)
return false;
const HIERARCHYTREENODESLIST& items = parent->GetChildNodes();
for (HIERARCHYTREENODESLIST::const_iterator iter = items.begin();
iter != items.end();
++iter)
{
HierarchyTreeNode* node = (*iter);
if (node->GetName().compare(name) == 0)
return true;
if (IsNameExist(name, node))
return true;
}
return false;
}
示例14: SetLocalizedTextKey
void UIButtonMetadata::SetLocalizedTextKey(const QString& value)
{
if (!VerifyActiveParamID() || !this->GetActiveTreeNode())
{
return;
}
// Update the control with the value.
WideString localizationValue = LocalizationSystem::Instance()->GetLocalizedString(QStrint2WideString(value));
HierarchyTreeNode* node = this->GetActiveTreeNode();
for(uint32 i = 0; i < GetStatesCount(); ++i)
{
// Update both key and value for all the states requested.
node->GetExtraData().SetLocalizationKey(QStrint2WideString(value), this->uiControlStates[i]);
GetActiveUIButton()->SetStateText(this->uiControlStates[i], localizationValue);
}
UpdatePropertyDirtyFlagForLocalizedText();
}
示例15: StringToWString
// Initialize the control(s) attached.
void UITextFieldMetadata::InitializeControl(const String& controlName, const Vector2& position)
{
UIControlMetadata::InitializeControl(controlName, position);
int paramsCount = this->GetParamsCount();
for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++)
{
UITextField* textField = dynamic_cast<UITextField*>(this->treeNodeParams[i].GetUIControl());
textField->SetFont(EditorFontManager::Instance()->GetDefaultFont());
textField->GetBackground()->SetDrawType(UIControlBackground::DRAW_ALIGNED);
// Initialize both control text and localization key.
WideString controlText = StringToWString(textField->GetName());
HierarchyTreeNode* activeNode = GetTreeNode(i);
textField->SetText(controlText);
activeNode->GetExtraData().SetLocalizationKey(controlText, this->GetReferenceState());
}
}