Esempio n. 1
0
void UIListMetadata::UpdateListCellSize(const Rect& rect, UIList::eListOrientation orientation)
{
	// Get delegate for current list
	EditorListDelegate *editorList = (EditorListDelegate *)GetActiveUIList()->GetDelegate();	
	if (!editorList)
		return;

	float32 width = 0;
	float32 height = 0;		
	// Calculate cell width and cell height
	if (orientation == UIList::ORIENTATION_VERTICAL)
	{
		width = rect.dx;
		height = rect.dy / editorList->ElementsCount(GetActiveUIList());
	}
	else
	{
		width = rect.dx / editorList->ElementsCount(GetActiveUIList());;
		height = rect.dy;
	}

	// Update cell size with new height and width
	editorList->SetCellSize(Vector2(width, height));
	// Refresh list - and recreate cells
	GetActiveUIList()->Refresh();
}
Esempio n. 2
0
int UIListMetadata::GetAggregatorID()
{
    if (!VerifyActiveParamID())
    	return HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;

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

	return editorList->GetAggregatorID();
}
Esempio n. 3
0
void UIListMetadata::SetAggregatorID(int value)
{
	if (!VerifyActiveParamID())
    	return;

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

	editorList->SetAggregatorID(value);
	GetActiveUIList()->Refresh();
}
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));
    }
}