src/gui/kernel/qevent.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 QtGui 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 QEVENT_H
00025 #define QEVENT_H
00026 
00027 #include <QtGui/qwindowdefs.h>
00028 #include <QtCore/qobject.h>
00029 #include <QtGui/qregion.h>
00030 #include <QtCore/qnamespace.h>
00031 #include <QtCore/qstring.h>
00032 #include <QtGui/qkeysequence.h>
00033 #include <QtCore/qcoreevent.h>
00034 #include <QtGui/qmime.h>
00035 #include <QtGui/qdrag.h>
00036 #include <QtCore/qvariant.h>
00037 
00038 QT_BEGIN_HEADER
00039 
00040 QT_MODULE(Gui)
00041 
00042 class QAction;
00043 
00044 class Q_GUI_EXPORT QInputEvent : public QEvent
00045 {
00046 public:
00047     QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
00048     ~QInputEvent();
00049     inline Qt::KeyboardModifiers modifiers() const { return modState; }
00050 protected:
00051     Qt::KeyboardModifiers modState;
00052 };
00053 
00054 class Q_GUI_EXPORT QMouseEvent : public QInputEvent
00055 {
00056 public:
00057     QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button,
00058                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
00059     QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
00060                 Qt::MouseButton button, Qt::MouseButtons buttons,
00061                 Qt::KeyboardModifiers modifiers);
00062     ~QMouseEvent();
00063 
00064     inline const QPoint &pos() const { return p; }
00065     inline const QPoint &globalPos() const { return g; }
00066     inline int x() const { return p.x(); }
00067     inline int y() const { return p.y(); }
00068     inline int globalX() const { return g.x(); }
00069     inline int globalY() const { return g.y(); }
00070     inline Qt::MouseButton button() const { return b; }
00071     inline Qt::MouseButtons buttons() const { return mouseState; }
00072 
00073 #ifdef QT3_SUPPORT
00074     QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state);
00075     QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
00076                                       Qt::ButtonState button, int state);
00077     inline QT3_SUPPORT Qt::ButtonState state() const
00078     { return Qt::ButtonState((mouseState^b)|int(modifiers())); }
00079     inline QT3_SUPPORT Qt::ButtonState stateAfter() const
00080     { return Qt::ButtonState(int(mouseState)|int(modifiers())); }
00081 #endif
00082 protected:
00083     QPoint p, g;
00084     Qt::MouseButton b;
00085     Qt::MouseButtons mouseState;
00086 };
00087 
00088 class Q_GUI_EXPORT QHoverEvent : public QEvent
00089 {
00090 public:
00091     QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos);
00092     ~QHoverEvent();
00093 
00094     inline const QPoint &pos() const { return p; }
00095     inline const QPoint &oldPos() const { return op; }
00096 
00097 protected:
00098     QPoint p, op;
00099 };
00100 
00101 #ifndef QT_NO_WHEELEVENT
00102 class Q_GUI_EXPORT QWheelEvent : public QInputEvent
00103 {
00104 public:
00105     QWheelEvent(const QPoint &pos, int delta,
00106                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
00107                 Qt::Orientation orient = Qt::Vertical);
00108     QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
00109                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
00110                 Qt::Orientation orient = Qt::Vertical);
00111     ~QWheelEvent();
00112 
00113     inline int delta() const { return d; }
00114     inline const QPoint &pos() const { return p; }
00115     inline const QPoint &globalPos()   const { return g; }
00116     inline int x() const { return p.x(); }
00117     inline int y() const { return p.y(); }
00118     inline int globalX() const { return g.x(); }
00119     inline int globalY() const { return g.y(); }
00120 
00121     inline Qt::MouseButtons buttons() const { return mouseState; }
00122     Qt::Orientation orientation() const { return o; }
00123 
00124 #ifdef QT3_SUPPORT
00125     QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, int delta, int state,
00126                                       Qt::Orientation orient = Qt::Vertical);
00127     QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state,
00128                                       Qt::Orientation orient = Qt::Vertical);
00129     inline QT3_SUPPORT Qt::ButtonState state() const
00130     { return static_cast<Qt::ButtonState>(int(buttons())|int(modifiers())); }
00131 #endif
00132 protected:
00133     QPoint p;
00134     QPoint g;
00135     int d;
00136     Qt::MouseButtons mouseState;
00137     Qt::Orientation o;
00138 };
00139 #endif
00140 
00141 #ifndef QT_NO_TABLETEVENT
00142 class Q_GUI_EXPORT QTabletEvent : public QInputEvent
00143 {
00144 public:
00145     enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
00146                         XFreeEraser /*internal*/, RotationStylus };
00147     enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
00148     QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos,
00149                  int device, int pointerType, qreal pressure, int xTilt, int yTilt,
00150                  qreal tangentialPressure, qreal rotation, int z,
00151                  Qt::KeyboardModifiers keyState, qint64 uniqueID);
00152     ~QTabletEvent();
00153 
00154     inline const QPoint &pos() const { return mPos; }
00155     inline const QPoint &globalPos() const { return mGPos; }
00156     inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; }
00157     inline int x() const { return mPos.x(); }
00158     inline int y() const { return mPos.y(); }
00159     inline int globalX() const { return mGPos.x(); }
00160     inline int globalY() const { return mGPos.y(); }
00161     inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); }
00162     inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); }
00163     inline TabletDevice device() const { return TabletDevice(mDev); }
00164     inline PointerType pointerType() const { return PointerType(mPointerType); }
00165     inline qint64 uniqueId() const { return mUnique; }
00166     inline qreal pressure() const { return mPress; }
00167     inline int z() const { return mZ; }
00168     inline qreal tangentialPressure() const { return mTangential; }
00169     inline qreal rotation() const { return mRot; }
00170     inline int xTilt() const { return mXT; }
00171     inline int yTilt() const { return mYT; }
00172 
00173 protected:
00174     QPoint mPos, mGPos;
00175     QPointF mHiResGlobalPos;
00176     int mDev, mPointerType, mXT, mYT, mZ;
00177     qreal mPress, mTangential, mRot;
00178     qint64 mUnique;
00179 
00180     // I don't know what the future holds for tablets but there could be some
00181     // new devices coming along, and there seem to be "holes" in the
00182     // OS-specific events for this.
00183     void *mExtra;
00184 };
00185 #endif // QT_NO_TABLETEVENT
00186 
00187 class Q_GUI_EXPORT QKeyEvent : public QInputEvent
00188 {
00189 public:
00190     QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
00191               bool autorep = false, ushort count = 1);
00192     ~QKeyEvent();
00193 
00194     int key() const { return k; }
00195 #ifndef QT_NO_SHORTCUT
00196     bool matches(QKeySequence::StandardKey key) const;
00197 #endif
00198     Qt::KeyboardModifiers modifiers() const;
00199     inline QString text() const { return txt; }
00200     inline bool isAutoRepeat() const { return autor; }
00201     inline int count() const { return int(c); }
00202 
00203     // Functions for the extended key event information
00204     static QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
00205                                              quint32 nativeScanCode, quint32 nativeVirtualKey,
00206                                              quint32 nativeModifiers,
00207                                              const QString& text = QString(), bool autorep = false,
00208                                              ushort count = 1);
00209     inline bool hasExtendedInfo() const { return reinterpret_cast<const QKeyEvent*>(d) == this; }
00210     quint32 nativeScanCode() const;
00211     quint32 nativeVirtualKey() const;
00212     quint32 nativeModifiers() const;
00213 
00214 #ifdef QT3_SUPPORT
00215     inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/,
00216                                            int modifiers, const QString& text = QString(),
00217                                            bool autorep = false, ushort count = 1)
00218         : QInputEvent(type, (Qt::KeyboardModifiers)(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
00219           c(count), autor(autorep)
00220     {
00221         if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast)
00222             ignore();
00223     }
00224     inline QT3_SUPPORT int ascii() const
00225     { return (txt.length() ? txt.unicode()->toLatin1() : 0); }
00226     inline QT3_SUPPORT Qt::ButtonState state() const { return Qt::ButtonState(QInputEvent::modifiers()); }
00227     inline QT3_SUPPORT Qt::ButtonState stateAfter() const { return Qt::ButtonState(modifiers()); }
00228 #endif
00229 
00230 protected:
00231     QString txt;
00232     int k;
00233     ushort c;
00234     uint autor:1;
00235 };
00236 
00237 
00238 class Q_GUI_EXPORT QFocusEvent : public QEvent
00239 {
00240 public:
00241     QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
00242     ~QFocusEvent();
00243 
00244     inline bool gotFocus() const { return type() == FocusIn; }
00245     inline bool lostFocus() const { return type() == FocusOut; }
00246 
00247 #ifdef QT3_SUPPORT
00248     enum Reason { Mouse=Qt::MouseFocusReason, Tab=Qt::TabFocusReason,
00249                   Backtab=Qt::BacktabFocusReason, MenuBar=Qt::MenuBarFocusReason,
00250                   ActiveWindow=Qt::ActiveWindowFocusReason, Other=Qt::OtherFocusReason,
00251                   Popup=Qt::PopupFocusReason, Shortcut=Qt::ShortcutFocusReason };
00252 #endif
00253     Qt::FocusReason reason();
00254     Qt::FocusReason reason() const;
00255 
00256 private:
00257     Qt::FocusReason m_reason;
00258 };
00259 
00260 
00261 class Q_GUI_EXPORT QPaintEvent : public QEvent
00262 {
00263 public:
00264     QPaintEvent(const QRegion& paintRegion);
00265     QPaintEvent(const QRect &paintRect);
00266     ~QPaintEvent();
00267 
00268     inline const QRect &rect() const { return m_rect; }
00269     inline const QRegion &region() const { return m_region; }
00270 
00271 #ifdef QT3_SUPPORT
00272     QT3_SUPPORT_CONSTRUCTOR QPaintEvent(const QRegion &paintRegion, const QRect &paintRect);
00273     inline QT3_SUPPORT bool erased() const { return m_erased; }
00274     inline QT3_SUPPORT void setErased(bool b) { m_erased = b; }
00275 #endif
00276 
00277 protected:
00278     friend class QApplication;
00279     friend class QCoreApplication;
00280     QRect m_rect;
00281     QRegion m_region;
00282     bool m_erased;
00283 };
00284 
00285 class QUpdateLaterEvent : public QEvent
00286 {
00287 public:
00288     QUpdateLaterEvent(const QRegion& paintRegion);
00289     ~QUpdateLaterEvent();
00290 
00291     inline const QRegion &region() const { return m_region; }
00292 
00293 protected:
00294     QRegion m_region;
00295 };
00296 
00297 class Q_GUI_EXPORT QMoveEvent : public QEvent
00298 {
00299 public:
00300     QMoveEvent(const QPoint &pos, const QPoint &oldPos);
00301     ~QMoveEvent();
00302 
00303     inline const QPoint &pos() const { return p; }
00304     inline const QPoint &oldPos() const { return oldp;}
00305 protected:
00306     QPoint p, oldp;
00307     friend class QApplication;
00308     friend class QCoreApplication;
00309 };
00310 
00311 
00312 class Q_GUI_EXPORT QResizeEvent : public QEvent
00313 {
00314 public:
00315     QResizeEvent(const QSize &size, const QSize &oldSize);
00316     ~QResizeEvent();
00317 
00318     inline const QSize &size() const { return s; }
00319     inline const QSize &oldSize()const { return olds;}
00320 protected:
00321     QSize s, olds;
00322     friend class QApplication;
00323     friend class QCoreApplication;
00324 };
00325 
00326 
00327 class Q_GUI_EXPORT QCloseEvent : public QEvent
00328 {
00329 public:
00330     QCloseEvent();
00331     ~QCloseEvent();
00332 };
00333 
00334 
00335 class Q_GUI_EXPORT QIconDragEvent : public QEvent
00336 {
00337 public:
00338     QIconDragEvent();
00339     ~QIconDragEvent();
00340 };
00341 
00342 
00343 class Q_GUI_EXPORT QShowEvent : public QEvent
00344 {
00345 public:
00346     QShowEvent();
00347     ~QShowEvent();
00348 };
00349 
00350 
00351 class Q_GUI_EXPORT QHideEvent : public QEvent
00352 {
00353 public:
00354     QHideEvent();
00355     ~QHideEvent();
00356 };
00357 
00358 class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent
00359 {
00360 public:
00361     enum Reason { Mouse, Keyboard, Other };
00362 
00363     QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos);
00364     QContextMenuEvent(Reason reason, const QPoint &pos);
00365     ~QContextMenuEvent();
00366 
00367     inline int x() const { return p.x(); }
00368     inline int y() const { return p.y(); }
00369     inline int globalX() const { return gp.x(); }
00370     inline int globalY() const { return gp.y(); }
00371 
00372     inline const QPoint& pos() const { return p; }
00373     inline const QPoint& globalPos() const { return gp; }
00374 
00375     inline Reason reason() const { return Reason(reas); }
00376 
00377 #ifdef QT3_SUPPORT
00378     QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, int);
00379     QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, int);
00380 
00381     QT3_SUPPORT Qt::ButtonState state() const;
00382 #endif
00383 protected:
00384     QPoint p;
00385     QPoint gp;
00386     uint reas : 8;
00387 };
00388 
00389 #ifndef QT_NO_INPUTMETHOD
00390 class Q_GUI_EXPORT QInputMethodEvent : public QEvent
00391 {
00392 public:
00393     enum AttributeType {
00394        TextFormat,
00395        Cursor,
00396        Language,
00397        Ruby
00398     };
00399     class Attribute {
00400     public:
00401         Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {}
00402         AttributeType type;
00403 
00404         int start;
00405         int length;
00406         QVariant value;
00407     };
00408     QInputMethodEvent();
00409     QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
00410     void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
00411 
00412     inline const QList<Attribute> &attributes() const { return attrs; }
00413     inline const QString &preeditString() const { return preedit; }
00414 
00415     inline const QString &commitString() const { return commit; }
00416     inline int replacementStart() const { return replace_from; }
00417     inline int replacementLength() const { return replace_length; }
00418 
00419     QInputMethodEvent(const QInputMethodEvent &other);
00420 
00421 private:
00422     QString preedit;
00423     QList<Attribute> attrs;
00424     QString commit;
00425     int replace_from;
00426     int replace_length;
00427 };
00428 #endif // QT_NO_INPUTMETHOD
00429 
00430 #ifndef QT_NO_DRAGANDDROP
00431 
00432 class QMimeData;
00433 
00434 class Q_GUI_EXPORT QDropEvent : public QEvent
00435 // QT3_SUPPORT
00436                               , public QMimeSource
00437 // END QT3_SUPPORT
00438 {
00439 public:
00440     QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
00441                Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
00442     ~QDropEvent();
00443 
00444     inline const QPoint &pos() const { return p; }
00445     inline Qt::MouseButtons mouseButtons() const { return mouseState; }
00446     inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
00447 
00448     inline Qt::DropActions possibleActions() const { return act; }
00449     inline Qt::DropAction proposedAction() const { return default_action; }
00450     inline void acceptProposedAction() { drop_action = default_action; accept(); }
00451 
00452     inline Qt::DropAction dropAction() const { return drop_action; }
00453     void setDropAction(Qt::DropAction action);
00454 
00455     QWidget* source() const;
00456     inline const QMimeData *mimeData() const { return mdata; }
00457 
00458 // QT3_SUPPORT
00459     const char* format(int n = 0) const;
00460     QByteArray encodedData(const char*) const;
00461     bool provides(const char*) const;
00462 // END QT3_SUPPORT
00463 #ifdef QT3_SUPPORT
00464     inline void accept() { QEvent::accept(); }
00465     inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
00466     inline QT3_SUPPORT QByteArray data(const char* f) const { return encodedData(f); }
00467 
00468     enum Action { Copy, Link, Move, Private, UserAction = Private };
00469     QT3_SUPPORT Action action() const;
00470     inline QT3_SUPPORT void acceptAction(bool y = true)  { if (y) { drop_action = default_action; accept(); } }
00471     inline QT3_SUPPORT void setPoint(const QPoint& np) { p = np; }
00472 #endif
00473 
00474 
00475 protected:
00476     friend class QApplication;
00477     QPoint p;
00478     Qt::MouseButtons mouseState;
00479     Qt::KeyboardModifiers modState;
00480     Qt::DropActions act;
00481     Qt::DropAction drop_action;
00482     Qt::DropAction default_action;
00483     const QMimeData *mdata;
00484     mutable QList<QByteArray> fmts; // only used for QT3_SUPPORT
00485 };
00486 
00487 
00488 class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent
00489 {
00490 public:
00491     QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
00492                    Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove);
00493     ~QDragMoveEvent();
00494 
00495     inline QRect answerRect() const { return rect; }
00496 
00497     inline void accept() { QDropEvent::accept(); }
00498     inline void ignore() { QDropEvent::ignore(); }
00499 
00500     inline void accept(const QRect & r) { accept(); rect = r; }
00501     inline void ignore(const QRect & r) { ignore(); rect = r; }
00502 
00503 #ifdef QT3_SUPPORT
00504     inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
00505 #endif
00506 
00507 protected:
00508     friend class QApplication;
00509     QRect rect;
00510 };
00511 
00512 
00513 class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent
00514 {
00515 public:
00516     QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
00517                     Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
00518     ~QDragEnterEvent();
00519 };
00520 
00521 
00522 /* An internal class */
00523 class Q_GUI_EXPORT QDragResponseEvent : public QEvent
00524 {
00525 public:
00526     QDragResponseEvent(bool accepted);
00527     ~QDragResponseEvent();
00528 
00529     inline bool dragAccepted() const { return a; }
00530 protected:
00531     bool a;
00532 };
00533 
00534 
00535 class Q_GUI_EXPORT QDragLeaveEvent : public QEvent
00536 {
00537 public:
00538     QDragLeaveEvent();
00539     ~QDragLeaveEvent();
00540 };
00541 #endif // QT_NO_DRAGANDDROP
00542 
00543 
00544 class Q_GUI_EXPORT QHelpEvent : public QEvent
00545 {
00546 public:
00547     QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos);
00548     ~QHelpEvent();
00549 
00550     inline int x() const { return p.x(); }
00551     inline int y() const { return p.y(); }
00552     inline int globalX() const { return gp.x(); }
00553     inline int globalY() const { return gp.y(); }
00554 
00555     inline const QPoint& pos()  const { return p; }
00556     inline const QPoint& globalPos() const { return gp; }
00557 
00558 private:
00559     QPoint p;
00560     QPoint gp;
00561 };
00562 
00563 #ifndef QT_NO_STATUSTIP
00564 class Q_GUI_EXPORT QStatusTipEvent : public QEvent
00565 {
00566 public:
00567     QStatusTipEvent(const QString &tip);
00568     ~QStatusTipEvent();
00569 
00570     inline QString tip() const { return s; }
00571 private:
00572     QString s;
00573 };
00574 #endif
00575 
00576 #ifndef QT_NO_WHATSTHIS
00577 class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
00578 {
00579 public:
00580     QWhatsThisClickedEvent(const QString &href);
00581     ~QWhatsThisClickedEvent();
00582 
00583     inline QString href() const { return s; }
00584 private:
00585     QString s;
00586 };
00587 #endif
00588 
00589 #ifndef QT_NO_ACTION
00590 class Q_GUI_EXPORT QActionEvent : public QEvent
00591 {
00592     QAction *act, *bef;
00593 public:
00594     QActionEvent(int type, QAction *action, QAction *before = 0);
00595     ~QActionEvent();
00596 
00597     inline QAction *action() const { return act; }
00598     inline QAction *before() const { return bef; }
00599 };
00600 #endif
00601 
00602 class Q_GUI_EXPORT QFileOpenEvent : public QEvent
00603 {
00604 public:
00605     QFileOpenEvent(const QString &file);
00606     ~QFileOpenEvent();
00607 
00608     inline QString file() const { return f; }
00609 private:
00610     QString f;
00611 };
00612 
00613 #ifndef QT_NO_TOOLBAR
00614 class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
00615 {
00616 public:
00617     QToolBarChangeEvent(bool t);
00618     ~QToolBarChangeEvent();
00619 
00620     inline bool toggle() const { return tog; }
00621 private:
00622     uint tog : 1;
00623 };
00624 #endif
00625 
00626 #ifndef QT_NO_SHORTCUT
00627 class Q_GUI_EXPORT QShortcutEvent : public QEvent
00628 {
00629 public:
00630     QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
00631     ~QShortcutEvent();
00632 
00633     inline const QKeySequence &key() { return sequence; }
00634     inline const QKeySequence &key() const { return sequence; }
00635     inline int shortcutId() { return sid; }
00636     inline int shortcutId() const { return sid; }
00637     inline bool isAmbiguous() { return ambig; }
00638     inline bool isAmbiguous() const { return ambig; }
00639 protected:
00640     QKeySequence sequence;
00641     bool ambig;
00642     int  sid;
00643 };
00644 #endif
00645 
00646 #ifndef QT_NO_CLIPBOARD
00647 class Q_GUI_EXPORT QClipboardEvent : public QEvent
00648 {
00649 public:
00650     QClipboardEvent(QEventPrivate *data);
00651     ~QClipboardEvent();
00652 
00653     QEventPrivate *data() { return d; };
00654 };
00655 #endif
00656 
00657 class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
00658 {
00659 public:
00660     QWindowStateChangeEvent(Qt::WindowStates aOldState);
00661     QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
00662     ~QWindowStateChangeEvent();
00663 
00664     inline Qt::WindowStates oldState() const { return ostate; }
00665     bool isOverride() const;
00666 
00667 private:
00668     Qt::WindowStates ostate;
00669 };
00670 
00671 #ifdef QT3_SUPPORT
00672 class QMenuBar;
00673 class Q_GUI_EXPORT QMenubarUpdatedEvent: public QEvent
00674 {
00675 public:
00676     QMenubarUpdatedEvent(QMenuBar * const menBar);
00677     inline QMenuBar *menuBar() { return m_menuBar; }
00678 private:
00679     QMenuBar *m_menuBar;
00680 };
00681 #endif
00682 
00683 #ifndef QT_NO_DEBUG_STREAM
00684 Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
00685 #endif
00686 
00687 #ifndef QT_NO_SHORTCUT
00688 inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);}
00689 inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
00690 #endif // QT_NO_SHORTCUT
00691 
00692 QT_END_HEADER
00693 
00694 #endif // QEVENT_H

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