~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/qt3support/widgets/q3action.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the Qt 3 compatibility classes of the Qt Toolkit.
 
6
**
 
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.
 
10
**
 
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.
 
15
**
 
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.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
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.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef Q3ACTION_H
 
30
#define Q3ACTION_H
 
31
 
 
32
#include "QtGui/qicon.h"
 
33
#include "QtGui/qkeysequence.h"
 
34
#include "QtCore/qobject.h"
 
35
#include "QtCore/qstring.h"
 
36
 
 
37
#ifndef QT_NO_ACTION
 
38
 
 
39
class Q3ActionPrivate;
 
40
class Q3ActionGroupPrivate;
 
41
class QStatusBar;
 
42
class Q3PopupMenu;
 
43
class QToolTipGroup;
 
44
class QWidget;
 
45
 
 
46
class Q_COMPAT_EXPORT Q3Action : public QObject
 
47
{
 
48
    Q_OBJECT
 
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)
 
58
#ifndef QT_NO_ACCEL
 
59
    Q_PROPERTY(QKeySequence accel READ accel WRITE setAccel)
 
60
#endif
 
61
    Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
 
62
 
 
63
public:
 
64
    Q3Action(QObject* parent, const char* name = 0);
 
65
#ifndef QT_NO_ACCEL
 
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);
 
70
 
 
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
 
75
#endif
 
76
    Q3Action(QObject* parent, const char* name , bool toggle); // obsolete
 
77
    ~Q3Action();
 
78
 
 
79
    virtual void setIconSet(const QIcon&);
 
80
    QIcon iconSet() const;
 
81
    virtual void setText(const QString&);
 
82
    QString text() const;
 
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;
 
91
#ifndef QT_NO_ACCEL
 
92
    virtual void setAccel(const QKeySequence& key);
 
93
    QKeySequence accel() const;
 
94
#endif
 
95
    virtual void setToggleAction(bool);
 
96
 
 
97
    bool isToggleAction() const;
 
98
    bool isOn() const;
 
99
    bool isEnabled() const;
 
100
    bool isVisible() const;
 
101
    virtual bool addTo(QWidget*);
 
102
    virtual bool removeFrom(QWidget*);
 
103
 
 
104
protected:
 
105
    virtual void addedTo(QWidget *actionWidget, QWidget *container);
 
106
    virtual void addedTo(int index, Q3PopupMenu *menu);
 
107
 
 
108
public slots:
 
109
    void activate();
 
110
    void toggle();
 
111
    virtual void setOn(bool);
 
112
    virtual void setEnabled(bool);
 
113
    void setDisabled(bool);
 
114
    virtual void setVisible(bool);
 
115
 
 
116
signals:
 
117
    void activated();
 
118
    void toggled(bool);
 
119
 
 
120
private slots:
 
121
    void internalActivation();
 
122
    void toolButtonToggled(bool);
 
123
    void objectDestroyed();
 
124
    void menuStatusText(int id);
 
125
    void showStatusText(const QString&);
 
126
    void clearStatusText();
 
127
 
 
128
private:
 
129
    Q_DISABLE_COPY(Q3Action)
 
130
 
 
131
    void init();
 
132
 
 
133
    Q3ActionPrivate* d;
 
134
 
 
135
    friend class Q3ActionPrivate;
 
136
    friend class Q3ActionGroup;
 
137
    friend class Q3ActionGroupPrivate;
 
138
};
 
139
 
 
140
class Q_COMPAT_EXPORT Q3ActionGroup : public Q3Action
 
141
{
 
142
    Q_OBJECT
 
143
    Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive)
 
144
    Q_PROPERTY(bool usesDropDown READ usesDropDown WRITE setUsesDropDown)
 
145
 
 
146
public:
 
147
    Q3ActionGroup(QObject* parent, const char* name = 0);
 
148
    Q3ActionGroup(QObject* parent, const char* name , bool exclusive ); // obsolete
 
149
    ~Q3ActionGroup();
 
150
    void setExclusive(bool);
 
151
    bool isExclusive() const;
 
152
    void add(Q3Action* a);
 
153
    void addSeparator();
 
154
    bool addTo(QWidget*);
 
155
    bool removeFrom(QWidget*);
 
156
    void setEnabled(bool);
 
157
    void setToggleAction(bool toggle);
 
158
    void setOn(bool on);
 
159
    void setVisible(bool);
 
160
 
 
161
    void setUsesDropDown(bool enable);
 
162
    bool usesDropDown() const;
 
163
 
 
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&);
 
169
 
 
170
protected:
 
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);
 
176
 
 
177
signals:
 
178
    void selected(Q3Action*);
 
179
    void activated(Q3Action *);
 
180
 
 
181
private slots:
 
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();
 
189
 
 
190
private:
 
191
    Q3ActionGroupPrivate* d;
 
192
 
 
193
public:
 
194
    void insert(Q3Action *a) { add(a); }
 
195
 
 
196
private:
 
197
    Q_DISABLE_COPY(Q3ActionGroup)
 
198
};
 
199
 
 
200
#endif
 
201
 
 
202
#endif