Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

void Inkscape::XML::SimpleNode::setPosition ( int  pos  )  [virtual, inherited]

Set the position of this node in parent's child order.

To move the node to the end of the parent's child order, pass a negative argument.

Parameters:
pos The new position in parent's child order

Implements Inkscape::XML::Node.

Definition at line 486 of file simple-node.cpp.

References Inkscape::XML::SimpleNode::_first_child, Inkscape::XML::SimpleNode::_next, and Inkscape::XML::SimpleNode::changeOrder().

                                    {
    g_return_if_fail(_parent != NULL);

    // a position beyond the end of the list means the end of the list;
    // a negative position is the same as an infinitely large position

    SimpleNode *ref=NULL;
    for ( SimpleNode *sibling = _parent->_first_child ;
          sibling && pos ; sibling = sibling->_next )
    {
        if ( sibling != this ) {
            ref = sibling;
            pos--;
        }
    }

    _parent->changeOrder(this, ref);
}


Generated by  Doxygen 1.6.0   Back to index