57 _parent->addChild(
this );
77 if ( _parent && autoAddChild )
78 _parent->addChild(
this );
104 child = child->
next();
113 const PAYLOAD &
value()
const {
return _value; }
122 void setValue( PAYLOAD newValue ) { _value = newValue; }
153 { _firstChild = newFirstChild; }
246 while ( child->
next() &&
247 child->
next()->value() < newChild->
value() )
249 child = child->
next();
296 template<
class ITEM,
class PAYLOAD>
inline 298 findDirectChild( ITEM * item, PAYLOAD searchVal )
304 if ( child->
value() == searchVal )
305 return dynamic_cast<ITEM *> ( child );
307 child = child->
next();
SortedTreeItem< PAYLOAD > * next() const
Returns this item's next sibling or 0 if there is none.
SortedTreeItem< PAYLOAD > * firstChild() const
Returns this item's first child or 0 if there is none.
void setValue(PAYLOAD newValue)
Set this item's value, the "payload".
Template class for tree items that maintain sort order.
SortedTreeItem< PAYLOAD > * parent() const
Returns this item's parent or 0 if there is none.
void setParent(TreeItem< PAYLOAD > *newParent)
Sets this item's parent.
Template class for tree items that can handle tree children in a generic way - firstChild(), next() and parent().
const PAYLOAD & value() const
Returns this item's value, the "payload".
TreeItem< PAYLOAD > * firstChild() const
Returns this item's first child or 0 if there is none.
TreeItem< PAYLOAD > * next() const
Returns this item's next sibling or 0 if there is none.
void insertChildSorted(SortedTreeItem< PAYLOAD > *newChild)
Insert a child into the internal children list in ascending sort order.
void addChild(TreeItem< PAYLOAD > *newChild)
Add a child to the internal children list - usually called from within the child's default constructo...
void setNext(TreeItem< PAYLOAD > *newNext)
Sets this item's next sibling.
void setFirstChild(TreeItem< PAYLOAD > *newFirstChild)
Sets this item's first child.
TreeItem< PAYLOAD > * parent() const
Returns this item's parent or 0 if there is none.