libyui  3.0.10
YItem Class Reference

#include <YItem.h>

Inheritance diagram for YItem:

List of all members.

Public Member Functions

 YItem (const std::string &label, bool selected=false)
 YItem (const std::string &label, const std::string &iconName, bool selected=false)
virtual ~YItem ()
std::string label () const
void setLabel (const std::string &newLabel)
std::string iconName () const
bool hasIconName () const
void setIconName (const std::string &newIconName)
bool selected () const
void setSelected (bool sel=true)
void setIndex (int index)
int index () const
void setData (void *newData)
void * data () const
virtual bool hasChildren () const
virtual YItemIterator childrenBegin ()
virtual YItemConstIterator childrenBegin () const
virtual YItemIterator childrenEnd ()
virtual YItemConstIterator childrenEnd () const
virtual YItemparent () const

Detailed Description

Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc. items. This class provides stubs for children management.

Definition at line 43 of file YItem.h.


Constructor & Destructor Documentation

YItem::YItem ( const std::string &  label,
bool  selected = false 
) [inline]

Constructor with just the label and optionally the selected state.

Definition at line 49 of file YItem.h.

YItem::YItem ( const std::string &  label,
const std::string &  iconName,
bool  selected = false 
) [inline]

Constructor with label and icon name and optionally the selected state.

Definition at line 59 of file YItem.h.

virtual YItem::~YItem ( ) [inline, virtual]

Destructor.

Definition at line 70 of file YItem.h.


Member Function Documentation

virtual YItemIterator YItem::childrenBegin ( ) [inline, virtual]

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

This default implementation returns the 'end' iterator of the class-static always empty _noChildren YItemCollection. It is safe to use this iterator in classic iterator loops:

for ( YItemIterator it = myItem->childrenBegin(); it != myItem->childrenEnd(); ++it ) { ... }

The loop body will only ever be executed if this item is a derived class that actually manages child items.

Reimplemented in YTreeItem.

Definition at line 166 of file YItem.h.

virtual YItemIterator YItem::childrenEnd ( ) [inline, virtual]

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

This default implementation returns the 'end' iterator of the class-static always empty _noChildren YItemCollection.

Reimplemented in YTreeItem.

Definition at line 175 of file YItem.h.

void* YItem::data ( ) const [inline]

Return the opaque data pointer.

Definition at line 133 of file YItem.h.

virtual bool YItem::hasChildren ( ) const [inline, virtual]

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

Reimplemented in YTreeItem.

Definition at line 147 of file YItem.h.

bool YItem::hasIconName ( ) const [inline]

Return 'true' if this item has an icon name.

Definition at line 91 of file YItem.h.

std::string YItem::iconName ( ) const [inline]

Return this item's icon name.

Definition at line 86 of file YItem.h.

int YItem::index ( ) const [inline]

Return the index of this item (as set with setIndex() ).

Definition at line 118 of file YItem.h.

std::string YItem::label ( ) const [inline]

Return this item's label. This is what the user sees in a dialog, so this will usually be a translated text.

Reimplemented in YTableItem.

Definition at line 76 of file YItem.h.

virtual YItem* YItem::parent ( ) const [inline, virtual]

Returns this item's parent item or 0 if it is a toplevel item. This default implementation always returns 0. Derived classes that handle children should reimplement this.

Reimplemented in YTreeItem, and YMenuItem.

Definition at line 183 of file YItem.h.

bool YItem::selected ( ) const [inline]

Return 'true' if this item is currently selected.

Definition at line 101 of file YItem.h.

void YItem::setData ( void *  newData) [inline]

Set the opaque data pointer for application use.

Applications can use this to store the pointer to a counterpart of this tree item. It is the application's responsibility to watch for dangling pointers and possibliy deleting the data. All this class ever does with this pointer is to store it.

Definition at line 128 of file YItem.h.

void YItem::setIconName ( const std::string &  newIconName) [inline]

Set this item's icon name.

Definition at line 96 of file YItem.h.

void YItem::setIndex ( int  index) [inline]

Set this item's index.

Definition at line 113 of file YItem.h.

Here is the call graph for this function:

void YItem::setLabel ( const std::string &  newLabel) [inline]

Set this item's label.

Definition at line 81 of file YItem.h.

void YItem::setSelected ( bool  sel = true) [inline]

Select or unselect this item. This does not have any effect on any other item; if it is desired that only one item is selected at any time, the caller has to take care of that.

Definition at line 108 of file YItem.h.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Friends