libyui-mga-qt  1.1.0
YMGAQMenuBar.h
1 /*
2  Copyright 2020 by Angelo Naselli <anaselli at linux dot it>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as
6  published by the Free Software Foundation; either version 2.1 of the
7  License, or (at your option) version 3.0 of the License. This library
8  is distributed in the hope that it will be useful, but WITHOUT ANY
9  WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11  License for more details. You should have received a copy of the GNU
12  Lesser General Public License along with this library; if not, write
13  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14  Floor, Boston, MA 02110-1301 USA
15 */
16 
17 
18 /*-/
19 
20  File: YMGAQMenuBar.h
21 
22  Author: Angelo Naselli <anaselli@linux.it>
23 
24 /-*/
25 
26 
27 #ifndef YMGAQMenuBar_h
28 #define YMGAQMenuBar_h
29 #include <QWidget>
30 #include <QMenu>
31 
32 #include <yui/mga/YMGAMenuBar.h>
33 
34 
35 class YMGAQMenuBar : public QWidget, public YMGAMenuBar
36 {
37  Q_OBJECT
38 
39 public:
40 
41  /**
42  * Constructor.
43  **/
44  YMGAQMenuBar( YWidget * parent );
45 
46  /**
47  * Destructor.
48  **/
49  virtual ~YMGAQMenuBar();
50 
51  /**
52  * Add an YMenuItem first item represents the menu name, other sub items menu entries
53  *
54  * Reimplemented from YSelectionWidget.
55  **/
56  virtual void addItem( YItem * item );
57 
58  /**
59  * Preferred width of the widget.
60  *
61  * Reimplemented from YWidget.
62  **/
63  virtual int preferredWidth();
64 
65  /**
66  * Preferred height of the widget.
67  *
68  * Reimplemented from YWidget.
69  **/
70  virtual int preferredHeight();
71 
72  /**
73  * Set the new size of the widget.
74  *
75  * Reimplemented from YWidget.
76  **/
77  virtual void setSize( int newWidth, int newHeight );
78 
79  /**
80  * Enable YMGAMenuItem (menu name or menu entry) to enable/disable it into menubar or menu
81  *
82  * Reimplemented from YMGAMenuBar.
83  **/
84  virtual void enableItem(YItem * menu_item, bool enable=true);
85 
86  /**
87  * Hide YMGAMenuItem (menu name or menu entry) to hide/show it into menubar or menu
88  *
89  * Reimplemented from YMGAMenuBar.
90  **/
91  virtual void hideItem(YItem * menu_item, bool invisible=true);
92 
93  /**
94  * Delete all items.
95  *
96  * Reimplemented from YSelectionWidget
97  **/
98  virtual void deleteAllItems();
99 
100 
101 protected:
102 
103  /**
104  * Add a submenu
105  *
106  **/
107  virtual void addSubMenu( QMenu * menu, YItem * item );
108 
109  /**
110  * Add an action (a menu entry without submenus)
111  *
112  **/
113  virtual void addAction( QMenu * menu, YItem * item );
114 
115 private:
116  struct Private;
117  Private *d;
118 
119 };
120 
121 #endif //YMGAQMenuBar_h
virtual int preferredWidth()
Preferred width of the widget.
YMGAQMenuBar(YWidget *parent)
Constructor.
Definition: YMGAQMenuBar.cc:76
virtual void hideItem(YItem *menu_item, bool invisible=true)
Hide YMGAMenuItem (menu name or menu entry) to hide/show it into menubar or menu.
virtual void addSubMenu(QMenu *menu, YItem *item)
Add a submenu.
virtual void addAction(QMenu *menu, YItem *item)
Add an action (a menu entry without submenus)
virtual void deleteAllItems()
Delete all items.
virtual void enableItem(YItem *menu_item, bool enable=true)
Enable YMGAMenuItem (menu name or menu entry) to enable/disable it into menubar or menu.
virtual int preferredHeight()
Preferred height of the widget.
virtual void addItem(YItem *item)
Add an YMenuItem first item represents the menu name, other sub items menu entries.
virtual ~YMGAQMenuBar()
Destructor.
Definition: YMGAQMenuBar.cc:96
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.