HandleAddedToContainer() public method

public HandleAddedToContainer ( FContainer, container ) : void
container FContainer,
return void
Esempio n. 1
0
    public void AddChild(FNode node)
    {
        int nodeIndex = node.index;

        if (nodeIndex == -1)        //add it if it's not a child
        {
            node.HandleAddedToContainer(this);
            _childNodes.Add(node);

            if (_isOnStage)
            {
                node.stage = _stage;
                node.HandleAddedToStage();
            }
        }
        else if (nodeIndex != _childNodes.Count - 1)      //if node is already a child, put it at the top of the children if it's not already
        {
            _childNodes.RemoveAt(nodeIndex);
            HandleChildIndex(nodeIndex);

            node.HandleAddedToContainer(this);
            _childNodes.Add(node);
            if (_isOnStage)
            {
                _stage.HandleFacetsChanged();
            }
        }
    }
Esempio n. 2
0
    public void AddChildAtIndex(FNode node, int newIndex)
    {
        int nodeIndex = _childNodes.IndexOf(node);

        if (newIndex > _childNodes.Count)        //if it's past the end, make it at the end
        {
            newIndex = _childNodes.Count;
        }

        if (nodeIndex == newIndex)
        {
            return;                 //if it's already at the right index, just leave it there
        }
        if (nodeIndex == -1)        //add it if it's not a child
        {
            node.HandleAddedToContainer(this);

            _childNodes.Insert(newIndex, node);

            if (_isOnStage)
            {
                node.stage = _stage;
                node.HandleAddedToStage();
            }
        }
        else         //if node is already a child, move it to the desired index
        {
            _childNodes.RemoveAt(nodeIndex);

            if (nodeIndex < newIndex)
            {
                _childNodes.Insert(newIndex - 1, node);               //gotta subtract 1 to account for it moving in the order
            }
            else
            {
                _childNodes.Insert(newIndex, node);
            }

            if (_isOnStage)
            {
                _stage.HandleFacetsChanged();
            }
        }
    }
Esempio n. 3
0
    public void AddChild(FNode node)
    {
        int nodeIndex = _childNodes.IndexOf(node);

        if(nodeIndex == -1) //add it if it's not a child
        {
            node.HandleAddedToContainer(this);
            _childNodes.Add(node);

            if(_isOnStage)
            {
                node.HandleAddedToStage();
            }
        }
        else if(nodeIndex != _childNodes.Count-1) //if node is already a child, put it at the top of the children if it's not already
        {
            _childNodes.RemoveAt(nodeIndex);
            _childNodes.Add(node);
            if(_isOnStage) _stage.HandleQuadsChanged();
        }
    }
Esempio n. 4
0
    public void AddChildAtIndex(FNode node, int newIndex)
    {
        int nodeIndex = _childNodes.IndexOf(node);

        if(newIndex > _childNodes.Count) //if it's past the end, make it at the end
        {
            newIndex = _childNodes.Count;
        }

        if(nodeIndex == newIndex) return; //if it's already at the right index, just leave it there

        if(nodeIndex == -1) //add it if it's not a child
        {
            node.HandleAddedToContainer(this);

            _childNodes.Insert(newIndex, node);

            if(_isOnStage)
            {
                node.HandleAddedToStage();
            }
        }
        else //if node is already a child, move it to the desired index
        {
            _childNodes.RemoveAt(nodeIndex);

            if(nodeIndex < newIndex)
            {
                _childNodes.Insert(newIndex-1, node); //gotta subtract 1 to account for it moving in the order
            }
            else
            {
                _childNodes.Insert(newIndex, node);
            }

            if(_isOnStage) _stage.HandleQuadsChanged();
        }
    }