Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.
More...
#include <YItem.h>
|
|
| 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.
|
| |
|
virtual const char * | itemClass () const |
| | Returns a descriptive name of this widget class for logging, debugging etc.
|
| |
| 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...
|
| |
| int | status () const |
| | Return the status of this item. More...
|
| |
| void | setStatus (int newStatus) |
| | Set the status of 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.
|
| |
|
virtual bool | hasChildren () const |
| | Return 'true' if this item has any child items.
|
| |
| 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 YItem * | parent () const |
| | Return this item's parent item or 0 if it is a toplevel item. More...
|
| |
| virtual std::string | debugLabel () const |
| | Return a descriptive label of this item instance for debugging. More...
|
| |
| std::string | limitLength (const std::string &text, int limit) const |
| | Return a string of maximum 'limit' characters. More...
|
| |
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.
items. This class provides stubs for children management.
See also https://github.com/libyui/libyui-ncurses/blob/master/doc/nctable-and-nctree.md
Definition at line 55 of file YItem.h.
◆ childrenBegin()
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 201 of file YItem.h.
◆ childrenEnd()
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 210 of file YItem.h.
◆ debugLabel()
| string YItem::debugLabel |
( |
| ) |
const |
|
virtual |
Return a descriptive label of this item instance for debugging.
This might be truncated if the original label is too long.
Reimplemented in YTableItem.
Definition at line 44 of file YItem.cc.
◆ label()
| 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.
Definition at line 97 of file YItem.h.
◆ limitLength()
| string YItem::limitLength |
( |
const std::string & |
text, |
|
|
int |
limit |
|
) |
| const |
Return a string of maximum 'limit' characters.
Add an ellipsis ("...") if it was truncated.
Definition at line 51 of file YItem.cc.
◆ parent()
| virtual YItem* YItem::parent |
( |
| ) |
const |
|
inlinevirtual |
Return 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 218 of file YItem.h.
◆ setData()
| 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 163 of file YItem.h.
◆ setSelected()
| 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 129 of file YItem.h.
◆ setStatus()
| void YItem::setStatus |
( |
int |
newStatus | ) |
|
|
inline |
Set the status of this item.
Most widgets only use 0 for "not selected" or nonzero for "selected". Some widgets may make use of other values as well.
Definition at line 143 of file YItem.h.
◆ status()
| int YItem::status |
( |
| ) |
const |
|
inline |
Return the status of this item.
This is a bit more generalized than 'selected'. Values other than 0 or 1 can mean different things to the application or to the specific widget.
Definition at line 136 of file YItem.h.
The documentation for this class was generated from the following files:
- /home/abuild/rpmbuild/BUILD/libyui-3.12.1/src/YItem.h
- /home/abuild/rpmbuild/BUILD/libyui-3.12.1/src/YItem.cc