]> SALOME platform Git repositories - modules/kernel.git/blob - src/PatchQt/qactionP.h
Salome HOME
Porting to Mandrake 10.1 and new products:
[modules/kernel.git] / src / PatchQt / qactionP.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Module      : PatchQt
3 // File        : qactionP.h
4 // Description : the patch for Qt's QAction class (qaction.h)
5 /////////////////////////////////////////////////////////////////////////////
6
7 /****************************************************************************
8 ** $Id$
9 **
10 ** Definition of QAction class
11 **
12 ** Created : 000000
13 **
14 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
15 **
16 ** This file is part of the widgets module of the Qt GUI Toolkit.
17 **
18 ** This file may be distributed under the terms of the Q Public License
19 ** as defined by Trolltech AS of Norway and appearing in the file
20 ** LICENSE.QPL included in the packaging of this file.
21 **
22 ** This file may be distributed and/or modified under the terms of the
23 ** GNU General Public License version 2 as published by the Free Software
24 ** Foundation and appearing in the file LICENSE.GPL included in the
25 ** packaging of this file.
26 **
27 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
28 ** licenses may use this file in accordance with the Qt Commercial License
29 ** Agreement provided with the Software.
30 **
31 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
32 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
33 **
34 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
35 **   information about Qt Commercial License Agreements.
36 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
37 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
38 **
39 ** Contact info@trolltech.com if any conditions of this licensing are
40 ** not clear to you.
41 **
42 **********************************************************************/
43
44 #ifndef QACTIONP_H
45 #define QACTIONP_H
46
47 #ifndef QT_H
48 #include <qobject.h>
49 #include <qiconset.h>
50 #include <qstring.h>
51 #include <qkeysequence.h>
52 #endif // QT_H
53
54 #ifndef QT_NO_ACTION
55
56 #if QT_VERSION > 0x030005
57 #include <qaction.h>
58 #define QActionP QAction
59 #define QActionPGroup QActionGroup
60 #else
61
62 class QActionPPrivate;
63 class QActionPGroupPrivate;
64 class QStatusBar;
65 class QPopupMenu;
66
67 class Q_EXPORT QActionP : public QObject
68 {
69     Q_OBJECT
70     Q_PROPERTY( bool toggleAction READ isToggleAction WRITE setToggleAction)
71     Q_PROPERTY( bool on READ isOn WRITE setOn )
72     Q_PROPERTY( bool enabled READ isEnabled WRITE setEnabled )
73     Q_PROPERTY( QIconSet iconSet READ iconSet WRITE setIconSet )
74     Q_PROPERTY( QString text READ text WRITE setText )
75     Q_PROPERTY( QString menuText READ menuText WRITE setMenuText )
76     Q_PROPERTY( QString toolTip READ toolTip WRITE setToolTip )
77     Q_PROPERTY( QString statusTip READ statusTip WRITE setStatusTip )
78     Q_PROPERTY( QString whatsThis READ whatsThis WRITE setWhatsThis )
79     Q_PROPERTY( QKeySequence accel READ accel WRITE setAccel )
80
81 public:
82     QActionP( QObject* parent, const char* name = 0, bool toggle = FALSE  );
83     QActionP( const QString& text, const QIconSet& icon, const QString& menuText, QKeySequence accel,
84              QObject* parent, const char* name = 0, bool toggle = FALSE );
85     QActionP( const QString& text, const QString& menuText, QKeySequence accel, QObject* parent,
86              const char* name = 0, bool toggle = FALSE );
87     ~QActionP();
88
89     virtual void setIconSet( const QIconSet& );
90     QIconSet iconSet() const;
91     virtual void setText( const QString& );
92     QString text() const;
93     virtual void setMenuText( const QString& );
94     QString menuText() const;
95     virtual void setToolTip( const QString& );
96     QString toolTip() const;
97     virtual void setStatusTip( const QString& );
98     QString statusTip() const;
99     virtual void setWhatsThis( const QString& );
100     QString whatsThis() const;
101     virtual void setAccel( const QKeySequence& key );
102     QKeySequence accel() const;
103     virtual void setToggleAction( bool );
104     bool isToggleAction() const;
105     bool isOn() const;
106     bool isEnabled() const;
107     virtual bool addTo( QWidget* );
108     virtual bool removeFrom( QWidget* );
109
110 protected:
111     virtual void addedTo( QWidget *actionWidget, QWidget *container );
112     virtual void addedTo( int index, QPopupMenu *menu );
113
114 public slots:
115     void toggle();
116     virtual void setOn( bool );
117     virtual void setEnabled( bool );
118
119 signals:
120     void activated();
121     void toggled( bool );
122
123 private slots:
124     void internalActivation();
125     void toolButtonToggled( bool );
126     void objectDestroyed();
127     void menuStatusText( int id );
128     void showStatusText( const QString& );
129     void clearStatusText();
130
131 private:
132     void init();
133
134     QActionPPrivate* d;
135
136 };
137
138 class Q_EXPORT QActionPGroup : public QActionP
139 {
140     Q_OBJECT
141     Q_PROPERTY( bool exclusive READ isExclusive WRITE setExclusive )
142     Q_PROPERTY( bool usesDropDown READ usesDropDown WRITE setUsesDropDown )
143
144 public:
145     QActionPGroup( QObject* parent, const char* name = 0, bool exclusive = TRUE );
146     ~QActionPGroup();
147     void setExclusive( bool );
148     bool isExclusive() const;
149     void add( QActionP* a);
150     void addSeparator();
151     bool addTo( QWidget* );
152     bool removeFrom( QWidget* );
153     void setEnabled( bool );
154
155     void setUsesDropDown( bool enable );
156     bool usesDropDown() const;
157
158     void setIconSet( const QIconSet& );
159     void setText( const QString& );
160     void setMenuText( const QString& );
161     void setToolTip( const QString& );
162     void setWhatsThis( const QString& );
163
164 protected:
165     void childEvent( QChildEvent* );
166     virtual void addedTo( QWidget *actionWidget, QWidget *container, QActionP *a );
167     virtual void addedTo( int index, QPopupMenu *menu, QActionP *a );
168     virtual void addedTo( QWidget *actionWidget, QWidget *container );
169     virtual void addedTo( int index, QPopupMenu *menu );
170
171 signals:
172     void selected( QActionP* );
173
174 private slots:
175     void childToggled( bool );
176     void childDestroyed();
177     void internalComboBoxActivated( int );
178     void internalToggle( QActionP* );
179     void objectDestroyed();
180
181 private:
182     QActionPGroupPrivate* d;
183
184 #ifndef QT_NO_COMPAT
185 public:
186     void insert( QActionP* a ) { add( a ); }
187 #endif
188
189 };
190
191 #endif
192
193 #endif // QT_VERSION
194
195 #endif