libyui-qt
Loading...
Searching...
No Matches
YQMenuButton.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: YQMenuButton.h
20
21 Author: Stefan Hundhammer <shundhammer@suse.de>
22
23/-*/
24
25
26#ifndef YQMenuButton_h
27#define YQMenuButton_h
28
29#include <qwidget.h>
30#include <yui/YMenuButton.h>
31#include <QMap>
32
33class QAction;
34class QPushButton;
35class QMenu;
36
37class YQMenuButton : public QWidget, public YMenuButton
38{
39 Q_OBJECT
40
41public:
45 YQMenuButton( YWidget * parent,
46 const std::string & label );
47
51 virtual ~YQMenuButton();
52
58 virtual void setLabel( const std::string & label );
59
65 virtual void rebuildMenuTree();
66
72 virtual void setEnabled( bool enabled );
73
79 virtual int preferredWidth();
80
86 virtual int preferredHeight();
87
93 virtual void setSize( int newWidth, int newHeight );
94
98 virtual bool setKeyboardFocus();
99
105 virtual void setItemEnabled( YMenuItem * item, bool enabled );
106
110 virtual void activateItem( YMenuItem * item );
111
112
113protected slots:
114
118 void menuEntryActivated( QAction * menuItem );
119
124 void returnNow();
125
126
127protected:
128
132 void rebuildMenuTree( QMenu * menu, YItemIterator begin, YItemIterator end );
133
134
135 //
136 // Data members
137 //
138
139 QPushButton * _qt_button;
140 YMenuItem * _selectedItem;
141 QMap<QAction *,YMenuItem *> _actionMap;
142};
143
144#endif // YQMenuButton_h
Definition YQMenuButton.h:38
virtual void setLabel(const std::string &label)
Definition YQMenuButton.cc:65
virtual void activateItem(YMenuItem *item)
Definition YQMenuButton.cc:257
virtual void setItemEnabled(YMenuItem *item, bool enabled)
Definition YQMenuButton.cc:195
virtual int preferredHeight()
Definition YQMenuButton.cc:232
virtual bool setKeyboardFocus()
Definition YQMenuButton.cc:248
virtual void setSize(int newWidth, int newHeight)
Definition YQMenuButton.cc:239
virtual int preferredWidth()
Definition YQMenuButton.cc:226
virtual void setEnabled(bool enabled)
Definition YQMenuButton.cc:219
void returnNow()
Definition YQMenuButton.cc:184
virtual void rebuildMenuTree()
Definition YQMenuButton.cc:73
void menuEntryActivated(QAction *menuItem)
Definition YQMenuButton.cc:154
virtual ~YQMenuButton()
Definition YQMenuButton.cc:58