libyui-qt
YQContextMenu.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
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: YQContextMenu.h
20 
21  Author: Thomas Goettlicher <tgoettlicher@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQContextMenu_h
27 #define YQContextMenu_h
28 
29 #include <qwidget.h>
30 #include <yui/YContextMenu.h>
31 #include <QHash>
32 
33 class QAction;
34 class QPushButton;
35 class QMenu;
36 
37 class YQContextMenu : public QObject, public YContextMenu
38 {
39  Q_OBJECT
40 
41 public:
45  YQContextMenu( );
46  YQContextMenu( QWidget* parent, const QPoint position );
47 
48 
52  virtual ~YQContextMenu();
53 
59 // virtual void setLabel( const std::string & label );
60 
66  virtual void rebuildMenuTree();
67 
73  virtual int preferredWidth();
74 
80  virtual int preferredHeight();
81 
87  virtual void setSize( int newWidth, int newHeight );
88 
89 
90 protected slots:
91 
95  void menuEntryActivated( QAction * menuItem );
96 
101  void returnNow();
102 
106  void slotMenuHidden();
107 
112  void slotReturnMenuHidden();
113 
114 
115 
116 
117 protected:
118 
122  void rebuildMenuTree( QMenu * menu, YItemIterator begin, YItemIterator end );
123 
124 
125  //
126  // Data members
127  //
128 
129  YMenuItem * _selectedItem;
130  QPushButton * _qt_button;
131  QHash<QAction*,int> _serials;
132 
133 
134 private:
135  QPoint _position;
136  bool _suppressCancelEvent;
137  QWidget* _parent;
138 
139 };
140 
141 #endif // YQContextMenu_h
void menuEntryActivated(QAction *menuItem)
Definition: YQContextMenu.cc:152
virtual int preferredWidth()
Definition: YQContextMenu.cc:195
void slotReturnMenuHidden()
Definition: YQContextMenu.cc:142
virtual int preferredHeight()
Definition: YQContextMenu.cc:201
void slotMenuHidden()
Definition: YQContextMenu.cc:133
virtual void setSize(int newWidth, int newHeight)
Definition: YQContextMenu.cc:208
void returnNow()
Definition: YQContextMenu.cc:185
Definition: YQContextMenu.h:37
YQContextMenu()
Definition: YQContextMenu.cc:40
virtual void rebuildMenuTree()
Definition: YQContextMenu.cc:67
virtual ~YQContextMenu()
Definition: YQContextMenu.cc:60