#include <YMenuButton.h>
Inheritance diagram for YMenuButton:
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 () |
YMenu * | getToplevelMenu () |
void | addMenuItem (const YCPString &item_label, const YCPValue &item_id, YMenu *parent_menu=0) |
YMenu * | addSubMenu (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 |
YMenu * | toplevel_menu |
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
|
|
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. string Label the text on the MenuButton Reimplemented from YWidget. |
|
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. |
|
Get the MenuButton's toplevel menu. |
|
Retrieve the corresponding application ID to an internal menu item index. |
|
Implements the ui command changeWidget for the widget specific properties. Reimplemented from YWidget. |
|
change the label of the push button. Overload this, but call YMenuButton::setLabel at the end of your own function. |
|
The name of the widget property that holds the keyboard shortcut. Inherited from YWidget. Reimplemented from YWidget. |
|
Returns a descriptive name of this widget class for logging, debugging etc. Reimplemented from YWidget. |
|
List of all items somewhere in the menu hierarchy. |
|
The button label |
|
The next ( free ) item ID to use |
|
The top level menu |