Exemple #1
0
int UIListMetadata::GetAggregatorID()
{
    if (!VerifyActiveParamID())
    	return HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;

	EditorListDelegate *editorList = (EditorListDelegate *)GetActiveUIList()->GetDelegate();	
	if (!editorList)
		return HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;

	return editorList->GetAggregatorID();
}
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));
    }
}