libyui  3.4.2
YTreeItem Class Reference

Item class for tree items. More...

#include <YTreeItem.h>

Inheritance diagram for YTreeItem:
YItem YMenuItem YWidgetTreeItem

Public Member Functions

 YTreeItem (const std::string &label, bool isOpen=false)
 Constructors for toplevel items.
 
 YTreeItem (const std::string &label, const std::string &iconName, bool isOpen=false)
 
 YTreeItem (YTreeItem *parent, const std::string &label, bool isOpen=false)
 Constructors for items that have a parent item. More...
 
 YTreeItem (YTreeItem *parent, const std::string &label, const std::string &iconName, bool isOpen=false)
 
virtual ~YTreeItem ()
 Destructor. More...
 
virtual bool hasChildren () const
 Return 'true' if this item has any child items. More...
 
virtual YItemIterator childrenBegin ()
 Return an iterator that points to the first child item of this item. More...
 
virtual YItemConstIterator childrenBegin () const
 
virtual YItemIterator childrenEnd ()
 Return an iterator that points after the last child item of this item. More...
 
virtual YItemConstIterator childrenEnd () const
 
virtual void addChild (YItem *item_disown)
 Add a child item to this item. More...
 
virtual void deleteChildren ()
 Delete all child items.
 
bool isOpen () const
 Return 'true' if this tree item should be displayed open (with its children visible) by default. More...
 
void setOpen (bool open)
 Change the 'isOpen' flag.
 
virtual YTreeItemparent () const
 Returns this item's parent item or 0 if it is a toplevel item. More...
 
- Public Member Functions inherited from YItem
 YItem (const std::string &label, bool selected=false)
 Constructor with just the label and optionally the selected state.
 
 YItem (const std::string &label, const std::string &iconName, bool selected=false)
 Constructor with label and icon name and optionally the selected state.
 
virtual ~YItem ()
 Destructor.
 
std::string label () const
 Return this item's label. More...
 
void setLabel (const std::string &newLabel)
 Set this item's label.
 
std::string iconName () const
 Return this item's icon name.
 
bool hasIconName () const
 Return 'true' if this item has an icon name.
 
void setIconName (const std::string &newIconName)
 Set this item's icon name.
 
bool selected () const
 Return 'true' if this item is currently selected.
 
void setSelected (bool sel=true)
 Select or unselect this item. More...
 
void setIndex (int index)
 Set this item's index.
 
int index () const
 Return the index of this item (as set with setIndex() ).
 
void setData (void *newData)
 Set the opaque data pointer for application use. More...
 
void * data () const
 Return the opaque data pointer.
 

Detailed Description

Item class for tree items.

This class implements children management.

Definition at line 37 of file YTreeItem.h.

Constructor & Destructor Documentation

◆ YTreeItem()

YTreeItem::YTreeItem ( YTreeItem parent,
const std::string &  label,
bool  isOpen = false 
)

Constructors for items that have a parent item.

They will automatically register this item with the parent item. The parent assumes ownership of this item and will delete it in its (the parent's) destructor.

Definition at line 47 of file YTreeItem.cc.

◆ ~YTreeItem()

YTreeItem::~YTreeItem ( )
virtual

Destructor.

This will delete all children.

Definition at line 72 of file YTreeItem.cc.

Member Function Documentation

◆ addChild()

void YTreeItem::addChild ( YItem item_disown)
virtual

Add a child item to this item.

Note that the constructors that accept a parent pointer will automatically add themselves to their parent, so applications will normally not have to call this function.

Definition at line 78 of file YTreeItem.cc.

◆ childrenBegin()

virtual YItemIterator YTreeItem::childrenBegin ( )
inlinevirtual

Return an iterator that points to the first child item of this item.

Reimplemented from YItem.

Reimplemented from YItem.

Definition at line 85 of file YTreeItem.h.

◆ childrenEnd()

virtual YItemIterator YTreeItem::childrenEnd ( )
inlinevirtual

Return an iterator that points after the last child item of this item.

Reimplemented from YItem.

Reimplemented from YItem.

Definition at line 93 of file YTreeItem.h.

◆ hasChildren()

virtual bool YTreeItem::hasChildren ( ) const
inlinevirtual

Return 'true' if this item has any child items.

Reimplemented from YItem.

Reimplemented from YItem.

Definition at line 78 of file YTreeItem.h.

◆ isOpen()

bool YTreeItem::isOpen ( ) const

Return 'true' if this tree item should be displayed open (with its children visible) by default.

Notice that this will always return 'false' for tree items without children.

Definition at line 99 of file YTreeItem.cc.

◆ parent()

virtual YTreeItem* YTreeItem::parent ( ) const
inlinevirtual

Returns this item's parent item or 0 if it is a toplevel item.

Reimplemented from YItem.

Reimplemented from YItem.

Reimplemented in YMenuItem.

Definition at line 129 of file YTreeItem.h.


The documentation for this class was generated from the following files: