Remove deprecation tags from QWheelEvent.
[profile/ivi/qtbase.git] / src / gui / kernel / qevent.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QEVENT_H
43 #define QEVENT_H
44
45 #include <QtGui/qwindowdefs.h>
46 #include <QtCore/qobject.h>
47 #include <QtGui/qregion.h>
48 #include <QtCore/qnamespace.h>
49 #include <QtCore/qstring.h>
50 #include <QtGui/qkeysequence.h>
51 #include <QtCore/qcoreevent.h>
52 #include <QtCore/qvariant.h>
53 #include <QtCore/qmap.h>
54 #include <QtCore/qvector.h>
55 #include <QtCore/qset.h>
56 #include <QtCore/qfile.h>
57 #include <QtGui/qvector2d.h>
58 #include <QtGui/qtouchdevice.h>
59
60 QT_BEGIN_HEADER
61
62 QT_BEGIN_NAMESPACE
63
64
65 class QAction;
66 #ifndef QT_NO_GESTURES
67 class QGesture;
68 #endif
69 class QScreen;
70
71 class Q_GUI_EXPORT QInputEvent : public QEvent
72 {
73 public:
74     explicit QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
75     ~QInputEvent();
76     inline Qt::KeyboardModifiers modifiers() const { return modState; }
77     inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
78     inline ulong timestamp() const { return ts; }
79     inline void setTimestamp(ulong atimestamp) { ts = atimestamp; }
80 protected:
81     Qt::KeyboardModifiers modState;
82     ulong ts;
83 };
84
85 class Q_GUI_EXPORT QMouseEvent : public QInputEvent
86 {
87 public:
88     QMouseEvent(Type type, const QPointF &pos, Qt::MouseButton button,
89                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
90     QMouseEvent(Type type, const QPointF &pos, const QPointF &globalPos,
91                 Qt::MouseButton button, Qt::MouseButtons buttons,
92                 Qt::KeyboardModifiers modifiers);
93     QMouseEvent(Type type, const QPointF &pos, const QPointF &windowPos, const QPointF &globalPos,
94                 Qt::MouseButton button, Qt::MouseButtons buttons,
95                 Qt::KeyboardModifiers modifiers);
96     ~QMouseEvent();
97
98 #ifndef QT_NO_INTEGER_EVENT_COORDINATES
99     inline QPoint pos() const { return l.toPoint(); }
100     inline QPoint globalPos() const { return s.toPoint(); }
101     inline int x() const { return qRound(l.x()); }
102     inline int y() const { return qRound(l.y()); }
103     inline int globalX() const { return qRound(s.x()); }
104     inline int globalY() const { return qRound(s.y()); }
105 #endif
106     const QPointF &localPos() const { return l; }
107     const QPointF &windowPos() const { return w; }
108     const QPointF &screenPos() const { return s; }
109
110     inline Qt::MouseButton button() const { return b; }
111     inline Qt::MouseButtons buttons() const { return mouseState; }
112
113 #if QT_DEPRECATED_SINCE(5, 0)
114     QT_DEPRECATED inline QPointF posF() const { return l; }
115 #endif
116
117 protected:
118     QPointF l, w, s;
119     Qt::MouseButton b;
120     Qt::MouseButtons mouseState;
121 };
122
123 class Q_GUI_EXPORT QHoverEvent : public QInputEvent
124 {
125 public:
126     QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
127     ~QHoverEvent();
128
129 #ifndef QT_NO_INTEGER_EVENT_COORDINATES
130     inline QPoint pos() const { return p.toPoint(); }
131     inline QPoint oldPos() const { return op.toPoint(); }
132 #endif
133
134     inline const QPointF &posF() const { return p; }
135     inline const QPointF &oldPosF() const { return op; }
136
137 protected:
138     QPointF p, op;
139 };
140
141 #ifndef QT_NO_WHEELEVENT
142 class Q_GUI_EXPORT QWheelEvent : public QInputEvent
143 {
144 public:
145     QWheelEvent(const QPointF &pos, int delta,
146                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
147                 Qt::Orientation orient = Qt::Vertical);
148     QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
149                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
150                 Qt::Orientation orient = Qt::Vertical);
151     QWheelEvent(const QPointF &pos, const QPointF& globalPos,
152                 QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
153                 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
154
155     ~QWheelEvent();
156
157
158     inline QPoint pixelDelta() const { return pixelD; }
159     inline QPoint angleDelta() const { return angleD; }
160
161     inline int delta() const  { return qt4D; }
162     inline Qt::Orientation orientation() const { return qt4O; }
163
164 #ifndef QT_NO_INTEGER_EVENT_COORDINATES
165     inline QPoint pos() const { return p.toPoint(); }
166     inline QPoint globalPos()   const { return g.toPoint(); }
167     inline int x() const { return p.x(); }
168     inline int y() const { return p.y(); }
169     inline int globalX() const { return g.x(); }
170     inline int globalY() const { return g.y(); }
171 #endif
172     inline const QPointF &posF() const { return p; }
173     inline const QPointF &globalPosF()   const { return g; }
174
175     inline Qt::MouseButtons buttons() const { return mouseState; }
176 protected:
177     QPointF p;
178     QPointF g;
179     QPoint pixelD;
180     QPoint angleD;
181     int qt4D;
182     Qt::Orientation qt4O;
183     Qt::MouseButtons mouseState;
184     int reserved;
185 };
186 #endif
187
188 #ifndef QT_NO_TABLETEVENT
189 class Q_GUI_EXPORT QTabletEvent : public QInputEvent
190 {
191 public:
192     enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
193                         XFreeEraser /*internal*/, RotationStylus };
194     enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
195     QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
196                  int device, int pointerType, qreal pressure, int xTilt, int yTilt,
197                  qreal tangentialPressure, qreal rotation, int z,
198                  Qt::KeyboardModifiers keyState, qint64 uniqueID);
199     ~QTabletEvent();
200
201     inline const QPoint pos() const { return mPos.toPoint(); }
202     inline const QPoint globalPos() const { return mGPos.toPoint(); }
203 #if QT_DEPRECATED_SINCE(5,0)
204     QT_DEPRECATED inline const QPointF &hiResGlobalPos() const { return mPos; }
205 #endif
206
207     inline const QPointF &posF() const { return mPos; }
208     inline const QPointF &globalPosF() const { return mGPos; }
209
210     inline int x() const { return qRound(mPos.x()); }
211     inline int y() const { return qRound(mPos.y()); }
212     inline int globalX() const { return qRound(mGPos.x()); }
213     inline int globalY() const { return qRound(mGPos.y()); }
214     inline qreal hiResGlobalX() const { return mGPos.x(); }
215     inline qreal hiResGlobalY() const { return mGPos.y(); }
216     inline TabletDevice device() const { return TabletDevice(mDev); }
217     inline PointerType pointerType() const { return PointerType(mPointerType); }
218     inline qint64 uniqueId() const { return mUnique; }
219     inline qreal pressure() const { return mPress; }
220     inline int z() const { return mZ; }
221     inline qreal tangentialPressure() const { return mTangential; }
222     inline qreal rotation() const { return mRot; }
223     inline int xTilt() const { return mXT; }
224     inline int yTilt() const { return mYT; }
225
226 protected:
227     QPointF mPos, mGPos;
228     int mDev, mPointerType, mXT, mYT, mZ;
229     qreal mPress, mTangential, mRot;
230     qint64 mUnique;
231
232     // I don't know what the future holds for tablets but there could be some
233     // new devices coming along, and there seem to be "holes" in the
234     // OS-specific events for this.
235     void *mExtra;
236 };
237 #endif // QT_NO_TABLETEVENT
238
239 class Q_GUI_EXPORT QKeyEvent : public QInputEvent
240 {
241 public:
242     QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
243               bool autorep = false, ushort count = 1);
244     QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
245               quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
246               const QString &text = QString(), bool autorep = false, ushort count = 1);
247     ~QKeyEvent();
248
249     int key() const { return k; }
250 #ifndef QT_NO_SHORTCUT
251     bool matches(QKeySequence::StandardKey key) const;
252 #endif
253     Qt::KeyboardModifiers modifiers() const;
254     inline QString text() const { return txt; }
255     inline bool isAutoRepeat() const { return autor; }
256     inline int count() const { return int(c); }
257
258     inline quint32 nativeScanCode() const { return nScanCode; }
259     inline quint32 nativeVirtualKey() const { return nVirtualKey; }
260     inline quint32 nativeModifiers() const { return nModifiers; }
261
262     // Functions for the extended key event information
263 #if QT_DEPRECATED_SINCE(5, 0)
264     static inline QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
265                                              quint32 nativeScanCode, quint32 nativeVirtualKey,
266                                              quint32 nativeModifiers,
267                                              const QString& text = QString(), bool autorep = false,
268                                              ushort count = 1)
269     {
270         return new QKeyEvent(type, key, modifiers,
271                              nativeScanCode, nativeVirtualKey, nativeModifiers,
272                              text, autorep, count);
273     }
274
275     inline bool hasExtendedInfo() const { return true; }
276 #endif
277
278 protected:
279     QString txt;
280     int k;
281     quint32 nScanCode;
282     quint32 nVirtualKey;
283     quint32 nModifiers;
284     ushort c;
285     ushort autor:1;
286     // ushort reserved:15;
287 };
288
289
290 class Q_GUI_EXPORT QFocusEvent : public QEvent
291 {
292 public:
293     explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
294     ~QFocusEvent();
295
296     inline bool gotFocus() const { return type() == FocusIn; }
297     inline bool lostFocus() const { return type() == FocusOut; }
298
299     Qt::FocusReason reason() const;
300
301 private:
302     Qt::FocusReason m_reason;
303 };
304
305
306 class Q_GUI_EXPORT QPaintEvent : public QEvent
307 {
308 public:
309     explicit QPaintEvent(const QRegion& paintRegion);
310     explicit QPaintEvent(const QRect &paintRect);
311     ~QPaintEvent();
312
313     inline const QRect &rect() const { return m_rect; }
314     inline const QRegion &region() const { return m_region; }
315
316 protected:
317     friend class QApplication;
318     friend class QCoreApplication;
319     QRect m_rect;
320     QRegion m_region;
321     bool m_erased;
322 };
323
324 // ### Qt5: make internal
325 class Q_GUI_EXPORT QUpdateLaterEvent : public QEvent
326 {
327 public:
328     explicit QUpdateLaterEvent(const QRegion& paintRegion);
329     ~QUpdateLaterEvent();
330
331     inline const QRegion &region() const { return m_region; }
332
333 protected:
334     QRegion m_region;
335 };
336
337 class Q_GUI_EXPORT QMoveEvent : public QEvent
338 {
339 public:
340     QMoveEvent(const QPoint &pos, const QPoint &oldPos);
341     ~QMoveEvent();
342
343     inline const QPoint &pos() const { return p; }
344     inline const QPoint &oldPos() const { return oldp;}
345 protected:
346     QPoint p, oldp;
347     friend class QApplication;
348     friend class QCoreApplication;
349 };
350
351 class Q_GUI_EXPORT QExposeEvent : public QEvent
352 {
353 public:
354     explicit QExposeEvent(const QRegion &rgn);
355     ~QExposeEvent();
356
357     inline const QRegion &region() const { return rgn; }
358
359 protected:
360     QRegion rgn;
361 };
362
363 class Q_GUI_EXPORT QResizeEvent : public QEvent
364 {
365 public:
366     QResizeEvent(const QSize &size, const QSize &oldSize);
367     ~QResizeEvent();
368
369     inline const QSize &size() const { return s; }
370     inline const QSize &oldSize()const { return olds;}
371 protected:
372     QSize s, olds;
373     friend class QApplication;
374     friend class QCoreApplication;
375 };
376
377
378 class Q_GUI_EXPORT QCloseEvent : public QEvent
379 {
380 public:
381     QCloseEvent();
382     ~QCloseEvent();
383 };
384
385
386 class Q_GUI_EXPORT QIconDragEvent : public QEvent
387 {
388 public:
389     QIconDragEvent();
390     ~QIconDragEvent();
391 };
392
393
394 class Q_GUI_EXPORT QShowEvent : public QEvent
395 {
396 public:
397     QShowEvent();
398     ~QShowEvent();
399 };
400
401
402 class Q_GUI_EXPORT QHideEvent : public QEvent
403 {
404 public:
405     QHideEvent();
406     ~QHideEvent();
407 };
408
409 #ifndef QT_NO_CONTEXTMENU
410 class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent
411 {
412 public:
413     enum Reason { Mouse, Keyboard, Other };
414
415     QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
416                       Qt::KeyboardModifiers modifiers);
417     QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos);
418     QContextMenuEvent(Reason reason, const QPoint &pos);
419     ~QContextMenuEvent();
420
421     inline int x() const { return p.x(); }
422     inline int y() const { return p.y(); }
423     inline int globalX() const { return gp.x(); }
424     inline int globalY() const { return gp.y(); }
425
426     inline const QPoint& pos() const { return p; }
427     inline const QPoint& globalPos() const { return gp; }
428
429     inline Reason reason() const { return Reason(reas); }
430
431 protected:
432     QPoint p;
433     QPoint gp;
434     uint reas : 8;
435 };
436 #endif // QT_NO_CONTEXTMENU
437
438 #ifndef QT_NO_INPUTMETHOD
439 class Q_GUI_EXPORT QInputMethodEvent : public QEvent
440 {
441 public:
442     enum AttributeType {
443        TextFormat,
444        Cursor,
445        Language,
446        Ruby,
447        Selection
448     };
449     class Attribute {
450     public:
451         Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {}
452         AttributeType type;
453
454         int start;
455         int length;
456         QVariant value;
457     };
458     QInputMethodEvent();
459     QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
460     void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
461     QT_DEPRECATED void setTentativeCommitString(const QString &tentativeCommitString);
462
463     inline const QList<Attribute> &attributes() const { return attrs; }
464     inline const QString &preeditString() const { return preedit; }
465
466     inline const QString &commitString() const { return commit; }
467     inline int replacementStart() const { return replace_from; }
468     inline int replacementLength() const { return replace_length; }
469     QT_DEPRECATED inline const QString &tentativeCommitString() const { return tentativeCommit; }
470
471     QInputMethodEvent(const QInputMethodEvent &other);
472
473 private:
474     QString preedit;
475     QList<Attribute> attrs;
476     QString commit;
477     int replace_from;
478     int replace_length;
479     QString tentativeCommit;
480 };
481 Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_MOVABLE_TYPE);
482
483 class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent
484 {
485 public:
486     explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries);
487     ~QInputMethodQueryEvent();
488
489     Qt::InputMethodQueries queries() const { return m_queries; }
490
491     void setValue(Qt::InputMethodQuery query, const QVariant &value);
492     QVariant value(Qt::InputMethodQuery query) const;
493 private:
494     Qt::InputMethodQueries m_queries;
495     struct QueryPair {
496         Qt::InputMethodQuery query;
497         QVariant value;
498     };
499     QVector<QueryPair> m_values;
500 };
501
502 #endif // QT_NO_INPUTMETHOD
503
504 #ifndef QT_NO_DRAGANDDROP
505
506 class QMimeData;
507
508 class Q_GUI_EXPORT QDropEvent : public QEvent
509 {
510 public:
511     QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data,
512                Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
513     ~QDropEvent();
514
515     inline const QPoint pos() const { return p.toPoint(); }
516     inline const QPointF &posF() const { return p; }
517     inline Qt::MouseButtons mouseButtons() const { return mouseState; }
518     inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
519
520     inline Qt::DropActions possibleActions() const { return act; }
521     inline Qt::DropAction proposedAction() const { return default_action; }
522     inline void acceptProposedAction() { drop_action = default_action; accept(); }
523
524     inline Qt::DropAction dropAction() const { return drop_action; }
525     void setDropAction(Qt::DropAction action);
526
527     QObject* source() const;
528     inline const QMimeData *mimeData() const { return mdata; }
529
530 protected:
531     friend class QApplication;
532     QPointF p;
533     Qt::MouseButtons mouseState;
534     Qt::KeyboardModifiers modState;
535     Qt::DropActions act;
536     Qt::DropAction drop_action;
537     Qt::DropAction default_action;
538     const QMimeData *mdata;
539 };
540
541
542 class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent
543 {
544 public:
545     QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
546                    Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove);
547     ~QDragMoveEvent();
548
549     inline QRect answerRect() const { return rect; }
550
551     inline void accept() { QDropEvent::accept(); }
552     inline void ignore() { QDropEvent::ignore(); }
553
554     inline void accept(const QRect & r) { accept(); rect = r; }
555     inline void ignore(const QRect & r) { ignore(); rect = r; }
556
557 protected:
558     friend class QApplication;
559     QRect rect;
560 };
561
562
563 class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent
564 {
565 public:
566     QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
567                     Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
568     ~QDragEnterEvent();
569 };
570
571
572 class Q_GUI_EXPORT QDragLeaveEvent : public QEvent
573 {
574 public:
575     QDragLeaveEvent();
576     ~QDragLeaveEvent();
577 };
578 #endif // QT_NO_DRAGANDDROP
579
580
581 class Q_GUI_EXPORT QHelpEvent : public QEvent
582 {
583 public:
584     QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos);
585     ~QHelpEvent();
586
587     inline int x() const { return p.x(); }
588     inline int y() const { return p.y(); }
589     inline int globalX() const { return gp.x(); }
590     inline int globalY() const { return gp.y(); }
591
592     inline const QPoint& pos()  const { return p; }
593     inline const QPoint& globalPos() const { return gp; }
594
595 private:
596     QPoint p;
597     QPoint gp;
598 };
599
600 #ifndef QT_NO_STATUSTIP
601 class Q_GUI_EXPORT QStatusTipEvent : public QEvent
602 {
603 public:
604     explicit QStatusTipEvent(const QString &tip);
605     ~QStatusTipEvent();
606
607     inline QString tip() const { return s; }
608 private:
609     QString s;
610 };
611 #endif
612
613 #ifndef QT_NO_WHATSTHIS
614 class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
615 {
616 public:
617     explicit QWhatsThisClickedEvent(const QString &href);
618     ~QWhatsThisClickedEvent();
619
620     inline QString href() const { return s; }
621 private:
622     QString s;
623 };
624 #endif
625
626 #ifndef QT_NO_ACTION
627 class Q_GUI_EXPORT QActionEvent : public QEvent
628 {
629     QAction *act, *bef;
630 public:
631     QActionEvent(int type, QAction *action, QAction *before = 0);
632     ~QActionEvent();
633
634     inline QAction *action() const { return act; }
635     inline QAction *before() const { return bef; }
636 };
637 #endif
638
639 class Q_GUI_EXPORT QFileOpenEvent : public QEvent
640 {
641 public:
642     explicit QFileOpenEvent(const QString &file);
643     explicit QFileOpenEvent(const QUrl &url);
644     ~QFileOpenEvent();
645
646     inline QString file() const { return f; }
647     QUrl url() const;
648     bool openFile(QFile &file, QIODevice::OpenMode flags) const;
649 private:
650     QString f;
651 };
652
653 #ifndef QT_NO_TOOLBAR
654 class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
655 {
656 public:
657     explicit QToolBarChangeEvent(bool t);
658     ~QToolBarChangeEvent();
659
660     inline bool toggle() const { return tog; }
661 private:
662     uint tog : 1;
663 };
664 #endif
665
666 #ifndef QT_NO_SHORTCUT
667 class Q_GUI_EXPORT QShortcutEvent : public QEvent
668 {
669 public:
670     QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
671     ~QShortcutEvent();
672
673     inline const QKeySequence &key() const { return sequence; }
674     inline int shortcutId() const { return sid; }
675     inline bool isAmbiguous() const { return ambig; }
676 protected:
677     QKeySequence sequence;
678     bool ambig;
679     int  sid;
680 };
681 #endif
682
683 class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
684 {
685 public:
686     explicit QWindowStateChangeEvent(Qt::WindowStates aOldState);
687     QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
688     ~QWindowStateChangeEvent();
689
690     inline Qt::WindowStates oldState() const { return ostate; }
691     bool isOverride() const;
692
693 private:
694     Qt::WindowStates ostate;
695 };
696
697 #ifndef QT_NO_DEBUG_STREAM
698 Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
699 #endif
700
701 #ifndef QT_NO_SHORTCUT
702 inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);}
703 inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
704 #endif // QT_NO_SHORTCUT
705
706 class QTouchEventTouchPointPrivate;
707 class Q_GUI_EXPORT QTouchEvent : public QInputEvent
708 {
709 public:
710     class Q_GUI_EXPORT TouchPoint
711     {
712     public:
713         enum InfoFlag {
714             Pen  = 0x0001
715         };
716         Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
717
718         explicit TouchPoint(int id = -1);
719         TouchPoint(const TouchPoint &other);
720 #ifdef Q_COMPILER_RVALUE_REFS
721         TouchPoint(TouchPoint &&other) : d(other.d) { other.d = 0; }
722         TouchPoint &operator=(TouchPoint &&other)
723         { qSwap(d, other.d); return *this; }
724 #endif
725         ~TouchPoint();
726
727         TouchPoint &operator=(const TouchPoint &other)
728         { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; }
729
730         void swap(TouchPoint &other) { qSwap(d, other.d); }
731
732         int id() const;
733
734         Qt::TouchPointState state() const;
735
736         QPointF pos() const;
737         QPointF startPos() const;
738         QPointF lastPos() const;
739
740         QPointF scenePos() const;
741         QPointF startScenePos() const;
742         QPointF lastScenePos() const;
743
744         QPointF screenPos() const;
745         QPointF startScreenPos() const;
746         QPointF lastScreenPos() const;
747
748         QPointF normalizedPos() const;
749         QPointF startNormalizedPos() const;
750         QPointF lastNormalizedPos() const;
751
752         QRectF rect() const;
753         QRectF sceneRect() const;
754         QRectF screenRect() const;
755
756         qreal pressure() const;
757         QVector2D velocity() const;
758         InfoFlags flags() const;
759         QVector<QPointF> rawScreenPositions() const;
760
761         // internal
762         void setId(int id);
763         void setState(Qt::TouchPointStates state);
764         void setPos(const QPointF &pos);
765         void setScenePos(const QPointF &scenePos);
766         void setScreenPos(const QPointF &screenPos);
767         void setNormalizedPos(const QPointF &normalizedPos);
768         void setStartPos(const QPointF &startPos);
769         void setStartScenePos(const QPointF &startScenePos);
770         void setStartScreenPos(const QPointF &startScreenPos);
771         void setStartNormalizedPos(const QPointF &startNormalizedPos);
772         void setLastPos(const QPointF &lastPos);
773         void setLastScenePos(const QPointF &lastScenePos);
774         void setLastScreenPos(const QPointF &lastScreenPos);
775         void setLastNormalizedPos(const QPointF &lastNormalizedPos);
776         void setRect(const QRectF &rect);
777         void setSceneRect(const QRectF &sceneRect);
778         void setScreenRect(const QRectF &screenRect);
779         void setPressure(qreal pressure);
780         void setVelocity(const QVector2D &v);
781         void setFlags(InfoFlags flags);
782         void setRawScreenPositions(const QVector<QPointF> &positions);
783
784     private:
785         QTouchEventTouchPointPrivate *d;
786         friend class QGuiApplication;
787         friend class QGuiApplicationPrivate;
788         friend class QApplication;
789         friend class QApplicationPrivate;
790     };
791
792 #if QT_DEPRECATED_SINCE(5, 0)
793     QT_DEPRECATED enum DeviceType {
794         TouchScreen,
795         TouchPad
796     };
797 #endif
798
799     explicit QTouchEvent(QEvent::Type eventType,
800                          QTouchDevice *device = 0,
801                          Qt::KeyboardModifiers modifiers = Qt::NoModifier,
802                          Qt::TouchPointStates touchPointStates = 0,
803                          const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
804     ~QTouchEvent();
805
806     inline QWindow *window() const { return _window; }
807     inline QObject *target() const { return _target; }
808 #if QT_DEPRECATED_SINCE(5, 0)
809     QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
810 #endif
811     inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
812     inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
813     inline QTouchDevice *device() const { return _device; }
814
815     // internal
816     inline void setWindow(QWindow *awindow) { _window = awindow; }
817     inline void setTarget(QObject *atarget) { _target = atarget; }
818     inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
819     inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
820     inline void setDevice(QTouchDevice *adevice) { _device = adevice; }
821
822 protected:
823     QWindow *_window;
824     QObject *_target;
825     QTouchDevice *_device;
826     Qt::TouchPointStates _touchPointStates;
827     QList<QTouchEvent::TouchPoint> _touchPoints;
828
829     friend class QGuiApplication;
830     friend class QGuiApplicationPrivate;
831     friend class QApplication;
832     friend class QApplicationPrivate;
833 };
834 Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE);
835 Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
836
837 class QScrollPrepareEventPrivate;
838 class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent
839 {
840 public:
841     explicit QScrollPrepareEvent(const QPointF &startPos);
842     ~QScrollPrepareEvent();
843
844     QPointF startPos() const;
845
846     QSizeF viewportSize() const;
847     QRectF contentPosRange() const;
848     QPointF contentPos() const;
849
850     void setViewportSize(const QSizeF &size);
851     void setContentPosRange(const QRectF &rect);
852     void setContentPos(const QPointF &pos);
853
854 private:
855     QScrollPrepareEventPrivate *d_func();
856     const QScrollPrepareEventPrivate *d_func() const;
857 };
858
859
860 class QScrollEventPrivate;
861 class Q_GUI_EXPORT QScrollEvent : public QEvent
862 {
863 public:
864     enum ScrollState
865     {
866         ScrollStarted,
867         ScrollUpdated,
868         ScrollFinished
869     };
870
871     QScrollEvent(const QPointF &contentPos, const QPointF &overshoot, ScrollState scrollState);
872     ~QScrollEvent();
873
874     QPointF contentPos() const;
875     QPointF overshootDistance() const;
876     ScrollState scrollState() const;
877
878 private:
879     QScrollEventPrivate *d_func();
880     const QScrollEventPrivate *d_func() const;
881 };
882
883 class QScreenOrientationChangeEventPrivate;
884 class Q_GUI_EXPORT QScreenOrientationChangeEvent : public QEvent
885 {
886 public:
887     QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation orientation);
888     ~QScreenOrientationChangeEvent();
889
890     QScreen *screen() const;
891     Qt::ScreenOrientation orientation() const;
892
893 private:
894     QScreenOrientationChangeEventPrivate *d_func();
895     const QScreenOrientationChangeEventPrivate *d_func() const;
896 };
897
898 QT_END_NAMESPACE
899
900 QT_END_HEADER
901
902 #endif // QEVENT_H