HierarchyTreeControlNode::HierarchyTreeControlNode(HierarchyTreeNode* parent, const HierarchyTreeControlNode* node): HierarchyTreeNode(node), listDelegate(NULL) { this->parent = parent; this->uiObject = node->GetUIObject()->Clone(); this->needReleaseUIObjects = false; // All UIList controls should always have a delegate // We set a delegate here to avoid inappropriate loading of saved list UIList *list = dynamic_cast<UIList*>(this->uiObject); UIList *srcList = dynamic_cast<UIList*>(node->GetUIObject()); if (list) { listDelegate = new EditorListDelegate(list->GetRect(), list->GetOrientation()); EditorListDelegate *srcListDelegate = dynamic_cast<EditorListDelegate*>(srcList->GetDelegate()); if (srcListDelegate) { listDelegate->SetAggregatorID(srcListDelegate->GetAggregatorID()); } list->SetDelegate(listDelegate); } // Remove real children & subcontrols - each control is responsible for its // subcontrols by itself. const List<UIControl* > &realChildren = GetUIObject()->GetRealChildren(); for (List<UIControl* >::const_iterator iter = realChildren.begin(); iter != realChildren.end(); ++iter) { GetUIObject()->RemoveControl(*iter); } AddControlToParent(); const HierarchyTreeNode::HIERARCHYTREENODESLIST& child = node->GetChildNodes(); for (HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator iter = child.begin(); iter != child.end(); ++iter) { const HierarchyTreeControlNode* controlNode = dynamic_cast<const HierarchyTreeControlNode*>((*iter)); if (!controlNode) continue; AddTreeNode(controlNode->CreateControlCopy(parent ? this : NULL)); } }
void UIListMetadata::InitializeControl(const String& controlName, const Vector2& position) { BaseMetadata::InitializeControl(controlName, position); int paramsCount = this->GetParamsCount(); for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++) { // Initialize UIList UIList* list = dynamic_cast<UIList*>(this->treeNodeParams[i].GetUIControl()); if (list) { EditorListDelegate *editorList = new EditorListDelegate(list->GetRect(), list->GetOrientation()); list->SetDelegate(editorList); list->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_TO_RECT); } } }
HierarchyTreeControlNode::HierarchyTreeControlNode(HierarchyTreeNode* parent, UIControl* uiObject, const QString& name) : HierarchyTreeNode(name), listDelegate(NULL) { this->parent = parent; this->uiObject = uiObject; this->parentUIObject = NULL; this->needReleaseUIObjects = false; // All UIList controls should always have a delegate // We set a delegate here to avoid inappropriate loading of saved list UIList *list = dynamic_cast<UIList*>(uiObject); if (list) { listDelegate = new EditorListDelegate(list->GetRect(), list->GetOrientation()); list->SetDelegate(listDelegate); } AddControlToParent(); }