Eneboo - Documentación para desarrolladores
src/qt/src/widgets/qaction.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qaction.h   3.3.8   edited Jan 11 14:46 $
00003 **
00004 ** Definition of QAction class
00005 **
00006 ** Created : 000000
00007 **
00008 ** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the widgets module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QACTION_H
00039 #define QACTION_H
00040 
00041 #ifndef QT_H
00042 #include "qobject.h"
00043 #include "qiconset.h"
00044 #include "qstring.h"
00045 #include "qkeysequence.h"
00046 #endif // QT_H
00047 
00048 #ifndef QT_NO_ACTION
00049 
00050 class QActionPrivate;
00051 class QActionGroupPrivate;
00052 class QStatusBar;
00053 class QPopupMenu;
00054 class QToolTipGroup;
00055 
00056 class Q_EXPORT QAction : public QObject
00057 {
00058     Q_OBJECT
00059     Q_PROPERTY( bool toggleAction READ isToggleAction WRITE setToggleAction)
00060     Q_PROPERTY( bool on READ isOn WRITE setOn )
00061     Q_PROPERTY( bool enabled READ isEnabled WRITE setEnabled )
00062     Q_PROPERTY( QIconSet iconSet READ iconSet WRITE setIconSet )
00063     Q_PROPERTY( QString text READ text WRITE setText )
00064     Q_PROPERTY( QString menuText READ menuText WRITE setMenuText )
00065     Q_PROPERTY( QString toolTip READ toolTip WRITE setToolTip )
00066     Q_PROPERTY( QString statusTip READ statusTip WRITE setStatusTip )
00067     Q_PROPERTY( QString whatsThis READ whatsThis WRITE setWhatsThis )
00068 #ifndef QT_NO_ACCEL
00069     Q_PROPERTY( QKeySequence accel READ accel WRITE setAccel )
00070 #endif
00071     Q_PROPERTY( bool visible READ isVisible WRITE setVisible )
00072 
00073 public:
00074     QAction( QObject* parent, const char* name = 0 );
00075 #ifndef QT_NO_ACCEL
00076     QAction( const QString& menuText, QKeySequence accel,
00077              QObject* parent, const char* name = 0 );
00078     QAction( const QIconSet& icon, const QString& menuText, QKeySequence accel,
00079              QObject* parent, const char* name = 0 );
00080 
00081     QAction( const QString& text, const QIconSet& icon, const QString& menuText, QKeySequence accel,
00082              QObject* parent, const char* name = 0, bool toggle = FALSE ); // obsolete
00083     QAction( const QString& text, const QString& menuText, QKeySequence accel, QObject* parent,
00084              const char* name = 0, bool toggle = FALSE ); // obsolete
00085 #endif
00086     QAction( QObject* parent, const char* name , bool toggle ); // obsolete
00087     ~QAction();
00088 
00089     virtual void setIconSet( const QIconSet& );
00090     QIconSet iconSet() const;
00091     virtual void setText( const QString& );
00092     QString text() const;
00093     virtual void setMenuText( const QString& );
00094     QString menuText() const;
00095     virtual void setToolTip( const QString& );
00096     QString toolTip() const;
00097     virtual void setStatusTip( const QString& );
00098     QString statusTip() const;
00099     virtual void setWhatsThis( const QString& );
00100     QString whatsThis() const;
00101 #ifndef QT_NO_ACCEL
00102     virtual void setAccel( const QKeySequence& key );
00103     QKeySequence accel() const;
00104 #endif
00105     virtual void setToggleAction( bool );
00106 
00107     bool isToggleAction() const;
00108     bool isOn() const;
00109     bool isEnabled() const;
00110     bool isVisible() const;
00111     virtual bool addTo( QWidget* );
00112     virtual bool removeFrom( QWidget* );
00113 
00114 protected:
00115     virtual void addedTo( QWidget *actionWidget, QWidget *container );
00116     virtual void addedTo( int index, QPopupMenu *menu );
00117 
00118 public slots:
00119     void activate();
00120     void toggle();
00121     virtual void setOn( bool );
00122     virtual void setEnabled( bool );
00123     void setDisabled( bool );
00124     void setVisible( bool );
00125 
00126 signals:
00127     void activated();
00128     void toggled( bool );
00129 
00130 private slots:
00131     void internalActivation();
00132     void toolButtonToggled( bool );
00133     void objectDestroyed();
00134     void menuStatusText( int id );
00135     void showStatusText( const QString& );
00136     void clearStatusText();
00137 
00138 private:
00139     void init();
00140 
00141     friend class QActionGroup;
00142     friend class QActionGroupPrivate;
00143     QActionPrivate* d;
00144 
00145 #if defined(Q_DISABLE_COPY)  // Disabled copy constructor and operator=
00146     QAction( const QAction & );
00147     QAction &operator=( const QAction & );
00148 #endif
00149 };
00150 
00151 class Q_EXPORT QActionGroup : public QAction
00152 {
00153     Q_OBJECT
00154     Q_PROPERTY( bool exclusive READ isExclusive WRITE setExclusive )
00155     Q_PROPERTY( bool usesDropDown READ usesDropDown WRITE setUsesDropDown )
00156 
00157 public:
00158     QActionGroup( QObject* parent, const char* name = 0 );
00159     QActionGroup( QObject* parent, const char* name , bool exclusive  ); // obsolete
00160     ~QActionGroup();
00161     void setExclusive( bool );
00162     bool isExclusive() const;
00163     void add( QAction* a);
00164     void addSeparator();
00165     bool addTo( QWidget* );
00166     bool removeFrom( QWidget* );
00167     void setEnabled( bool );
00168     void setToggleAction( bool toggle );
00169     void setOn( bool on );
00170 
00171     void setUsesDropDown( bool enable );
00172     bool usesDropDown() const;
00173 
00174     void setIconSet( const QIconSet& );
00175     void setText( const QString& );
00176     void setMenuText( const QString& );
00177     void setToolTip( const QString& );
00178     void setWhatsThis( const QString& );
00179 
00180 protected:
00181     void childEvent( QChildEvent* );
00182     virtual void addedTo( QWidget *actionWidget, QWidget *container, QAction *a );
00183     virtual void addedTo( int index, QPopupMenu *menu, QAction *a );
00184     virtual void addedTo( QWidget *actionWidget, QWidget *container );
00185     virtual void addedTo( int index, QPopupMenu *menu );
00186 
00187 signals:
00188     void selected( QAction* );
00189 
00190 private slots:
00191     void childToggled( bool );
00192     void childDestroyed();
00193     void internalComboBoxActivated( int );
00194     void internalComboBoxHighlighted( int );
00195     void internalToggle( QAction* );
00196     void objectDestroyed();
00197 
00198 private:
00199     QActionGroupPrivate* d;
00200 
00201 #ifndef QT_NO_COMPAT
00202 public:
00203     void insert( QAction* a ) { add( a ); }
00204 #endif
00205 
00206 private:
00207 #if defined(Q_DISABLE_COPY)  // Disabled copy constructor and operator=
00208     QActionGroup( const QActionGroup & );
00209     QActionGroup &operator=( const QActionGroup & );
00210 #endif
00211 };
00212 
00213 #endif
00214 
00215 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'