1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the Qt3Support module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef Q3ACTION_H
|
---|
43 | #define Q3ACTION_H
|
---|
44 |
|
---|
45 | #include <QtGui/qicon.h>
|
---|
46 | #include <QtGui/qkeysequence.h>
|
---|
47 | #include <QtCore/qobject.h>
|
---|
48 | #include <QtCore/qstring.h>
|
---|
49 |
|
---|
50 | QT_BEGIN_HEADER
|
---|
51 |
|
---|
52 | QT_BEGIN_NAMESPACE
|
---|
53 |
|
---|
54 | QT_MODULE(Qt3SupportLight)
|
---|
55 |
|
---|
56 | #ifndef QT_NO_ACTION
|
---|
57 |
|
---|
58 | class Q3ActionPrivate;
|
---|
59 | class Q3ActionGroupPrivate;
|
---|
60 | class QStatusBar;
|
---|
61 | class Q3PopupMenu;
|
---|
62 | class QToolTipGroup;
|
---|
63 | class QWidget;
|
---|
64 |
|
---|
65 | class Q_COMPAT_EXPORT Q3Action : public QObject
|
---|
66 | {
|
---|
67 | Q_OBJECT
|
---|
68 | Q_PROPERTY(bool toggleAction READ isToggleAction WRITE setToggleAction)
|
---|
69 | Q_PROPERTY(bool on READ isOn WRITE setOn)
|
---|
70 | Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
|
---|
71 | Q_PROPERTY(QIcon iconSet READ iconSet WRITE setIconSet)
|
---|
72 | Q_PROPERTY(QString text READ text WRITE setText)
|
---|
73 | Q_PROPERTY(QString menuText READ menuText WRITE setMenuText)
|
---|
74 | Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
|
---|
75 | Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip)
|
---|
76 | Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
|
---|
77 | #ifndef QT_NO_ACCEL
|
---|
78 | Q_PROPERTY(QKeySequence accel READ accel WRITE setAccel)
|
---|
79 | #endif
|
---|
80 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
|
---|
81 |
|
---|
82 | public:
|
---|
83 | Q3Action(QObject* parent, const char* name = 0);
|
---|
84 | #ifndef QT_NO_ACCEL
|
---|
85 | Q3Action(const QString& menuText, QKeySequence accel,
|
---|
86 | QObject* parent, const char* name = 0);
|
---|
87 | Q3Action(const QIcon& icon, const QString& menuText, QKeySequence accel,
|
---|
88 | QObject* parent, const char* name = 0);
|
---|
89 |
|
---|
90 | Q3Action(const QString& text, const QIcon& icon, const QString& menuText, QKeySequence accel,
|
---|
91 | QObject* parent, const char* name = 0, bool toggle = false); // obsolete
|
---|
92 | Q3Action(const QString& text, const QString& menuText, QKeySequence accel, QObject* parent,
|
---|
93 | const char* name = 0, bool toggle = false); // obsolete
|
---|
94 | #endif
|
---|
95 | Q3Action(QObject* parent, const char* name , bool toggle); // obsolete
|
---|
96 | ~Q3Action();
|
---|
97 |
|
---|
98 | virtual void setIconSet(const QIcon&);
|
---|
99 | QIcon iconSet() const;
|
---|
100 | virtual void setText(const QString&);
|
---|
101 | QString text() const;
|
---|
102 | virtual void setMenuText(const QString&);
|
---|
103 | QString menuText() const;
|
---|
104 | virtual void setToolTip(const QString&);
|
---|
105 | QString toolTip() const;
|
---|
106 | virtual void setStatusTip(const QString&);
|
---|
107 | QString statusTip() const;
|
---|
108 | virtual void setWhatsThis(const QString&);
|
---|
109 | QString whatsThis() const;
|
---|
110 | #ifndef QT_NO_ACCEL
|
---|
111 | virtual void setAccel(const QKeySequence& key);
|
---|
112 | QKeySequence accel() const;
|
---|
113 | #endif
|
---|
114 | virtual void setToggleAction(bool);
|
---|
115 |
|
---|
116 | bool isToggleAction() const;
|
---|
117 | bool isOn() const;
|
---|
118 | bool isEnabled() const;
|
---|
119 | bool isVisible() const;
|
---|
120 | virtual bool addTo(QWidget*);
|
---|
121 | virtual bool removeFrom(QWidget*);
|
---|
122 |
|
---|
123 | protected:
|
---|
124 | virtual void addedTo(QWidget *actionWidget, QWidget *container);
|
---|
125 | virtual void addedTo(int index, Q3PopupMenu *menu);
|
---|
126 |
|
---|
127 | public Q_SLOTS:
|
---|
128 | void activate();
|
---|
129 | void toggle();
|
---|
130 | virtual void setOn(bool);
|
---|
131 | virtual void setEnabled(bool);
|
---|
132 | void setDisabled(bool);
|
---|
133 | virtual void setVisible(bool);
|
---|
134 |
|
---|
135 | Q_SIGNALS:
|
---|
136 | void activated();
|
---|
137 | void toggled(bool);
|
---|
138 |
|
---|
139 | private Q_SLOTS:
|
---|
140 | void internalActivation();
|
---|
141 | void toolButtonToggled(bool);
|
---|
142 | void objectDestroyed();
|
---|
143 | void menuStatusText(int id);
|
---|
144 | void showStatusText(const QString&);
|
---|
145 | void clearStatusText();
|
---|
146 |
|
---|
147 | private:
|
---|
148 | Q_DISABLE_COPY(Q3Action)
|
---|
149 |
|
---|
150 | void init();
|
---|
151 |
|
---|
152 | Q3ActionPrivate* d;
|
---|
153 |
|
---|
154 | friend class Q3ActionPrivate;
|
---|
155 | friend class Q3ActionGroup;
|
---|
156 | friend class Q3ActionGroupPrivate;
|
---|
157 | };
|
---|
158 |
|
---|
159 | class Q_COMPAT_EXPORT Q3ActionGroup : public Q3Action
|
---|
160 | {
|
---|
161 | Q_OBJECT
|
---|
162 | Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive)
|
---|
163 | Q_PROPERTY(bool usesDropDown READ usesDropDown WRITE setUsesDropDown)
|
---|
164 |
|
---|
165 | public:
|
---|
166 | Q3ActionGroup(QObject* parent, const char* name = 0);
|
---|
167 | Q3ActionGroup(QObject* parent, const char* name , bool exclusive ); // obsolete
|
---|
168 | ~Q3ActionGroup();
|
---|
169 | void setExclusive(bool);
|
---|
170 | bool isExclusive() const;
|
---|
171 | void add(Q3Action* a);
|
---|
172 | void addSeparator();
|
---|
173 | bool addTo(QWidget*);
|
---|
174 | bool removeFrom(QWidget*);
|
---|
175 | void setEnabled(bool);
|
---|
176 | void setToggleAction(bool toggle);
|
---|
177 | void setOn(bool on);
|
---|
178 | void setVisible(bool);
|
---|
179 |
|
---|
180 | void setUsesDropDown(bool enable);
|
---|
181 | bool usesDropDown() const;
|
---|
182 |
|
---|
183 | void setIconSet(const QIcon &);
|
---|
184 | void setText(const QString&);
|
---|
185 | void setMenuText(const QString&);
|
---|
186 | void setToolTip(const QString&);
|
---|
187 | void setWhatsThis(const QString&);
|
---|
188 |
|
---|
189 | protected:
|
---|
190 | void childEvent(QChildEvent*);
|
---|
191 | virtual void addedTo(QWidget *actionWidget, QWidget *container, Q3Action *a);
|
---|
192 | virtual void addedTo(int index, Q3PopupMenu *menu, Q3Action *a);
|
---|
193 | virtual void addedTo(QWidget *actionWidget, QWidget *container);
|
---|
194 | virtual void addedTo(int index, Q3PopupMenu *menu);
|
---|
195 |
|
---|
196 | Q_SIGNALS:
|
---|
197 | void selected(Q3Action*);
|
---|
198 | void activated(Q3Action *);
|
---|
199 |
|
---|
200 | private Q_SLOTS:
|
---|
201 | void childToggled(bool);
|
---|
202 | void childActivated();
|
---|
203 | void childDestroyed();
|
---|
204 | void internalComboBoxActivated(int);
|
---|
205 | void internalComboBoxHighlighted(int);
|
---|
206 | void internalToggle(Q3Action*);
|
---|
207 | void objectDestroyed();
|
---|
208 |
|
---|
209 | private:
|
---|
210 | Q3ActionGroupPrivate* d;
|
---|
211 |
|
---|
212 | public:
|
---|
213 | void insert(Q3Action *a) { add(a); }
|
---|
214 |
|
---|
215 | private:
|
---|
216 | Q_DISABLE_COPY(Q3ActionGroup)
|
---|
217 | };
|
---|
218 |
|
---|
219 | #endif // QT_NO_ACTION
|
---|
220 |
|
---|
221 | QT_END_NAMESPACE
|
---|
222 |
|
---|
223 | QT_END_HEADER
|
---|
224 |
|
---|
225 | #endif // Q3ACTION_H
|
---|