|
libyui
3.12.1
|
Item class for menu items. More...
#include <YMenuItem.h>


Public Member Functions | |
| YMenuItem (const std::string &label, const std::string &iconName="") | |
| Constructor for toplevel items. | |
| YMenuItem (YMenuItem *parent, const std::string &label, const std::string &iconName="") | |
| Constructors for items that have a parent item. More... | |
| virtual | ~YMenuItem () |
| Destructor. More... | |
| YMenuItem * | addItem (const std::string &label, const std::string &iconName="") |
| Create a new menu item as a child of the current instance and return it. More... | |
| YMenuItem * | addMenu (const std::string &label, const std::string &iconName="") |
| Create a new submenu as a child of the current instance and return it. More... | |
| YMenuItem * | addSeparator () |
| Create a menu separator as a child of the current instance and return it. More... | |
| YMenuItem * | parent () const |
| Returns this item's parent item or 0 if it is a toplevel item. | |
| bool | isMenu () const |
| Return 'true' if this is a menu (or submenu), i.e. More... | |
| bool | isSeparator () const |
| Return 'true' if this is a menu separator, i.e. More... | |
| bool | isEnabled () const |
| Return 'true' if this item is enabled (which is the default). | |
| void | setEnabled (bool enabled=true) |
| Enable or disable this item. More... | |
| bool | isVisible () const |
| Return 'true' if this item is visible (which is the default). | |
| void | setVisible (bool visible=true) |
| Show or hide this item. More... | |
| void * | uiItem () const |
| Return the UI counterpart of this item (if the UI set any). | |
| void | setUiItem (void *uiItem) |
| Set the UI counterpart of this item. More... | |
Public Member Functions inherited from YTreeItem | |
| 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 const char * | itemClass () const |
| Returns a descriptive name of this widget class for logging, debugging etc. | |
| 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=true) |
| Change the 'isOpen' flag. | |
| void | setClosed () |
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... | |
| 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 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... | |
Item class for menu items.
This is used for plain menu items as well as for menus as well as for menu separators:
A menu is a menu item with child items. A plain menu item does not have child items. A menu separator has an empty label.
Definition at line 43 of file YMenuItem.h.
|
inline |
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.
Consider using addItem() or addMenu() instead.
Definition at line 66 of file YMenuItem.h.
|
inlinevirtual |
| YMenuItem * YMenuItem::addItem | ( | const std::string & | label, |
| const std::string & | iconName = "" |
||
| ) |
Create a new menu item as a child of the current instance and return it.
The newly created object is owned by this instance. This is meant for plain menu items, not for submenus.
Definition at line 29 of file YMenuItem.cc.

| YMenuItem * YMenuItem::addMenu | ( | const std::string & | label, |
| const std::string & | iconName = "" |
||
| ) |
Create a new submenu as a child of the current instance and return it.
The newly created object is owned by this instance. This is meant to be used for menu items that have children.
Definition at line 36 of file YMenuItem.cc.

| YMenuItem * YMenuItem::addSeparator | ( | ) |
Create a menu separator as a child of the current instance and return it.
The newly created object is owned by this instance.
Definition at line 43 of file YMenuItem.cc.

|
inline |
Return 'true' if this is a menu (or submenu), i.e.
if it has any child items.
Definition at line 115 of file YMenuItem.h.

|
inline |
Return 'true' if this is a menu separator, i.e.
if it has an empty label.
Definition at line 120 of file YMenuItem.h.

|
inline |
Enable or disable this item.
Applications should use YMenuWidget::setItemEnabled() instead because that will also notify the widget so it can update the item's visual representation.
Definition at line 134 of file YMenuItem.h.
|
inline |
Set the UI counterpart of this item.
This can be used to store a pointer to the equivalent of this item in the concrete UI: For example, the Qt UI will store a pointer to the corresponding QMenu or QAction.
Definition at line 160 of file YMenuItem.h.

|
inline |
Show or hide this item.
Applications should use YMenuWidget::setItemVisible() instead because that will also notify the widget so it can update the item's visual representation.
Definition at line 148 of file YMenuItem.h.