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"
31 class YQMenuButton : public QWidget, public YMenuButton
39 YQMenuButton( YWidget * parent,
40 const string & label );
45 virtual ~YQMenuButton();
48 * Change the label on the button.
50 * Reimplemented from YMenuButton / YSelectionWidget.
52 virtual void setLabel( const string & label );
55 * Rebuild the displayed menu tree from the internally stored YMenuItems.
57 * Implemented from YMenuButton.
59 virtual void rebuildMenuTree();
62 * Set enabled / disabled state.
64 * Reimplemented from YWidget.
66 virtual void setEnabled( bool enabled );
69 * Preferred width of the widget.
71 * Reimplemented from YWidget.
73 virtual int preferredWidth();
76 * Preferred height of the widget.
78 * Reimplemented from YWidget.
80 virtual int preferredHeight();
83 * Set the new size of the widget.
85 * Reimplemented from YWidget.
87 virtual void setSize( int newWidth, int newHeight );
90 * Accept the keyboard focus.
92 virtual bool setKeyboardFocus();
98 * Triggered when any menu item is activated.
100 void menuEntryActivated( QAction * menuItem );
103 * Triggered via menuEntryActivated() by zero timer to get back in sync
104 * with the Qt event loop.
112 * Recursively insert menu items into 'menu' from iterator 'begin' to iterator 'end'.
114 void rebuildMenuTree( QMenu * menu, YItemIterator begin, YItemIterator end );
121 YMenuItem * _selectedItem;
122 QPushButton * _qt_button;
123 QHash<QAction*,int> _serials;
126 #endif // YQMenuButton_h