src/qt3support/widgets/q3action.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the Qt3Support module of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ****************************************************************************/
00023 
00024 #ifndef Q3ACTION_H
00025 #define Q3ACTION_H
00026 
00027 #include <QtGui/qicon.h>
00028 #include <QtGui/qkeysequence.h>
00029 #include <QtCore/qobject.h>
00030 #include <QtCore/qstring.h>
00031 
00032 QT_BEGIN_HEADER
00033 
00034 QT_MODULE(Qt3SupportLight)
00035 
00036 #ifndef QT_NO_ACTION
00037 
00038 class Q3ActionPrivate;
00039 class Q3ActionGroupPrivate;
00040 class QStatusBar;
00041 class Q3PopupMenu;
00042 class QToolTipGroup;
00043 class QWidget;
00044 
00045 class Q_COMPAT_EXPORT Q3Action : public QObject
00046 {
00047     Q_OBJECT
00048     Q_PROPERTY(bool toggleAction READ isToggleAction WRITE setToggleAction)
00049     Q_PROPERTY(bool on READ isOn WRITE setOn)
00050     Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
00051     Q_PROPERTY(QIcon iconSet READ iconSet WRITE setIconSet)
00052     Q_PROPERTY(QString text READ text WRITE setText)
00053     Q_PROPERTY(QString menuText READ menuText WRITE setMenuText)
00054     Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
00055     Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip)
00056     Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
00057 #ifndef QT_NO_ACCEL
00058     Q_PROPERTY(QKeySequence accel READ accel WRITE setAccel)
00059 #endif
00060     Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
00061 
00062 public:
00063     Q3Action(QObject* parent, const char* name = 0);
00064 #ifndef QT_NO_ACCEL
00065     Q3Action(const QString& menuText, QKeySequence accel,
00066              QObject* parent, const char* name = 0);
00067     Q3Action(const QIcon& icon, const QString& menuText, QKeySequence accel,
00068              QObject* parent, const char* name = 0);
00069 
00070     Q3Action(const QString& text, const QIcon& icon, const QString& menuText, QKeySequence accel,
00071              QObject* parent, const char* name = 0, bool toggle = false); // obsolete
00072     Q3Action(const QString& text, const QString& menuText, QKeySequence accel, QObject* parent,
00073              const char* name = 0, bool toggle = false); // obsolete
00074 #endif
00075     Q3Action(QObject* parent, const char* name , bool toggle); // obsolete
00076     ~Q3Action();
00077 
00078     virtual void setIconSet(const QIcon&);
00079     QIcon iconSet() const;
00080     virtual void setText(const QString&);
00081     QString text() const;
00082     virtual void setMenuText(const QString&);
00083     QString menuText() const;
00084     virtual void setToolTip(const QString&);
00085     QString toolTip() const;
00086     virtual void setStatusTip(const QString&);
00087     QString statusTip() const;
00088     virtual void setWhatsThis(const QString&);
00089     QString whatsThis() const;
00090 #ifndef QT_NO_ACCEL
00091     virtual void setAccel(const QKeySequence& key);
00092     QKeySequence accel() const;
00093 #endif
00094     virtual void setToggleAction(bool);
00095 
00096     bool isToggleAction() const;
00097     bool isOn() const;
00098     bool isEnabled() const;
00099     bool isVisible() const;
00100     virtual bool addTo(QWidget*);
00101     virtual bool removeFrom(QWidget*);
00102 
00103 protected:
00104     virtual void addedTo(QWidget *actionWidget, QWidget *container);
00105     virtual void addedTo(int index, Q3PopupMenu *menu);
00106 
00107 public Q_SLOTS:
00108     void activate();
00109     void toggle();
00110     virtual void setOn(bool);
00111     virtual void setEnabled(bool);
00112     void setDisabled(bool);
00113     virtual void setVisible(bool);
00114 
00115 Q_SIGNALS:
00116     void activated();
00117     void toggled(bool);
00118 
00119 private Q_SLOTS:
00120     void internalActivation();
00121     void toolButtonToggled(bool);
00122     void objectDestroyed();
00123     void menuStatusText(int id);
00124     void showStatusText(const QString&);
00125     void clearStatusText();
00126 
00127 private:
00128     Q_DISABLE_COPY(Q3Action)
00129 
00130     void init();
00131 
00132     Q3ActionPrivate* d;
00133 
00134     friend class Q3ActionPrivate;
00135     friend class Q3ActionGroup;
00136     friend class Q3ActionGroupPrivate;
00137 };
00138 
00139 class Q_COMPAT_EXPORT Q3ActionGroup : public Q3Action
00140 {
00141     Q_OBJECT
00142     Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive)
00143     Q_PROPERTY(bool usesDropDown READ usesDropDown WRITE setUsesDropDown)
00144 
00145 public:
00146     Q3ActionGroup(QObject* parent, const char* name = 0);
00147     Q3ActionGroup(QObject* parent, const char* name , bool exclusive ); // obsolete
00148     ~Q3ActionGroup();
00149     void setExclusive(bool);
00150     bool isExclusive() const;
00151     void add(Q3Action* a);
00152     void addSeparator();
00153     bool addTo(QWidget*);
00154     bool removeFrom(QWidget*);
00155     void setEnabled(bool);
00156     void setToggleAction(bool toggle);
00157     void setOn(bool on);
00158     void setVisible(bool);
00159 
00160     void setUsesDropDown(bool enable);
00161     bool usesDropDown() const;
00162 
00163     void setIconSet(const QIcon &);
00164     void setText(const QString&);
00165     void setMenuText(const QString&);
00166     void setToolTip(const QString&);
00167     void setWhatsThis(const QString&);
00168 
00169 protected:
00170     void childEvent(QChildEvent*);
00171     virtual void addedTo(QWidget *actionWidget, QWidget *container, Q3Action *a);
00172     virtual void addedTo(int index, Q3PopupMenu *menu, Q3Action *a);
00173     virtual void addedTo(QWidget *actionWidget, QWidget *container);
00174     virtual void addedTo(int index, Q3PopupMenu *menu);
00175 
00176 Q_SIGNALS:
00177     void selected(Q3Action*);
00178     void activated(Q3Action *);
00179 
00180 private Q_SLOTS:
00181     void childToggled(bool);
00182     void childActivated();
00183     void childDestroyed();
00184     void internalComboBoxActivated(int);
00185     void internalComboBoxHighlighted(int);
00186     void internalToggle(Q3Action*);
00187     void objectDestroyed();
00188 
00189 private:
00190     Q3ActionGroupPrivate* d;
00191 
00192 public:
00193     void insert(Q3Action *a) { add(a); }
00194 
00195 private:
00196     Q_DISABLE_COPY(Q3ActionGroup)
00197 };
00198 
00199 #endif // QT_NO_ACTION
00200 
00201 QT_END_HEADER
00202 
00203 #endif // Q3ACTION_H

Generated on Thu Mar 15 11:59:30 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1