libyui
|
#include <YItem.h>
Public Member Functions | |
YItem (const string &label, bool selected=false) | |
YItem (const string &label, const string &iconName, bool selected=false) | |
virtual | ~YItem () |
string | label () const |
void | setLabel (const string &newLabel) |
string | iconName () const |
bool | hasIconName () const |
void | setIconName (const 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 YItem * | parent () const |
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc. items. This class provides stubs for children management.
YItem::YItem | ( | const string & | label, |
bool | selected = false |
||
) | [inline] |
Constructor with just the label and optionally the selected state.
YItem::YItem | ( | const string & | label, |
const string & | iconName, | ||
bool | selected = false |
||
) | [inline] |
Constructor with label and icon name and optionally the selected state.
virtual YItem::~YItem | ( | ) | [inline, virtual] |
Destructor.
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.
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.
void* YItem::data | ( | ) | const [inline] |
Return the opaque data pointer.
virtual bool YItem::hasChildren | ( | ) | const [inline, virtual] |
Return 'true' if this item has any child items.
Reimplemented in YTreeItem.
bool YItem::hasIconName | ( | ) | const [inline] |
Return 'true' if this item has an icon name.
string YItem::iconName | ( | ) | const [inline] |
Return this item's icon name.
int YItem::index | ( | ) | const [inline] |
Return the index of this item (as set with setIndex() ).
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.
virtual YItem* YItem::parent | ( | ) | const [inline, virtual] |
bool YItem::selected | ( | ) | const [inline] |
Return 'true' if this item is currently selected.
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.
void YItem::setIconName | ( | const string & | newIconName | ) | [inline] |
Set this item's icon name.
void YItem::setIndex | ( | int | index | ) | [inline] |
Set this item's index.
void YItem::setLabel | ( | const string & | newLabel | ) | [inline] |
Set this item's label.
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.