Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

YMenuButton Class Reference

Implementation of the MenuButton widget. More...

#include <YMenuButton.h>

Inheritance diagram for YMenuButton:

YWidget List of all members.

Public Member Functions

 YMenuButton (const YWidgetOpt &opt, YCPString label)
virtual char * widgetClass ()
YCPValue changeWidget (const YCPSymbol &property, const YCPValue &newvalue)
YCPValue queryWidget (const YCPSymbol &property)
virtual void setLabel (const YCPString &label)
YCPString getLabel ()
YMenugetToplevelMenu ()
void addMenuItem (const YCPString &item_label, const YCPValue &item_id, YMenu *parent_menu=0)
YMenuaddSubMenu (const YCPString &sub_menu_label, YMenu *parent_menu=0)
YCPValue indexToId (int index)
virtual void createMenu ()=0
const char * shortcutProperty ()

Protected Attributes

YCPString label
int next_index
YMenuItemList items
YMenutoplevel_menu

Detailed Description

Implementation of the MenuButton widget.

MenuButton

This is a widget that looks very much like a PushButton, but unlike a PushButton it doesn't immediately start some action but opens a popup menu from where the user can select an item that starts an action. Any item may in turn open a submenu etc.

UserInput() returns the ID of a menu item if one was activated. It will never return the ID of the MenuButton itself.

Style guide hint: Don't overuse this widget. Use it for dialogs that provide lots of actions. Make the most frequently used actions accessible via normal PushButtons. Move less frequently used actions ( e.g. "expert" actions ) into one or more MenuButtons. Don't nest the popup menus too deep - the deeper the nesting, the more awkward the user interface will be.

You can ( and should ) provide keybord shortcuts along with the button label as well as for any menu item.


Constructor & Destructor Documentation

YMenuButton::YMenuButton const YWidgetOpt opt,
YCPString  label
 

Constructor

Parameters:
opt widget options
label the button label


Member Function Documentation

void YMenuButton::addMenuItem const YCPString item_label,
const YCPValue item_id,
YMenu parent_menu = 0
 

Add one menu item.

Pass 0 for 'parent_menu' to add this item to the MenuButton's toplevel menu.

YMenu * YMenuButton::addSubMenu const YCPString sub_menu_label,
YMenu parent_menu = 0
 

Add a submenu.

Pass 0 for 'parent_menu' to add this submenu to the MenuButton's toplevel menu.

YCPValue YMenuButton::changeWidget const YCPSymbol property,
const YCPValue newvalue
[virtual]
 

Implements the ui command changeWidget for the widget specific properties.

string Label the text on the MenuButton

Reimplemented from YWidget.

virtual void YMenuButton::createMenu  )  [pure virtual]
 

Actually create the menu hierarchy in the specific UI. This is called when the complete menu hierarchy is known.

Overwrite this method.

YCPString YMenuButton::getLabel  ) 
 

Get the current label of the MenuButton entry. This method cannot be overidden. The value of the label cannot be changed other than by calling setLabel, i.e. not by the ui. Therefore setLabel stores the current label in label.

YMenu* YMenuButton::getToplevelMenu  )  [inline]
 

Get the MenuButton's toplevel menu.

YCPValue YMenuButton::indexToId int  index  ) 
 

Retrieve the corresponding application ID to an internal menu item index.

YCPValue YMenuButton::queryWidget const YCPSymbol property  )  [virtual]
 

Implements the ui command changeWidget for the widget specific properties.

Reimplemented from YWidget.

void YMenuButton::setLabel const YCPString label  )  [virtual]
 

change the label of the push button. Overload this, but call YMenuButton::setLabel at the end of your own function.

const char* YMenuButton::shortcutProperty  )  [inline, virtual]
 

The name of the widget property that holds the keyboard shortcut. Inherited from YWidget.

Reimplemented from YWidget.

virtual char* YMenuButton::widgetClass  )  [inline, virtual]
 

Returns a descriptive name of this widget class for logging, debugging etc.

Reimplemented from YWidget.


Member Data Documentation

YMenuItemList YMenuButton::items [protected]
 

List of all items somewhere in the menu hierarchy.

YCPString YMenuButton::label [protected]
 

The button label

int YMenuButton::next_index [protected]
 

The next ( free ) item ID to use

YMenu* YMenuButton::toplevel_menu [protected]
 

The top level menu


The documentation for this class was generated from the following files:
Generated on Fri Nov 9 18:15:25 2007 for yast2-core by doxygen 1.3.6