libyui-qt
YQMenuBar.h
1 /*
2  Copyright (C) 2020 SUSE LLC
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YQMenuBar.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQMenuBar_h
27 #define YQMenuBar_h
28 
29 #include <QMenuBar>
30 #include <yui/YMenuBar.h>
31 #include <QHash>
32 
33 class QAction;
34 class QPushButton;
35 class QMenu;
36 
37 class YQMenuBar : public QMenuBar, public YMenuBar
38 {
39  Q_OBJECT
40 
41 public:
45  YQMenuBar( YWidget * parent );
46 
50  virtual ~YQMenuBar();
51 
57  virtual void rebuildMenuTree();
58 
64  virtual void setEnabled( bool enabled );
65 
71  virtual int preferredWidth();
72 
78  virtual int preferredHeight();
79 
85  virtual void setSize( int newWidth, int newHeight );
86 
90  virtual bool setKeyboardFocus();
91 
97  virtual void setItemEnabled( YMenuItem * item, bool enabled );
98 
104  virtual void setItemVisible( YMenuItem * item, bool visible );
105 
110  virtual void activateItem( YMenuItem * item );
111 
117  virtual void shortcutChanged();
118 
119 protected slots:
120 
124  void menuEntryActivated( QAction * menuItem );
125 
130  void returnNow();
131 
132 
133 protected:
134 
139  void rebuildMenuTree( QMenu * menu,
140  YItemIterator begin,
141  YItemIterator end );
142 
143 
144  //
145  // Data members
146  //
147 
148  YMenuItem * _selectedItem;
149  QMap<QAction *,YMenuItem *> _actionMap;
150 };
151 
152 #endif // YQMenuBar_h
virtual void setItemVisible(YMenuItem *item, bool visible)
Definition: YQMenuBar.cc:211
virtual int preferredWidth()
Definition: YQMenuBar.cc:241
virtual void shortcutChanged()
Definition: YQMenuBar.cc:278
virtual ~YQMenuBar()
Definition: YQMenuBar.cc:50
virtual void setEnabled(bool enabled)
Definition: YQMenuBar.cc:235
void menuEntryActivated(QAction *menuItem)
Definition: YQMenuBar.cc:146
virtual bool setKeyboardFocus()
Definition: YQMenuBar.cc:261
virtual void setSize(int newWidth, int newHeight)
Definition: YQMenuBar.cc:254
virtual void activateItem(YMenuItem *item)
Definition: YQMenuBar.cc:270
virtual void setItemEnabled(YMenuItem *item, bool enabled)
Definition: YQMenuBar.cc:187
virtual int preferredHeight()
Definition: YQMenuBar.cc:247
void returnNow()
Definition: YQMenuBar.cc:176
Definition: YQMenuBar.h:37
YQMenuBar(YWidget *parent)
Definition: YQMenuBar.cc:41
virtual void rebuildMenuTree()
Definition: YQMenuBar.cc:57