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 class QActionPPrivate;
57 class QActionPGroupPrivate;
61 class Q_EXPORT QActionP : public QObject
64 Q_PROPERTY( bool toggleAction READ isToggleAction WRITE setToggleAction)
65 Q_PROPERTY( bool on READ isOn WRITE setOn )
66 Q_PROPERTY( bool enabled READ isEnabled WRITE setEnabled )
67 Q_PROPERTY( QIconSet iconSet READ iconSet WRITE setIconSet )
68 Q_PROPERTY( QString text READ text WRITE setText )
69 Q_PROPERTY( QString menuText READ menuText WRITE setMenuText )
70 Q_PROPERTY( QString toolTip READ toolTip WRITE setToolTip )
71 Q_PROPERTY( QString statusTip READ statusTip WRITE setStatusTip )
72 Q_PROPERTY( QString whatsThis READ whatsThis WRITE setWhatsThis )
73 Q_PROPERTY( QKeySequence accel READ accel WRITE setAccel )
76 QActionP( QObject* parent, const char* name = 0, bool toggle = FALSE );
77 QActionP( const QString& text, const QIconSet& icon, const QString& menuText, QKeySequence accel,
78 QObject* parent, const char* name = 0, bool toggle = FALSE );
79 QActionP( const QString& text, const QString& menuText, QKeySequence accel, QObject* parent,
80 const char* name = 0, bool toggle = FALSE );
83 virtual void setIconSet( const QIconSet& );
84 QIconSet iconSet() const;
85 virtual void setText( const QString& );
87 virtual void setMenuText( const QString& );
88 QString menuText() const;
89 virtual void setToolTip( const QString& );
90 QString toolTip() const;
91 virtual void setStatusTip( const QString& );
92 QString statusTip() const;
93 virtual void setWhatsThis( const QString& );
94 QString whatsThis() const;
95 virtual void setAccel( const QKeySequence& key );
96 QKeySequence accel() const;
97 virtual void setToggleAction( bool );
98 bool isToggleAction() const;
100 bool isEnabled() 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, QPopupMenu *menu );
110 virtual void setOn( bool );
111 virtual void setEnabled( bool );
115 void toggled( bool );
118 void internalActivation();
119 void toolButtonToggled( bool );
120 void objectDestroyed();
121 void menuStatusText( int id );
122 void showStatusText( const QString& );
123 void clearStatusText();
132 class Q_EXPORT QActionPGroup : public QActionP
135 Q_PROPERTY( bool exclusive READ isExclusive WRITE setExclusive )
136 Q_PROPERTY( bool usesDropDown READ usesDropDown WRITE setUsesDropDown )
139 QActionPGroup( QObject* parent, const char* name = 0, bool exclusive = TRUE );
141 void setExclusive( bool );
142 bool isExclusive() const;
143 void add( QActionP* a);
145 bool addTo( QWidget* );
146 bool removeFrom( QWidget* );
147 void setEnabled( bool );
149 void setUsesDropDown( bool enable );
150 bool usesDropDown() const;
152 void setIconSet( const QIconSet& );
153 void setText( const QString& );
154 void setMenuText( const QString& );
155 void setToolTip( const QString& );
156 void setWhatsThis( const QString& );
159 void childEvent( QChildEvent* );
160 virtual void addedTo( QWidget *actionWidget, QWidget *container, QActionP *a );
161 virtual void addedTo( int index, QPopupMenu *menu, QActionP *a );
162 virtual void addedTo( QWidget *actionWidget, QWidget *container );
163 virtual void addedTo( int index, QPopupMenu *menu );
166 void selected( QActionP* );
169 void childToggled( bool );
170 void childDestroyed();
171 void internalComboBoxActivated( int );
172 void internalToggle( QActionP* );
173 void objectDestroyed();
176 QActionPGroupPrivate* d;
180 void insert( QActionP* a ) { add( a ); }