1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the Qt 3 compatibility classes of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
32
#include "QtGui/qicon.h"
33
#include "QtGui/qkeysequence.h"
34
#include "QtCore/qobject.h"
35
#include "QtCore/qstring.h"
39
class Q3ActionPrivate;
40
class Q3ActionGroupPrivate;
46
class Q_COMPAT_EXPORT Q3Action : public QObject
49
Q_PROPERTY(bool toggleAction READ isToggleAction WRITE setToggleAction)
50
Q_PROPERTY(bool on READ isOn WRITE setOn)
51
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
52
Q_PROPERTY(QIcon iconSet READ iconSet WRITE setIconSet)
53
Q_PROPERTY(QString text READ text WRITE setText)
54
Q_PROPERTY(QString menuText READ menuText WRITE setMenuText)
55
Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
56
Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip)
57
Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
59
Q_PROPERTY(QKeySequence accel READ accel WRITE setAccel)
61
Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
64
Q3Action(QObject* parent, const char* name = 0);
66
Q3Action(const QString& menuText, QKeySequence accel,
67
QObject* parent, const char* name = 0);
68
Q3Action(const QIcon& icon, const QString& menuText, QKeySequence accel,
69
QObject* parent, const char* name = 0);
71
Q3Action(const QString& text, const QIcon& icon, const QString& menuText, QKeySequence accel,
72
QObject* parent, const char* name = 0, bool toggle = false); // obsolete
73
Q3Action(const QString& text, const QString& menuText, QKeySequence accel, QObject* parent,
74
const char* name = 0, bool toggle = false); // obsolete
76
Q3Action(QObject* parent, const char* name , bool toggle); // obsolete
79
virtual void setIconSet(const QIcon&);
80
QIcon iconSet() const;
81
virtual void setText(const QString&);
83
virtual void setMenuText(const QString&);
84
QString menuText() const;
85
virtual void setToolTip(const QString&);
86
QString toolTip() const;
87
virtual void setStatusTip(const QString&);
88
QString statusTip() const;
89
virtual void setWhatsThis(const QString&);
90
QString whatsThis() const;
92
virtual void setAccel(const QKeySequence& key);
93
QKeySequence accel() const;
95
virtual void setToggleAction(bool);
97
bool isToggleAction() const;
99
bool isEnabled() const;
100
bool isVisible() const;
101
virtual bool addTo(QWidget*);
102
virtual bool removeFrom(QWidget*);
105
virtual void addedTo(QWidget *actionWidget, QWidget *container);
106
virtual void addedTo(int index, Q3PopupMenu *menu);
111
virtual void setOn(bool);
112
virtual void setEnabled(bool);
113
void setDisabled(bool);
114
virtual void setVisible(bool);
121
void internalActivation();
122
void toolButtonToggled(bool);
123
void objectDestroyed();
124
void menuStatusText(int id);
125
void showStatusText(const QString&);
126
void clearStatusText();
129
Q_DISABLE_COPY(Q3Action)
135
friend class Q3ActionPrivate;
136
friend class Q3ActionGroup;
137
friend class Q3ActionGroupPrivate;
140
class Q_COMPAT_EXPORT Q3ActionGroup : public Q3Action
143
Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive)
144
Q_PROPERTY(bool usesDropDown READ usesDropDown WRITE setUsesDropDown)
147
Q3ActionGroup(QObject* parent, const char* name = 0);
148
Q3ActionGroup(QObject* parent, const char* name , bool exclusive ); // obsolete
150
void setExclusive(bool);
151
bool isExclusive() const;
152
void add(Q3Action* a);
154
bool addTo(QWidget*);
155
bool removeFrom(QWidget*);
156
void setEnabled(bool);
157
void setToggleAction(bool toggle);
159
void setVisible(bool);
161
void setUsesDropDown(bool enable);
162
bool usesDropDown() const;
164
void setIconSet(const QIcon &);
165
void setText(const QString&);
166
void setMenuText(const QString&);
167
void setToolTip(const QString&);
168
void setWhatsThis(const QString&);
171
void childEvent(QChildEvent*);
172
virtual void addedTo(QWidget *actionWidget, QWidget *container, Q3Action *a);
173
virtual void addedTo(int index, Q3PopupMenu *menu, Q3Action *a);
174
virtual void addedTo(QWidget *actionWidget, QWidget *container);
175
virtual void addedTo(int index, Q3PopupMenu *menu);
178
void selected(Q3Action*);
179
void activated(Q3Action *);
182
void childToggled(bool);
183
void childActivated();
184
void childDestroyed();
185
void internalComboBoxActivated(int);
186
void internalComboBoxHighlighted(int);
187
void internalToggle(Q3Action*);
188
void objectDestroyed();
191
Q3ActionGroupPrivate* d;
194
void insert(Q3Action *a) { add(a); }
197
Q_DISABLE_COPY(Q3ActionGroup)