YMenuButton Class Reference
Implementation of the MenuButton widget.
More...
#include <YMenuButton.h>
Inheritance diagram for YMenuButton:
List of all members.
Detailed Description
Implementation of the MenuButton widget.
MenuButton
- string label
- itemList menu items `MenuButton( "button label", [ `item( `id( `doit ), "& Do it" ), `item( `id( `something ), "& Something" ) ] ); MenuButton1.ycp MenuButton2.ycp
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
|
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. |
|
Add a submenu.
Pass 0 for 'parent_menu' to add this submenu to the MenuButton's toplevel menu. |
|
Implements the ui command changeWidget for the widget specific properties.
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. |
|
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. |
|
Implements the ui command changeWidget for the widget specific properties.
Reimplemented from YWidget. |
void YMenuButton::resolveShortcutConflicts |
( |
|
) |
|
|
|
Resolve keyboard shortcut conflicts: Change shortcuts of menu items if there are duplicates in the respective menu level.
This has to be called after all items are added, but before createMenu() (see below). |
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
|
List of all items somewhere in the menu hierarchy. |
|
The next ( free ) item ID to use |
The documentation for this class was generated from the following files:
Generated on Fri Jun 16 18:07:47 2006 for yast2-core by
1.4.6