1 /////////////////////////////////////////////////////////////////////////////
4 // Description : the patch for Qt's QAction class (qaction.h)
5 /////////////////////////////////////////////////////////////////////////////
7 /****************************************************************************
10 ** Definition of QAction class
14 ** Copyright (C) 2000 Trolltech AS. All rights reserved.
16 ** This file is part of the widgets module of the Qt GUI Toolkit.
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.
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.
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.
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.
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.
39 ** Contact info@trolltech.com if any conditions of this licensing are
42 **********************************************************************/
51 #include <qkeysequence.h>
56 #if QT_VERSION > 0x030005
58 #define QActionP QAction
59 #define QActionPGroup QActionGroup
62 class QActionPPrivate;
63 class QActionPGroupPrivate;
67 class Q_EXPORT QActionP : public QObject
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 )
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 );
89 virtual void setIconSet( const QIconSet& );
90 QIconSet iconSet() const;
91 virtual void setText( const QString& );
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;
106 bool isEnabled() const;
107 virtual bool addTo( QWidget* );
108 virtual bool removeFrom( QWidget* );
111 virtual void addedTo( QWidget *actionWidget, QWidget *container );
112 virtual void addedTo( int index, QPopupMenu *menu );
116 virtual void setOn( bool );
117 virtual void setEnabled( bool );
121 void toggled( bool );
124 void internalActivation();
125 void toolButtonToggled( bool );
126 void objectDestroyed();
127 void menuStatusText( int id );
128 void showStatusText( const QString& );
129 void clearStatusText();
138 class Q_EXPORT QActionPGroup : public QActionP
141 Q_PROPERTY( bool exclusive READ isExclusive WRITE setExclusive )
142 Q_PROPERTY( bool usesDropDown READ usesDropDown WRITE setUsesDropDown )
145 QActionPGroup( QObject* parent, const char* name = 0, bool exclusive = TRUE );
147 void setExclusive( bool );
148 bool isExclusive() const;
149 void add( QActionP* a);
151 bool addTo( QWidget* );
152 bool removeFrom( QWidget* );
153 void setEnabled( bool );
155 void setUsesDropDown( bool enable );
156 bool usesDropDown() const;
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& );
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 );
172 void selected( QActionP* );
175 void childToggled( bool );
176 void childDestroyed();
177 void internalComboBoxActivated( int );
178 void internalToggle( QActionP* );
179 void objectDestroyed();
182 QActionPGroupPrivate* d;
186 void insert( QActionP* a ) { add( a ); }