本文整理汇总了C++中HierarchyTreeScreenNode类的典型用法代码示例。如果您正苦于以下问题:C++ HierarchyTreeScreenNode类的具体用法?C++ HierarchyTreeScreenNode怎么用?C++ HierarchyTreeScreenNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HierarchyTreeScreenNode类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateHierarchyTree
void HierarchyTreeAggregatorNode::UpdateHierarchyTree()
{
const HierarchyTreeNode::HIERARCHYTREENODESLIST& child = parent->GetChildNodes();
for (HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator iter = child.begin();
iter != child.end();
++iter)
{
HierarchyTreeScreenNode* node = dynamic_cast<HierarchyTreeScreenNode*>(*iter);
DVASSERT(node);
if (!node)
continue;
const HierarchyTreeNode::HIERARCHYTREENODESLIST& child = node->GetChildNodes();
for (HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator iter = child.begin();
iter != child.end();
++iter)
{
HierarchyTreeControlNode* node = dynamic_cast<HierarchyTreeControlNode*>(*iter);
DVASSERT(node);
if (!node)
continue;
ReplaceAggregator(node);
}
}
}
示例2: SetSize
bool HierarchyTreePlatformNode::Load(YamlNode* platform)
{
YamlNode* width = platform->Get(WIDTH_NODE);
YamlNode* height = platform->Get(HEIGHT_NODE);
if (!width || !height)
return false;
bool result = true;
SetSize(width->AsInt(), height->AsInt());
ActivatePlatform();
YamlNode* screens = platform->Get(SCREENS_NODE);
if (screens)
{
for (int i = 0; i < screens->GetCount(); i++)
{
YamlNode* screen = screens->Get(i);
if (!screen)
continue;
String screenName = screen->AsString();
QString screenPath = QString(SCREEN_PATH).arg(GetResourceFolder()).arg(QString::fromStdString(screenName));
HierarchyTreeScreenNode* screenNode = new HierarchyTreeScreenNode(this, QString::fromStdString(screenName));
result &= screenNode->Load(screenPath);
AddTreeNode(screenNode);
}
}
return result;
}
示例3: GetScreenNode
void ScreenMetadata::SetName(const QString& name)
{
HierarchyTreeScreenNode* screenNode = GetScreenNode();
if (screenNode)
{
screenNode->SetName(name);
}
}
示例4: on_treeWidget_itemSelectionChanged
void HierarchyTreeWidget::on_treeWidget_itemSelectionChanged()
{
QTreeWidgetItem* selectedItem = ui->treeWidget->currentItem();
if (!selectedItem)
{
return;
}
if (internalSelectionChanged)
{
return;
}
QVariant data = selectedItem->data(ITEM_ID);
HierarchyTreeNode::HIERARCHYTREENODEID id = data.toInt();
HierarchyTreeNode* baseNode = HierarchyTreeController::Instance()->GetTree().GetNode(id);
HierarchyTreePlatformNode* selectedPlatform = dynamic_cast<HierarchyTreePlatformNode* >(baseNode);
HierarchyTreeScreenNode* selectedScreen = dynamic_cast<HierarchyTreeScreenNode* >(baseNode);
HierarchyTreeControlNode* selectedControl = dynamic_cast<HierarchyTreeControlNode* >(baseNode);
if (!selectedPlatform && !selectedScreen && !selectedControl)
return;
internalSelectionChanged = true;
//only platform or screen node can be seleted
if (selectedPlatform || selectedScreen)
{
ResetSelection();
HierarchyTreeController::Instance()->ResetSelectedControl();
selectedItem->setSelected(true);
}
if (selectedControl)
{
selectedScreen = selectedControl->GetScreenNode();
selectedPlatform = selectedScreen->GetPlatform();
}
else if (selectedScreen)
{
selectedPlatform = selectedScreen->GetPlatform();
}
HierarchyTreeController::Instance()->UpdateSelection(selectedPlatform, selectedScreen);
HierarchyTreeController::Instance()->UpdateSelection(baseNode);
internalSelectionChanged = false;
if (selectedControl)
{
if (ui->treeWidget->selectedItems().size() == 1)
HierarchyTreeController::Instance()->ResetSelectedControl();
HierarchyTreeController::Instance()->SelectControl(selectedControl);
}
}
示例5: AddScreen
HierarchyTreeScreenNode* HierarchyTreeController::AddScreen(const QString& name, HierarchyTreeNode::HIERARCHYTREENODEID platform)
{
HierarchyTreeScreenNode* screenNode = hierarchyTree.AddScreen(name, platform);
if (screenNode)
{
UpdateSelection(screenNode->GetPlatform(), screenNode);
EmitHierarchyTreeUpdated();
}
return screenNode;
}
示例6: StoreParentsOfRemovingAggregatorControls
void DeleteSelectedNodeCommand::StoreParentsOfRemovingAggregatorControls(const HierarchyTreeNode::HIERARCHYTREENODESLIST& nodes)
{
HierarchyTreeNode::HIERARCHYTREENODESCONSTITER it;
for (it = nodes.begin(); it != nodes.end(); ++it)
{
if (!dynamic_cast<HierarchyTreeAggregatorNode*>(*it))
{
HierarchyTreeScreenNode* screen = HierarchyTreeController::Instance()->GetScreenNodeForNode(*it);
if (screen)
{
parentsOfRemovingAggregatorControls.insert(screen->GetId());
}
}
}
}
示例7: SetParent
void HierarchyTreeControlNode::SetParent(HierarchyTreeNode* node, HierarchyTreeNode* insertAfter)
{
if (this == insertAfter)
return;
if (parent)
parent->RemoveTreeNode(this, false, false);
HierarchyTreeControlNode* newParentControl = dynamic_cast<HierarchyTreeControlNode* >(node);
HierarchyTreeScreenNode* newParentScreen = dynamic_cast<HierarchyTreeScreenNode* >(node);
DVASSERT(newParentControl || newParentScreen);
if (!newParentControl && !newParentScreen)
return;
UIControl* afterControl = NULL;
HierarchyTreeControlNode* insertAfterControl = dynamic_cast<HierarchyTreeControlNode* >(insertAfter);
if (insertAfterControl)
afterControl = insertAfterControl->GetUIObject();
UIControl* newParentUI = NULL;
if (newParentControl)
newParentUI = newParentControl->GetUIObject();
else if (newParentScreen)
newParentUI = newParentScreen->GetScreen();
node->AddTreeNode(this, insertAfter);
if (newParentUI && uiObject)
{
if (insertAfter != node)
{
newParentUI->InsertChildAbove(uiObject, afterControl);
}
else
{
UIControl* belowControl = NULL;
const List<UIControl*> & controls = newParentUI->GetChildren();
if (controls.size())
{
belowControl = *controls.begin();
}
newParentUI->InsertChildBelow(uiObject, belowControl);
}
}
parent = node;
}
示例8: YamlNode
bool HierarchyTreePlatformNode::Save(YamlNode* node)
{
YamlNode* platform = new YamlNode(YamlNode::TYPE_MAP);
platform->Set(WIDTH_NODE, GetWidth());
platform->Set(HEIGHT_NODE, GetHeight());
Map<String, YamlNode*> &platformsMap = node->AsMap();
platformsMap[GetName().toStdString()] = platform;
ActivatePlatform();
Map<String, YamlNode*> &platformMap = platform->AsMap();
YamlNode* screens = new YamlNode(YamlNode::TYPE_ARRAY);
platformMap[SCREENS_NODE] = screens;
// Add the Localization info - specific for each Platform.
SaveLocalization(platform);
QString projectFolder = GetResourceFolder();
projectFolder += "UI";
QDir dir;
dir.mkpath(projectFolder);
bool result = true;
for (HIERARCHYTREENODESCONSTITER iter = GetChildNodes().begin();
iter != GetChildNodes().end();
++iter)
{
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(*iter);
if (!screenNode)
continue;
QString screenPath = QString(SCREEN_PATH).arg(GetResourceFolder()).arg(screenNode->GetName());
result &= screenNode->Save(screenPath);
screens->AddValueToArray(screenNode->GetName().toStdString());
}
return result;
}
示例9: DeleteNodesFiles
void HierarchyTreeController::DeleteNodesFiles(const HierarchyTreeNode::HIERARCHYTREENODESLIST &nodes)
{
HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator iter;
for (iter = nodes.begin(); iter != nodes.end(); ++iter)
{
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(*iter);
HierarchyTreePlatformNode* platformNode = dynamic_cast<HierarchyTreePlatformNode*>(*iter);
if (screenNode)
{
screenNode->SetMarked(true);
QString path = screenNode->GetPlatform()->GetScreenPath(screenNode->GetName());
FileSystem::Instance()->DeleteFile(path.toStdString());
}
if (platformNode)
{
platformNode->SetMarked(true);
platformNode->SetChildrenMarked(true);
FileSystem::Instance()->DeleteDirectory(platformNode->GetPlatformFolder(), true);
}
}
}
示例10: DVASSERT
void HierarchyTreeControlNode::AddControlToParent()
{
if (!parent)
return;
DVASSERT(uiObject);
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(parent);
if (screenNode)
{
screenNode->GetScreen()->AddControl(this->uiObject);
}
else
{
//HierarchyTreeControlNode* controlNode = GetControlNode();
HierarchyTreeControlNode* controlNode = dynamic_cast<HierarchyTreeControlNode*>(parent);
if (controlNode)
{
UIControl* control = controlNode->GetUIObject();
if (control)
control->AddControl(this->uiObject);
}
}
}
示例11: YamlNode
bool HierarchyTreePlatformNode::Save(YamlNode* node, bool saveAll)
{
YamlNode* platform = new YamlNode(YamlNode::TYPE_MAP);
platform->Set(WIDTH_NODE, GetWidth());
platform->Set(HEIGHT_NODE, GetHeight());
MultiMap<String, YamlNode*> &platformsMap = node->AsMap();
platformsMap.erase(GetName().toStdString());
platformsMap.insert(std::pair<String, YamlNode*>(GetName().toStdString(), platform));
ActivatePlatform();
MultiMap<String, YamlNode*> &platformMap = platform->AsMap();
YamlNode* screens = new YamlNode(YamlNode::TYPE_ARRAY);
platformMap.erase(SCREENS_NODE);
platformMap.insert(std::pair<String, YamlNode*>(SCREENS_NODE, screens));
YamlNode* aggregators = new YamlNode(YamlNode::TYPE_MAP);
platformMap.erase(AGGREGATORS_NODE);
platformMap.insert(std::pair<String, YamlNode*>(AGGREGATORS_NODE, aggregators));
// Add the Localization info - specific for each Platform.
SaveLocalization(platform);
QString platformFolder = GetPlatformFolder();
QDir dir;
dir.mkpath(platformFolder);
bool result = true;
//save aggregators node before save screens
for (HIERARCHYTREENODESCONSTITER iter = GetChildNodes().begin();
iter != GetChildNodes().end();
++iter)
{
HierarchyTreeAggregatorNode* node = dynamic_cast<HierarchyTreeAggregatorNode*>(*iter);
if (!node)
continue;
QString path = QString(SCREEN_PATH).arg(platformFolder).arg(node->GetName());
MultiMap<String, YamlNode*> &aggregatorsMap = aggregators->AsMap();
YamlNode* aggregator = new YamlNode(YamlNode::TYPE_MAP);
result &= node->Save(aggregator, path, saveAll);
aggregatorsMap.erase(node->GetName().toStdString());
aggregatorsMap.insert(std::pair<String, YamlNode*>(node->GetName().toStdString(), aggregator));
}
for (HIERARCHYTREENODESCONSTITER iter = GetChildNodes().begin();
iter != GetChildNodes().end();
++iter)
{
HierarchyTreeAggregatorNode* node = dynamic_cast<HierarchyTreeAggregatorNode*>(*iter);
if (node)
continue; //skip aggregators
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(*iter);
if (!screenNode)
continue;
QString screenPath = QString(SCREEN_PATH).arg(platformFolder).arg(screenNode->GetName());
result &= screenNode->Save(screenPath, saveAll);
screens->AddValueToArray(screenNode->GetName().toStdString());
}
return result;
}
示例12: SetParent
void HierarchyTreeControlNode::SetParent(HierarchyTreeNode* node, HierarchyTreeNode* insertAfter)
{
if (this == insertAfter)
return;
if (parent)
parent->RemoveTreeNode(this, false, false);
HierarchyTreeControlNode* newParentControl = dynamic_cast<HierarchyTreeControlNode* >(node);
HierarchyTreeScreenNode* newParentScreen = dynamic_cast<HierarchyTreeScreenNode* >(node);
DVASSERT(newParentControl || newParentScreen);
if (!newParentControl && !newParentScreen)
return;
UIControl* afterControl = NULL;
HierarchyTreeControlNode* insertAfterControl = dynamic_cast<HierarchyTreeControlNode* >(insertAfter);
if (insertAfterControl)
afterControl = insertAfterControl->GetUIObject();
UIControl* newParentUI = NULL;
if (newParentControl)
newParentUI = newParentControl->GetUIObject();
else if (newParentScreen)
newParentUI = newParentScreen->GetScreen();
node->AddTreeNode(this, insertAfter);
if (newParentUI && uiObject)
{
Rect controlAbsoluteRect = uiObject->GetRect(true);
Rect parentAbsoluteRect = newParentUI->GetRect(true);
if (insertAfter != node)
{
newParentUI->InsertChildAbove(uiObject, afterControl);
}
else
{
UIControl* belowControl = NULL;
const List<UIControl*> & controls = newParentUI->GetChildren();
if (controls.size())
{
belowControl = *controls.begin();
}
newParentUI->InsertChildBelow(uiObject, belowControl);
}
// Recalculate the relative coords of the moved object to don't change its position.
Vector2 newControlOffset = controlAbsoluteRect.GetPosition() - parentAbsoluteRect.GetPosition();
uiObject->SetRect(Rect(newControlOffset, uiObject->GetRect().GetSize()));
// Fix
// DF-2395 - Recalculate scrollContainer content each time we add controls to it
UIScrollViewContainer *container = dynamic_cast<UIScrollViewContainer*>(newParentUI);
if (container)
{
UIScrollView *scroll = dynamic_cast<UIScrollView*>(container->GetParent());
if (scroll)
{
scroll->RecalculateContentSize();
}
}
}
parent = node;
}