qevent.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtGui module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QEVENT_H
00043 #define QEVENT_H
00044 
00045 #include <QtGui/qwindowdefs.h>
00046 #include <QtCore/qobject.h>
00047 #include <QtGui/qregion.h>
00048 #include <QtCore/qnamespace.h>
00049 #include <QtCore/qstring.h>
00050 #include <QtGui/qkeysequence.h>
00051 #include <QtCore/qcoreevent.h>
00052 #include <QtGui/qmime.h>
00053 #include <QtGui/qdrag.h>
00054 #include <QtCore/qvariant.h>
00055 #include <QtCore/qmap.h>
00056 #include <QtCore/qset.h>
00057 
00058 QT_BEGIN_HEADER
00059 
00060 QT_BEGIN_NAMESPACE
00061 
00062 QT_MODULE(Gui)
00063 
00064 class QAction;
00065 #ifndef QT_NO_GESTURES
00066 class QGesture;
00067 #endif
00068 
00069 class Q_GUI_EXPORT QInputEvent : public QEvent
00070 {
00071 public:
00072     QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
00073     ~QInputEvent();
00074     inline Qt::KeyboardModifiers modifiers() const { return modState; }
00075     inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
00076 protected:
00077     Qt::KeyboardModifiers modState;
00078 };
00079 
00080 class Q_GUI_EXPORT QMouseEvent : public QInputEvent
00081 {
00082 public:
00083     QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button,
00084                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
00085     QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
00086                 Qt::MouseButton button, Qt::MouseButtons buttons,
00087                 Qt::KeyboardModifiers modifiers);
00088     ~QMouseEvent();
00089 
00090     inline const QPoint &pos() const { return p; }
00091     inline const QPoint &globalPos() const { return g; }
00092     inline int x() const { return p.x(); }
00093     inline int y() const { return p.y(); }
00094     inline int globalX() const { return g.x(); }
00095     inline int globalY() const { return g.y(); }
00096     inline Qt::MouseButton button() const { return b; }
00097     inline Qt::MouseButtons buttons() const { return mouseState; }
00098 
00099     static QMouseEvent *createExtendedMouseEvent(Type type, const QPointF &pos,
00100                                                  const QPoint &globalPos, Qt::MouseButton button,
00101                                                  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
00102     inline bool hasExtendedInfo() const { return reinterpret_cast<const QMouseEvent *>(d) == this; }
00103     QPointF posF() const;
00104 
00105 #ifdef QT3_SUPPORT
00106     QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state);
00107     QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
00108                                       Qt::ButtonState button, int state);
00109     inline QT3_SUPPORT Qt::ButtonState state() const
00110     { return Qt::ButtonState((mouseState^b)|int(modifiers())); }
00111     inline QT3_SUPPORT Qt::ButtonState stateAfter() const
00112     { return Qt::ButtonState(int(mouseState)|int(modifiers())); }
00113 #endif
00114 protected:
00115     QPoint p, g;
00116     Qt::MouseButton b;
00117     Qt::MouseButtons mouseState;
00118 };
00119 
00120 class Q_GUI_EXPORT QHoverEvent : public QEvent
00121 {
00122 public:
00123     QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos);
00124     ~QHoverEvent();
00125 
00126     inline const QPoint &pos() const { return p; }
00127     inline const QPoint &oldPos() const { return op; }
00128 
00129 protected:
00130     QPoint p, op;
00131 };
00132 
00133 #ifndef QT_NO_WHEELEVENT
00134 class Q_GUI_EXPORT QWheelEvent : public QInputEvent
00135 {
00136 public:
00137     QWheelEvent(const QPoint &pos, int delta,
00138                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
00139                 Qt::Orientation orient = Qt::Vertical);
00140     QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
00141                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
00142                 Qt::Orientation orient = Qt::Vertical);
00143     ~QWheelEvent();
00144 
00145     inline int delta() const { return d; }
00146     inline const QPoint &pos() const { return p; }
00147     inline const QPoint &globalPos()   const { return g; }
00148     inline int x() const { return p.x(); }
00149     inline int y() const { return p.y(); }
00150     inline int globalX() const { return g.x(); }
00151     inline int globalY() const { return g.y(); }
00152 
00153     inline Qt::MouseButtons buttons() const { return mouseState; }
00154     Qt::Orientation orientation() const { return o; }
00155 
00156 #ifdef QT3_SUPPORT
00157     QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, int delta, int state,
00158                                       Qt::Orientation orient = Qt::Vertical);
00159     QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state,
00160                                       Qt::Orientation orient = Qt::Vertical);
00161     inline QT3_SUPPORT Qt::ButtonState state() const
00162     { return static_cast<Qt::ButtonState>(int(buttons())|int(modifiers())); }
00163 #endif
00164 protected:
00165     QPoint p;
00166     QPoint g;
00167     int d;
00168     Qt::MouseButtons mouseState;
00169     Qt::Orientation o;
00170 };
00171 #endif
00172 
00173 #ifndef QT_NO_TABLETEVENT
00174 class Q_GUI_EXPORT QTabletEvent : public QInputEvent
00175 {
00176 public:
00177     enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
00178                         XFreeEraser /*internal*/, RotationStylus };
00179     enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
00180     QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos,
00181                  int device, int pointerType, qreal pressure, int xTilt, int yTilt,
00182                  qreal tangentialPressure, qreal rotation, int z,
00183                  Qt::KeyboardModifiers keyState, qint64 uniqueID);
00184     ~QTabletEvent();
00185 
00186     inline const QPoint &pos() const { return mPos; }
00187     inline const QPoint &globalPos() const { return mGPos; }
00188     inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; }
00189     inline int x() const { return mPos.x(); }
00190     inline int y() const { return mPos.y(); }
00191     inline int globalX() const { return mGPos.x(); }
00192     inline int globalY() const { return mGPos.y(); }
00193     inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); }
00194     inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); }
00195     inline TabletDevice device() const { return TabletDevice(mDev); }
00196     inline PointerType pointerType() const { return PointerType(mPointerType); }
00197     inline qint64 uniqueId() const { return mUnique; }
00198     inline qreal pressure() const { return mPress; }
00199     inline int z() const { return mZ; }
00200     inline qreal tangentialPressure() const { return mTangential; }
00201     inline qreal rotation() const { return mRot; }
00202     inline int xTilt() const { return mXT; }
00203     inline int yTilt() const { return mYT; }
00204 
00205 protected:
00206     QPoint mPos, mGPos;
00207     QPointF mHiResGlobalPos;
00208     int mDev, mPointerType, mXT, mYT, mZ;
00209     qreal mPress, mTangential, mRot;
00210     qint64 mUnique;
00211 
00212     // I don't know what the future holds for tablets but there could be some
00213     // new devices coming along, and there seem to be "holes" in the
00214     // OS-specific events for this.
00215     void *mExtra;
00216 };
00217 #endif // QT_NO_TABLETEVENT
00218 
00219 class Q_GUI_EXPORT QKeyEvent : public QInputEvent
00220 {
00221 public:
00222     QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
00223               bool autorep = false, ushort count = 1);
00224     ~QKeyEvent();
00225 
00226     int key() const { return k; }
00227 #ifndef QT_NO_SHORTCUT
00228     bool matches(QKeySequence::StandardKey key) const;
00229 #endif
00230     Qt::KeyboardModifiers modifiers() const;
00231     inline QString text() const { return txt; }
00232     inline bool isAutoRepeat() const { return autor; }
00233     inline int count() const { return int(c); }
00234 
00235     // Functions for the extended key event information
00236     static QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
00237                                              quint32 nativeScanCode, quint32 nativeVirtualKey,
00238                                              quint32 nativeModifiers,
00239                                              const QString& text = QString(), bool autorep = false,
00240                                              ushort count = 1);
00241     inline bool hasExtendedInfo() const { return reinterpret_cast<const QKeyEvent*>(d) == this; }
00242     quint32 nativeScanCode() const;
00243     quint32 nativeVirtualKey() const;
00244     quint32 nativeModifiers() const;
00245 
00246 #ifdef QT3_SUPPORT
00247     inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/,
00248                                            int modifiers, const QString& text = QString(),
00249                                            bool autorep = false, ushort count = 1)
00250         : QInputEvent(type, Qt::KeyboardModifiers(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
00251           c(count), autor(autorep)
00252     {
00253         if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast)
00254             ignore();
00255     }
00256     inline QT3_SUPPORT int ascii() const
00257     { return (txt.length() ? txt.unicode()->toLatin1() : 0); }
00258     inline QT3_SUPPORT Qt::ButtonState state() const { return Qt::ButtonState(QInputEvent::modifiers()); }
00259     inline QT3_SUPPORT Qt::ButtonState stateAfter() const { return Qt::ButtonState(modifiers()); }
00260 #endif
00261 
00262 protected:
00263     QString txt;
00264     int k;
00265     ushort c;
00266     uint autor:1;
00267 };
00268 
00269 
00270 class Q_GUI_EXPORT QFocusEvent : public QEvent
00271 {
00272 public:
00273     QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
00274     ~QFocusEvent();
00275 
00276     inline bool gotFocus() const { return type() == FocusIn; }
00277     inline bool lostFocus() const { return type() == FocusOut; }
00278 
00279 #ifdef QT3_SUPPORT
00280     enum Reason { Mouse=Qt::MouseFocusReason, Tab=Qt::TabFocusReason,
00281                   Backtab=Qt::BacktabFocusReason, MenuBar=Qt::MenuBarFocusReason,
00282                   ActiveWindow=Qt::ActiveWindowFocusReason, Other=Qt::OtherFocusReason,
00283                   Popup=Qt::PopupFocusReason, Shortcut=Qt::ShortcutFocusReason };
00284 #endif
00285     Qt::FocusReason reason();
00286     Qt::FocusReason reason() const;
00287 
00288 private:
00289     Qt::FocusReason m_reason;
00290 };
00291 
00292 
00293 class Q_GUI_EXPORT QPaintEvent : public QEvent
00294 {
00295 public:
00296     QPaintEvent(const QRegion& paintRegion);
00297     QPaintEvent(const QRect &paintRect);
00298     ~QPaintEvent();
00299 
00300     inline const QRect &rect() const { return m_rect; }
00301     inline const QRegion &region() const { return m_region; }
00302 
00303 #ifdef QT3_SUPPORT
00304     QT3_SUPPORT_CONSTRUCTOR QPaintEvent(const QRegion &paintRegion, const QRect &paintRect);
00305     inline QT3_SUPPORT bool erased() const { return m_erased; }
00306     inline QT3_SUPPORT void setErased(bool b) { m_erased = b; }
00307 #endif
00308 
00309 protected:
00310     friend class QApplication;
00311     friend class QCoreApplication;
00312     QRect m_rect;
00313     QRegion m_region;
00314     bool m_erased;
00315 };
00316 
00317 class QUpdateLaterEvent : public QEvent
00318 {
00319 public:
00320     QUpdateLaterEvent(const QRegion& paintRegion);
00321     ~QUpdateLaterEvent();
00322 
00323     inline const QRegion &region() const { return m_region; }
00324 
00325 protected:
00326     QRegion m_region;
00327 };
00328 
00329 class Q_GUI_EXPORT QMoveEvent : public QEvent
00330 {
00331 public:
00332     QMoveEvent(const QPoint &pos, const QPoint &oldPos);
00333     ~QMoveEvent();
00334 
00335     inline const QPoint &pos() const { return p; }
00336     inline const QPoint &oldPos() const { return oldp;}
00337 protected:
00338     QPoint p, oldp;
00339     friend class QApplication;
00340     friend class QCoreApplication;
00341 };
00342 
00343 
00344 class Q_GUI_EXPORT QResizeEvent : public QEvent
00345 {
00346 public:
00347     QResizeEvent(const QSize &size, const QSize &oldSize);
00348     ~QResizeEvent();
00349 
00350     inline const QSize &size() const { return s; }
00351     inline const QSize &oldSize()const { return olds;}
00352 protected:
00353     QSize s, olds;
00354     friend class QApplication;
00355     friend class QCoreApplication;
00356 };
00357 
00358 
00359 class Q_GUI_EXPORT QCloseEvent : public QEvent
00360 {
00361 public:
00362     QCloseEvent();
00363     ~QCloseEvent();
00364 };
00365 
00366 
00367 class Q_GUI_EXPORT QIconDragEvent : public QEvent
00368 {
00369 public:
00370     QIconDragEvent();
00371     ~QIconDragEvent();
00372 };
00373 
00374 
00375 class Q_GUI_EXPORT QShowEvent : public QEvent
00376 {
00377 public:
00378     QShowEvent();
00379     ~QShowEvent();
00380 };
00381 
00382 
00383 class Q_GUI_EXPORT QHideEvent : public QEvent
00384 {
00385 public:
00386     QHideEvent();
00387     ~QHideEvent();
00388 };
00389 
00390 #ifndef QT_NO_CONTEXTMENU
00391 class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent
00392 {
00393 public:
00394     enum Reason { Mouse, Keyboard, Other };
00395 
00396     QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
00397                       Qt::KeyboardModifiers modifiers);
00398     QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos);
00399     QContextMenuEvent(Reason reason, const QPoint &pos);
00400     ~QContextMenuEvent();
00401 
00402     inline int x() const { return p.x(); }
00403     inline int y() const { return p.y(); }
00404     inline int globalX() const { return gp.x(); }
00405     inline int globalY() const { return gp.y(); }
00406 
00407     inline const QPoint& pos() const { return p; }
00408     inline const QPoint& globalPos() const { return gp; }
00409 
00410     inline Reason reason() const { return Reason(reas); }
00411 
00412 #ifdef QT3_SUPPORT
00413     QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, int);
00414     QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, int);
00415 
00416     QT3_SUPPORT Qt::ButtonState state() const;
00417 #endif
00418 protected:
00419     QPoint p;
00420     QPoint gp;
00421     uint reas : 8;
00422 };
00423 #endif // QT_NO_CONTEXTMENU
00424 
00425 #ifndef QT_NO_INPUTMETHOD
00426 class Q_GUI_EXPORT QInputMethodEvent : public QEvent
00427 {
00428 public:
00429     enum AttributeType {
00430        TextFormat,
00431        Cursor,
00432        Language,
00433        Ruby,
00434        Selection
00435     };
00436     class Attribute {
00437     public:
00438         Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {}
00439         AttributeType type;
00440 
00441         int start;
00442         int length;
00443         QVariant value;
00444     };
00445     QInputMethodEvent();
00446     QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
00447     void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
00448 
00449     inline const QList<Attribute> &attributes() const { return attrs; }
00450     inline const QString &preeditString() const { return preedit; }
00451 
00452     inline const QString &commitString() const { return commit; }
00453     inline int replacementStart() const { return replace_from; }
00454     inline int replacementLength() const { return replace_length; }
00455 
00456     QInputMethodEvent(const QInputMethodEvent &other);
00457 
00458 private:
00459     QString preedit;
00460     QList<Attribute> attrs;
00461     QString commit;
00462     int replace_from;
00463     int replace_length;
00464 };
00465 #endif // QT_NO_INPUTMETHOD
00466 
00467 #ifndef QT_NO_DRAGANDDROP
00468 
00469 class QMimeData;
00470 
00471 class Q_GUI_EXPORT QDropEvent : public QEvent
00472 // QT3_SUPPORT
00473                               , public QMimeSource
00474 // END QT3_SUPPORT
00475 {
00476 public:
00477     QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
00478                Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
00479     ~QDropEvent();
00480 
00481     inline const QPoint &pos() const { return p; }
00482     inline Qt::MouseButtons mouseButtons() const { return mouseState; }
00483     inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
00484 
00485     inline Qt::DropActions possibleActions() const { return act; }
00486     inline Qt::DropAction proposedAction() const { return default_action; }
00487     inline void acceptProposedAction() { drop_action = default_action; accept(); }
00488 
00489     inline Qt::DropAction dropAction() const { return drop_action; }
00490     void setDropAction(Qt::DropAction action);
00491 
00492     QWidget* source() const;
00493     inline const QMimeData *mimeData() const { return mdata; }
00494 
00495 // QT3_SUPPORT
00496     const char* format(int n = 0) const;
00497     QByteArray encodedData(const char*) const;
00498     bool provides(const char*) const;
00499 // END QT3_SUPPORT
00500 #ifdef QT3_SUPPORT
00501     inline void accept() { QEvent::accept(); }
00502     inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
00503     inline QT3_SUPPORT QByteArray data(const char* f) const { return encodedData(f); }
00504 
00505     enum Action { Copy, Link, Move, Private, UserAction = Private };
00506     QT3_SUPPORT Action action() const;
00507     inline QT3_SUPPORT void acceptAction(bool y = true)  { if (y) { drop_action = default_action; accept(); } }
00508     inline QT3_SUPPORT void setPoint(const QPoint& np) { p = np; }
00509 #endif
00510 
00511 
00512 protected:
00513     friend class QApplication;
00514     QPoint p;
00515     Qt::MouseButtons mouseState;
00516     Qt::KeyboardModifiers modState;
00517     Qt::DropActions act;
00518     Qt::DropAction drop_action;
00519     Qt::DropAction default_action;
00520     const QMimeData *mdata;
00521     mutable QList<QByteArray> fmts; // only used for QT3_SUPPORT
00522 };
00523 
00524 
00525 class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent
00526 {
00527 public:
00528     QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
00529                    Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove);
00530     ~QDragMoveEvent();
00531 
00532     inline QRect answerRect() const { return rect; }
00533 
00534     inline void accept() { QDropEvent::accept(); }
00535     inline void ignore() { QDropEvent::ignore(); }
00536 
00537     inline void accept(const QRect & r) { accept(); rect = r; }
00538     inline void ignore(const QRect & r) { ignore(); rect = r; }
00539 
00540 #ifdef QT3_SUPPORT
00541     inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
00542 #endif
00543 
00544 protected:
00545     friend class QApplication;
00546     QRect rect;
00547 };
00548 
00549 
00550 class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent
00551 {
00552 public:
00553     QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
00554                     Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
00555     ~QDragEnterEvent();
00556 };
00557 
00558 
00559 /* An internal class */
00560 class Q_GUI_EXPORT QDragResponseEvent : public QEvent
00561 {
00562 public:
00563     QDragResponseEvent(bool accepted);
00564     ~QDragResponseEvent();
00565 
00566     inline bool dragAccepted() const { return a; }
00567 protected:
00568     bool a;
00569 };
00570 
00571 
00572 class Q_GUI_EXPORT QDragLeaveEvent : public QEvent
00573 {
00574 public:
00575     QDragLeaveEvent();
00576     ~QDragLeaveEvent();
00577 };
00578 #endif // QT_NO_DRAGANDDROP
00579 
00580 
00581 class Q_GUI_EXPORT QHelpEvent : public QEvent
00582 {
00583 public:
00584     QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos);
00585     ~QHelpEvent();
00586 
00587     inline int x() const { return p.x(); }
00588     inline int y() const { return p.y(); }
00589     inline int globalX() const { return gp.x(); }
00590     inline int globalY() const { return gp.y(); }
00591 
00592     inline const QPoint& pos()  const { return p; }
00593     inline const QPoint& globalPos() const { return gp; }
00594 
00595 private:
00596     QPoint p;
00597     QPoint gp;
00598 };
00599 
00600 #ifndef QT_NO_STATUSTIP
00601 class Q_GUI_EXPORT QStatusTipEvent : public QEvent
00602 {
00603 public:
00604     QStatusTipEvent(const QString &tip);
00605     ~QStatusTipEvent();
00606 
00607     inline QString tip() const { return s; }
00608 private:
00609     QString s;
00610 };
00611 #endif
00612 
00613 #ifndef QT_NO_WHATSTHIS
00614 class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
00615 {
00616 public:
00617     QWhatsThisClickedEvent(const QString &href);
00618     ~QWhatsThisClickedEvent();
00619 
00620     inline QString href() const { return s; }
00621 private:
00622     QString s;
00623 };
00624 #endif
00625 
00626 #ifndef QT_NO_ACTION
00627 class Q_GUI_EXPORT QActionEvent : public QEvent
00628 {
00629     QAction *act, *bef;
00630 public:
00631     QActionEvent(int type, QAction *action, QAction *before = 0);
00632     ~QActionEvent();
00633 
00634     inline QAction *action() const { return act; }
00635     inline QAction *before() const { return bef; }
00636 };
00637 #endif
00638 
00639 class Q_GUI_EXPORT QFileOpenEvent : public QEvent
00640 {
00641 public:
00642     QFileOpenEvent(const QString &file);
00643     QFileOpenEvent(const QUrl &url);
00644     ~QFileOpenEvent();
00645 
00646     inline QString file() const { return f; }
00647     QUrl url() const;
00648 private:
00649     QString f;
00650 };
00651 
00652 #ifndef QT_NO_TOOLBAR
00653 class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
00654 {
00655 public:
00656     QToolBarChangeEvent(bool t);
00657     ~QToolBarChangeEvent();
00658 
00659     inline bool toggle() const { return tog; }
00660 private:
00661     uint tog : 1;
00662 };
00663 #endif
00664 
00665 #ifndef QT_NO_SHORTCUT
00666 class Q_GUI_EXPORT QShortcutEvent : public QEvent
00667 {
00668 public:
00669     QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
00670     ~QShortcutEvent();
00671 
00672     inline const QKeySequence &key() { return sequence; }
00673     inline const QKeySequence &key() const { return sequence; }
00674     inline int shortcutId() { return sid; }
00675     inline int shortcutId() const { return sid; }
00676     inline bool isAmbiguous() { return ambig; }
00677     inline bool isAmbiguous() const { return ambig; }
00678 protected:
00679     QKeySequence sequence;
00680     bool ambig;
00681     int  sid;
00682 };
00683 #endif
00684 
00685 #ifndef QT_NO_CLIPBOARD
00686 class Q_GUI_EXPORT QClipboardEvent : public QEvent
00687 {
00688 public:
00689     QClipboardEvent(QEventPrivate *data);
00690     ~QClipboardEvent();
00691 
00692     QEventPrivate *data() { return d; }
00693 };
00694 #endif
00695 
00696 class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
00697 {
00698 public:
00699     QWindowStateChangeEvent(Qt::WindowStates aOldState);
00700     QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
00701     ~QWindowStateChangeEvent();
00702 
00703     inline Qt::WindowStates oldState() const { return ostate; }
00704     bool isOverride() const;
00705 
00706 private:
00707     Qt::WindowStates ostate;
00708 };
00709 
00710 #ifdef QT3_SUPPORT
00711 class QMenuBar;
00712 class Q_GUI_EXPORT QMenubarUpdatedEvent: public QEvent
00713 {
00714 public:
00715     QMenubarUpdatedEvent(QMenuBar * const menBar);
00716     inline QMenuBar *menuBar() { return m_menuBar; }
00717 private:
00718     QMenuBar *m_menuBar;
00719 };
00720 #endif
00721 
00722 #ifndef QT_NO_DEBUG_STREAM
00723 Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
00724 #endif
00725 
00726 #ifndef QT_NO_SHORTCUT
00727 inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);}
00728 inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
00729 #endif // QT_NO_SHORTCUT
00730 
00731 class QTouchEventTouchPointPrivate;
00732 class Q_GUI_EXPORT QTouchEvent : public QInputEvent
00733 {
00734 public:
00735     class Q_GUI_EXPORT TouchPoint
00736     {
00737     public:
00738         TouchPoint(int id = -1);
00739         TouchPoint(const QTouchEvent::TouchPoint &other);
00740         ~TouchPoint();
00741 
00742         int id() const;
00743 
00744         Qt::TouchPointState state() const;
00745         bool isPrimary() const;
00746 
00747         QPointF pos() const;
00748         QPointF startPos() const;
00749         QPointF lastPos() const;
00750 
00751         QPointF scenePos() const;
00752         QPointF startScenePos() const;
00753         QPointF lastScenePos() const;
00754 
00755         QPointF screenPos() const;
00756         QPointF startScreenPos() const;
00757         QPointF lastScreenPos() const;
00758 
00759         QPointF normalizedPos() const;
00760         QPointF startNormalizedPos() const;
00761         QPointF lastNormalizedPos() const;
00762 
00763         QRectF rect() const;
00764         QRectF sceneRect() const;
00765         QRectF screenRect() const;
00766 
00767         qreal pressure() const;
00768 
00769         // internal
00770         void setId(int id);
00771         void setState(Qt::TouchPointStates state);
00772         void setPos(const QPointF &pos);
00773         void setScenePos(const QPointF &scenePos);
00774         void setScreenPos(const QPointF &screenPos);
00775         void setNormalizedPos(const QPointF &normalizedPos);
00776         void setStartPos(const QPointF &startPos);
00777         void setStartScenePos(const QPointF &startScenePos);
00778         void setStartScreenPos(const QPointF &startScreenPos);
00779         void setStartNormalizedPos(const QPointF &startNormalizedPos);
00780         void setLastPos(const QPointF &lastPos);
00781         void setLastScenePos(const QPointF &lastScenePos);
00782         void setLastScreenPos(const QPointF &lastScreenPos);
00783         void setLastNormalizedPos(const QPointF &lastNormalizedPos);
00784         void setRect(const QRectF &rect);
00785         void setSceneRect(const QRectF &sceneRect);
00786         void setScreenRect(const QRectF &screenRect);
00787         void setPressure(qreal pressure);
00788         QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other);
00789 
00790     private:
00791         QTouchEventTouchPointPrivate *d;
00792         friend class QApplication;
00793         friend class QApplicationPrivate;
00794     };
00795 
00796     enum DeviceType {
00797         TouchScreen,
00798         TouchPad
00799     };
00800 
00801     QTouchEvent(QEvent::Type eventType,
00802                 QTouchEvent::DeviceType deviceType = TouchScreen,
00803                 Qt::KeyboardModifiers modifiers = Qt::NoModifier,
00804                 Qt::TouchPointStates touchPointStates = 0,
00805                 const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
00806     ~QTouchEvent();
00807 
00808     inline QWidget *widget() const { return _widget; }
00809     inline QTouchEvent::DeviceType deviceType() const { return _deviceType; }
00810     inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
00811     inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
00812 
00813     // internal
00814     inline void setWidget(QWidget *awidget) { _widget = awidget; }
00815     inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; }
00816     inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
00817     inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
00818 
00819 protected:
00820     QWidget *_widget;
00821     QTouchEvent::DeviceType _deviceType;
00822     Qt::TouchPointStates _touchPointStates;
00823     QList<QTouchEvent::TouchPoint> _touchPoints;
00824 
00825     friend class QApplication;
00826     friend class QApplicationPrivate;
00827 };
00828 
00829 #ifndef QT_NO_GESTURES
00830 class QGesture;
00831 class QGestureEventPrivate;
00832 class Q_GUI_EXPORT QGestureEvent : public QEvent
00833 {
00834 public:
00835     QGestureEvent(const QList<QGesture *> &gestures);
00836     ~QGestureEvent();
00837 
00838     QList<QGesture *> gestures() const;
00839     QGesture *gesture(Qt::GestureType type) const;
00840 
00841     QList<QGesture *> activeGestures() const;
00842     QList<QGesture *> canceledGestures() const;
00843 
00844 #ifdef Q_NO_USING_KEYWORD
00845     inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); }
00846     inline bool isAccepted() const { return QEvent::isAccepted(); }
00847 
00848     inline void accept() { QEvent::accept(); }
00849     inline void ignore() { QEvent::ignore(); }
00850 #else
00851     using QEvent::setAccepted;
00852     using QEvent::isAccepted;
00853     using QEvent::accept;
00854     using QEvent::ignore;
00855 #endif
00856 
00857     void setAccepted(QGesture *, bool);
00858     void accept(QGesture *);
00859     void ignore(QGesture *);
00860     bool isAccepted(QGesture *) const;
00861 
00862     void setAccepted(Qt::GestureType, bool);
00863     void accept(Qt::GestureType);
00864     void ignore(Qt::GestureType);
00865     bool isAccepted(Qt::GestureType) const;
00866 
00867     void setWidget(QWidget *widget);
00868     QWidget *widget() const;
00869 
00870 #ifndef QT_NO_GRAPHICSVIEW
00871     QPointF mapToGraphicsScene(const QPointF &gesturePoint) const;
00872 #endif
00873 
00874 private:
00875     QGestureEventPrivate *d_func();
00876     const QGestureEventPrivate *d_func() const;
00877 
00878     friend class QApplication;
00879     friend class QGestureManager;
00880 };
00881 #endif // QT_NO_GESTURES
00882 
00883 QT_END_NAMESPACE
00884 
00885 QT_END_HEADER
00886 
00887 #endif // QEVENT_H