libyui
Loading...
Searching...
No Matches
YMenuItem Class Reference

#include <YMenuItem.h>

Inheritance diagram for YMenuItem:
Collaboration diagram for YMenuItem:

Public Member Functions

 YMenuItem (const std::string &label, const std::string &iconName="")
 YMenuItem (YMenuItem *parent, const std::string &label, const std::string &iconName="")
virtual ~YMenuItem ()
YMenuItemaddItem (const std::string &label, const std::string &iconName="")
YMenuItemaddMenu (const std::string &label, const std::string &iconName="")
YMenuItemaddSeparator ()
YMenuItemparent () const
bool isMenu () const
bool isSeparator () const
bool isEnabled () const
void setEnabled (bool enabled=true)
bool isVisible () const
void setVisible (bool visible=true)
void * uiItem () const
void setUiItem (void *uiItem)
Public Member Functions inherited from YTreeItem
 YTreeItem (const std::string &label, bool isOpen=false)
 YTreeItem (const std::string &label, const std::string &iconName, bool isOpen=false)
 YTreeItem (YTreeItem *parent, const std::string &label, bool isOpen=false)
 YTreeItem (YTreeItem *parent, const std::string &label, const std::string &iconName, bool isOpen=false)
virtual ~YTreeItem ()
virtual const char * itemClass () const
virtual bool hasChildren () const
virtual YItemIterator childrenBegin ()
virtual YItemConstIterator childrenBegin () const
virtual YItemIterator childrenEnd ()
virtual YItemConstIterator childrenEnd () const
virtual void addChild (YItem *item_disown)
virtual void deleteChildren ()
bool isOpen () const
void setOpen (bool open=true)
void setClosed ()
Public Member Functions inherited from YItem
 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)
int status () const
void setStatus (int newStatus)
void setIndex (int index)
int index () const
void setData (void *newData)
void * data () const
virtual std::string debugLabel () const
std::string limitLength (const std::string &text, int limit) const

Detailed Description

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.

Constructor & Destructor Documentation

◆ YMenuItem() [1/2]

YMenuItem::YMenuItem ( const std::string & label,
const std::string & iconName = "" )
inline

Constructor for toplevel items.

◆ YMenuItem() [2/2]

YMenuItem::YMenuItem ( YMenuItem * parent,
const std::string & label,
const std::string & iconName = "" )
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.

◆ ~YMenuItem()

virtual YMenuItem::~YMenuItem ( )
inlinevirtual

Destructor.

This will delete all children.

Member Function Documentation

◆ addItem()

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.

◆ addMenu()

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.

◆ addSeparator()

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.

◆ isEnabled()

bool YMenuItem::isEnabled ( ) const
inline

Return 'true' if this item is enabled (which is the default).

◆ isMenu()

bool YMenuItem::isMenu ( ) const
inline

Return 'true' if this is a menu (or submenu), i.e. if it has any child items.

◆ isSeparator()

bool YMenuItem::isSeparator ( ) const
inline

Return 'true' if this is a menu separator, i.e. if it has an empty label.

◆ isVisible()

bool YMenuItem::isVisible ( ) const
inline

Return 'true' if this item is visible (which is the default).

◆ parent()

YMenuItem * YMenuItem::parent ( ) const
inlinevirtual

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

Reimplemented from YTreeItem.

◆ setEnabled()

void YMenuItem::setEnabled ( bool enabled = true)
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.

◆ setUiItem()

void YMenuItem::setUiItem ( void * uiItem)
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.

◆ setVisible()

void YMenuItem::setVisible ( bool visible = true)
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.

◆ uiItem()

void * YMenuItem::uiItem ( ) const
inline

Return the UI counterpart of this item (if the UI set any).


The documentation for this class was generated from the following files:
  • /builddir/build/BUILD/libyui-4.6.2-build/libyui-4.6.2/libyui/src/YMenuItem.h
  • /builddir/build/BUILD/libyui-4.6.2-build/libyui-4.6.2/libyui/src/YMenuItem.cc