1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQMenuButton_h
21 #define YQMenuButton_h
24 #include "YMenuButton.h"
30 class YQMenuButton : public QWidget, public YMenuButton
38 YQMenuButton( YWidget * parent,
39 const string & label );
44 virtual ~YQMenuButton();
47 * Change the label on the button.
49 * Reimplemented from YMenuButton / YSelectionWidget.
51 virtual void setLabel( const string & label );
54 * Rebuild the displayed menu tree from the internally stored YMenuItems.
56 * Implemented from YMenuButton.
58 virtual void rebuildMenuTree();
61 * Set enabled / disabled state.
63 * Reimplemented from YWidget.
65 virtual void setEnabled( bool enabled );
68 * Preferred width of the widget.
70 * Reimplemented from YWidget.
72 virtual int preferredWidth();
75 * Preferred height of the widget.
77 * Reimplemented from YWidget.
79 virtual int preferredHeight();
82 * Set the new size of the widget.
84 * Reimplemented from YWidget.
86 virtual void setSize( int newWidth, int newHeight );
89 * Accept the keyboard focus.
91 virtual bool setKeyboardFocus();
97 * Triggered when any menu item is activated.
99 void menuEntryActivated( int menuItemIndex );
102 * Triggered via menuEntryActivated() by zero timer to get back in sync
103 * with the Qt event loop.
111 * Recursively insert menu items into 'menu' from iterator 'begin' to iterator 'end'.
113 void rebuildMenuTree( QMenu * menu, YItemIterator begin, YItemIterator end );
120 YMenuItem * _selectedItem;
121 QPushButton * _qt_button;
124 #endif // YQMenuButton_h