Merge remote-tracking branch 'origin/master' into api_changes
[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 #if QT_DEPRECATED_SINCE(5, 0)
162     inline QT_DEPRECATED int delta() const  { return qt4D; }
163     inline QT_DEPRECATED Qt::Orientation orientation() const { return qt4O; }
164 #endif
165
166 #ifndef QT_NO_INTEGER_EVENT_COORDINATES
167     inline QPoint pos() const { return p.toPoint(); }
168     inline QPoint globalPos()   const { return g.toPoint(); }
169     inline int x() const { return p.x(); }
170     inline int y() const { return p.y(); }
171     inline int globalX() const { return g.x(); }
172     inline int globalY() const { return g.y(); }
173 #endif
174     inline const QPointF &posF() const { return p; }
175     inline const QPointF &globalPosF()   const { return g; }
176
177     inline Qt::MouseButtons buttons() const { return mouseState; }
178 protected:
179     QPointF p;
180     QPointF g;
181     QPoint pixelD;
182     QPoint angleD;
183     int qt4D;
184     Qt::Orientation qt4O;
185     Qt::MouseButtons mouseState;
186     int reserved;
187 };
188 #endif
189
190 #ifndef QT_NO_TABLETEVENT
191 class Q_GUI_EXPORT QTabletEvent : public QInputEvent
192 {
193 public:
194     enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
195                         XFreeEraser /*internal*/, RotationStylus };
196     enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
197     QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
198                  int device, int pointerType, qreal pressure, int xTilt, int yTilt,
199                  qreal tangentialPressure, qreal rotation, int z,
200                  Qt::KeyboardModifiers keyState, qint64 uniqueID);
201     ~QTabletEvent();
202
203     inline const QPoint pos() const { return mPos.toPoint(); }
204     inline const QPoint globalPos() const { return mGPos.toPoint(); }
205 #if QT_DEPRECATED_SINCE(5,0)
206     QT_DEPRECATED inline const QPointF &hiResGlobalPos() const { return mPos; }
207 #endif
208
209     inline const QPointF &posF() const { return mPos; }
210     inline const QPointF &globalPosF() const { return mGPos; }
211
212     inline int x() const { return qRound(mPos.x()); }
213     inline int y() const { return qRound(mPos.y()); }
214     inline int globalX() const { return qRound(mGPos.x()); }
215     inline int globalY() const { return qRound(mGPos.y()); }
216     inline qreal hiResGlobalX() const { return mGPos.x(); }
217     inline qreal hiResGlobalY() const { return mGPos.y(); }
218     inline TabletDevice device() const { return TabletDevice(mDev); }
219     inline PointerType pointerType() const { return PointerType(mPointerType); }
220     inline qint64 uniqueId() const { return mUnique; }
221     inline qreal pressure() const { return mPress; }
222     inline int z() const { return mZ; }
223     inline qreal tangentialPressure() const { return mTangential; }
224     inline qreal rotation() const { return mRot; }
225     inline int xTilt() const { return mXT; }
226     inline int yTilt() const { return mYT; }
227
228 protected:
229     QPointF mPos, mGPos;
230     int mDev, mPointerType, mXT, mYT, mZ;
231     qreal mPress, mTangential, mRot;
232     qint64 mUnique;
233
234     // I don't know what the future holds for tablets but there could be some
235     // new devices coming along, and there seem to be "holes" in the
236     // OS-specific events for this.
237     void *mExtra;
238 };
239 #endif // QT_NO_TABLETEVENT
240
241 class Q_GUI_EXPORT QKeyEvent : public QInputEvent
242 {
243 public:
244     QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
245               bool autorep = false, ushort count = 1);
246     QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
247               quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
248               const QString &text = QString(), bool autorep = false, ushort count = 1);
249     ~QKeyEvent();
250
251     int key() const { return k; }
252 #ifndef QT_NO_SHORTCUT
253     bool matches(QKeySequence::StandardKey key) const;
254 #endif
255     Qt::KeyboardModifiers modifiers() const;
256     inline QString text() const { return txt; }
257     inline bool isAutoRepeat() const { return autor; }
258     inline int count() const { return int(c); }
259
260     inline quint32 nativeScanCode() const { return nScanCode; }
261     inline quint32 nativeVirtualKey() const { return nVirtualKey; }
262     inline quint32 nativeModifiers() const { return nModifiers; }
263
264     // Functions for the extended key event information
265 #if QT_DEPRECATED_SINCE(5, 0)
266     static inline QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
267                                              quint32 nativeScanCode, quint32 nativeVirtualKey,
268                                              quint32 nativeModifiers,
269                                              const QString& text = QString(), bool autorep = false,
270                                              ushort count = 1)
271     {
272         return new QKeyEvent(type, key, modifiers,
273                              nativeScanCode, nativeVirtualKey, nativeModifiers,
274                              text, autorep, count);
275     }
276
277     inline bool hasExtendedInfo() const { return true; }
278 #endif
279
280 protected:
281     QString txt;
282     int k;
283     quint32 nScanCode;
284     quint32 nVirtualKey;
285     quint32 nModifiers;
286     ushort c;
287     ushort autor:1;
288     // ushort reserved:15;
289 };
290
291
292 class Q_GUI_EXPORT QFocusEvent : public QEvent
293 {
294 public:
295     explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
296     ~QFocusEvent();
297
298     inline bool gotFocus() const { return type() == FocusIn; }
299     inline bool lostFocus() const { return type() == FocusOut; }
300
301     Qt::FocusReason reason() const;
302
303 private:
304     Qt::FocusReason m_reason;
305 };
306
307
308 class Q_GUI_EXPORT QPaintEvent : public QEvent
309 {
310 public:
311     explicit QPaintEvent(const QRegion& paintRegion);
312     explicit QPaintEvent(const QRect &paintRect);
313     ~QPaintEvent();
314
315     inline const QRect &rect() const { return m_rect; }
316     inline const QRegion &region() const { return m_region; }
317
318 protected:
319     friend class QApplication;
320     friend class QCoreApplication;
321     QRect m_rect;
322     QRegion m_region;
323     bool m_erased;
324 };
325
326 // ### Qt5: make internal
327 class Q_GUI_EXPORT QUpdateLaterEvent : public QEvent
328 {
329 public:
330     explicit QUpdateLaterEvent(const QRegion& paintRegion);
331     ~QUpdateLaterEvent();
332
333     inline const QRegion &region() const { return m_region; }
334
335 protected:
336     QRegion m_region;
337 };
338
339 class Q_GUI_EXPORT QMoveEvent : public QEvent
340 {
341 public:
342     QMoveEvent(const QPoint &pos, const QPoint &oldPos);
343     ~QMoveEvent();
344
345     inline const QPoint &pos() const { return p; }
346     inline const QPoint &oldPos() const { return oldp;}
347 protected:
348     QPoint p, oldp;
349     friend class QApplication;
350     friend class QCoreApplication;
351 };
352
353 class Q_GUI_EXPORT QExposeEvent : public QEvent
354 {
355 public:
356     explicit QExposeEvent(const QRegion &rgn);
357     ~QExposeEvent();
358
359     inline const QRegion &region() const { return rgn; }
360
361 protected:
362     QRegion rgn;
363 };
364
365 class Q_GUI_EXPORT QResizeEvent : public QEvent
366 {
367 public:
368     QResizeEvent(const QSize &size, const QSize &oldSize);
369     ~QResizeEvent();
370
371     inline const QSize &size() const { return s; }
372     inline const QSize &oldSize()const { return olds;}
373 protected:
374     QSize s, olds;
375     friend class QApplication;
376     friend class QCoreApplication;
377 };
378
379
380 class Q_GUI_EXPORT QCloseEvent : public QEvent
381 {
382 public:
383     QCloseEvent();
384     ~QCloseEvent();
385 };
386
387
388 class Q_GUI_EXPORT QIconDragEvent : public QEvent
389 {
390 public:
391     QIconDragEvent();
392     ~QIconDragEvent();
393 };
394
395
396 class Q_GUI_EXPORT QShowEvent : public QEvent
397 {
398 public:
399     QShowEvent();
400     ~QShowEvent();
401 };
402
403
404 class Q_GUI_EXPORT QHideEvent : public QEvent
405 {
406 public:
407     QHideEvent();
408     ~QHideEvent();
409 };
410
411 #ifndef QT_NO_CONTEXTMENU
412 class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent
413 {
414 public:
415     enum Reason { Mouse, Keyboard, Other };
416
417     QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
418                       Qt::KeyboardModifiers modifiers);
419     QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos);
420     QContextMenuEvent(Reason reason, const QPoint &pos);
421     ~QContextMenuEvent();
422
423     inline int x() const { return p.x(); }
424     inline int y() const { return p.y(); }
425     inline int globalX() const { return gp.x(); }
426     inline int globalY() const { return gp.y(); }
427
428     inline const QPoint& pos() const { return p; }
429     inline const QPoint& globalPos() const { return gp; }
430
431     inline Reason reason() const { return Reason(reas); }
432
433 protected:
434     QPoint p;
435     QPoint gp;
436     uint reas : 8;
437 };
438 #endif // QT_NO_CONTEXTMENU
439
440 #ifndef QT_NO_INPUTMETHOD
441 class Q_GUI_EXPORT QInputMethodEvent : public QEvent
442 {
443 public:
444     enum AttributeType {
445        TextFormat,
446        Cursor,
447        Language,
448        Ruby,
449        Selection
450     };
451     class Attribute {
452     public:
453         Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {}
454         AttributeType type;
455
456         int start;
457         int length;
458         QVariant value;
459     };
460     QInputMethodEvent();
461     QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
462     void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
463     QT_DEPRECATED void setTentativeCommitString(const QString &tentativeCommitString);
464
465     inline const QList<Attribute> &attributes() const { return attrs; }
466     inline const QString &preeditString() const { return preedit; }
467
468     inline const QString &commitString() const { return commit; }
469     inline int replacementStart() const { return replace_from; }
470     inline int replacementLength() const { return replace_length; }
471     QT_DEPRECATED inline const QString &tentativeCommitString() const { return tentativeCommit; }
472
473     QInputMethodEvent(const QInputMethodEvent &other);
474
475 private:
476     QString preedit;
477     QList<Attribute> attrs;
478     QString commit;
479     int replace_from;
480     int replace_length;
481     QString tentativeCommit;
482 };
483 Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_MOVABLE_TYPE);
484
485 class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent
486 {
487 public:
488     explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries);
489     ~QInputMethodQueryEvent();
490
491     Qt::InputMethodQueries queries() const { return m_queries; }
492
493     void setValue(Qt::InputMethodQuery query, const QVariant &value);
494     QVariant value(Qt::InputMethodQuery query) const;
495 private:
496     Qt::InputMethodQueries m_queries;
497     struct QueryPair {
498         Qt::InputMethodQuery query;
499         QVariant value;
500     };
501     QVector<QueryPair> m_values;
502 };
503
504 #endif // QT_NO_INPUTMETHOD
505
506 #ifndef QT_NO_DRAGANDDROP
507
508 class QMimeData;
509
510 class Q_GUI_EXPORT QDropEvent : public QEvent
511 {
512 public:
513     QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data,
514                Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
515     ~QDropEvent();
516
517     inline const QPoint pos() const { return p.toPoint(); }
518     inline const QPointF &posF() const { return p; }
519     inline Qt::MouseButtons mouseButtons() const { return mouseState; }
520     inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
521
522     inline Qt::DropActions possibleActions() const { return act; }
523     inline Qt::DropAction proposedAction() const { return default_action; }
524     inline void acceptProposedAction() { drop_action = default_action; accept(); }
525
526     inline Qt::DropAction dropAction() const { return drop_action; }
527     void setDropAction(Qt::DropAction action);
528
529     QObject* source() const;
530     inline const QMimeData *mimeData() const { return mdata; }
531
532 protected:
533     friend class QApplication;
534     QPointF p;
535     Qt::MouseButtons mouseState;
536     Qt::KeyboardModifiers modState;
537     Qt::DropActions act;
538     Qt::DropAction drop_action;
539     Qt::DropAction default_action;
540     const QMimeData *mdata;
541 };
542
543
544 class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent
545 {
546 public:
547     QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
548                    Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove);
549     ~QDragMoveEvent();
550
551     inline QRect answerRect() const { return rect; }
552
553     inline void accept() { QDropEvent::accept(); }
554     inline void ignore() { QDropEvent::ignore(); }
555
556     inline void accept(const QRect & r) { accept(); rect = r; }
557     inline void ignore(const QRect & r) { ignore(); rect = r; }
558
559 protected:
560     friend class QApplication;
561     QRect rect;
562 };
563
564
565 class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent
566 {
567 public:
568     QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
569                     Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
570     ~QDragEnterEvent();
571 };
572
573
574 class Q_GUI_EXPORT QDragLeaveEvent : public QEvent
575 {
576 public:
577     QDragLeaveEvent();
578     ~QDragLeaveEvent();
579 };
580 #endif // QT_NO_DRAGANDDROP
581
582
583 class Q_GUI_EXPORT QHelpEvent : public QEvent
584 {
585 public:
586     QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos);
587     ~QHelpEvent();
588
589     inline int x() const { return p.x(); }
590     inline int y() const { return p.y(); }
591     inline int globalX() const { return gp.x(); }
592     inline int globalY() const { return gp.y(); }
593
594     inline const QPoint& pos()  const { return p; }
595     inline const QPoint& globalPos() const { return gp; }
596
597 private:
598     QPoint p;
599     QPoint gp;
600 };
601
602 #ifndef QT_NO_STATUSTIP
603 class Q_GUI_EXPORT QStatusTipEvent : public QEvent
604 {
605 public:
606     explicit QStatusTipEvent(const QString &tip);
607     ~QStatusTipEvent();
608
609     inline QString tip() const { return s; }
610 private:
611     QString s;
612 };
613 #endif
614
615 #ifndef QT_NO_WHATSTHIS
616 class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
617 {
618 public:
619     explicit QWhatsThisClickedEvent(const QString &href);
620     ~QWhatsThisClickedEvent();
621
622     inline QString href() const { return s; }
623 private:
624     QString s;
625 };
626 #endif
627
628 #ifndef QT_NO_ACTION
629 class Q_GUI_EXPORT QActionEvent : public QEvent
630 {
631     QAction *act, *bef;
632 public:
633     QActionEvent(int type, QAction *action, QAction *before = 0);
634     ~QActionEvent();
635
636     inline QAction *action() const { return act; }
637     inline QAction *before() const { return bef; }
638 };
639 #endif
640
641 class Q_GUI_EXPORT QFileOpenEvent : public QEvent
642 {
643 public:
644     explicit QFileOpenEvent(const QString &file);
645     explicit QFileOpenEvent(const QUrl &url);
646     ~QFileOpenEvent();
647
648     inline QString file() const { return f; }
649     QUrl url() const;
650     bool openFile(QFile &file, QIODevice::OpenMode flags) const;
651 private:
652     QString f;
653 };
654
655 #ifndef QT_NO_TOOLBAR
656 class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
657 {
658 public:
659     explicit QToolBarChangeEvent(bool t);
660     ~QToolBarChangeEvent();
661
662     inline bool toggle() const { return tog; }
663 private:
664     uint tog : 1;
665 };
666 #endif
667
668 #ifndef QT_NO_SHORTCUT
669 class Q_GUI_EXPORT QShortcutEvent : public QEvent
670 {
671 public:
672     QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
673     ~QShortcutEvent();
674
675     inline const QKeySequence &key() const { return sequence; }
676     inline int shortcutId() const { return sid; }
677     inline bool isAmbiguous() const { return ambig; }
678 protected:
679     QKeySequence sequence;
680     bool ambig;
681     int  sid;
682 };
683 #endif
684
685 #ifndef QT_NO_CLIPBOARD
686 class Q_GUI_EXPORT QClipboardEvent : public QEvent
687 {
688 public:
689     explicit QClipboardEvent(QEventPrivate *data);
690     ~QClipboardEvent();
691
692     QEventPrivate *data() { return d; }
693 };
694 #endif
695
696 class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
697 {
698 public:
699     explicit QWindowStateChangeEvent(Qt::WindowStates aOldState);
700     QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
701     ~QWindowStateChangeEvent();
702
703     inline Qt::WindowStates oldState() const { return ostate; }
704     bool isOverride() const;
705
706 private:
707     Qt::WindowStates ostate;
708 };
709
710 #ifndef QT_NO_DEBUG_STREAM
711 Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
712 #endif
713
714 #ifndef QT_NO_SHORTCUT
715 inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);}
716 inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
717 #endif // QT_NO_SHORTCUT
718
719 class QTouchEventTouchPointPrivate;
720 class Q_GUI_EXPORT QTouchEvent : public QInputEvent
721 {
722 public:
723     class Q_GUI_EXPORT TouchPoint
724     {
725     public:
726         enum InfoFlag {
727             Pen  = 0x0001
728         };
729         Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
730
731         explicit TouchPoint(int id = -1);
732         TouchPoint(const TouchPoint &other);
733 #ifdef Q_COMPILER_RVALUE_REFS
734         TouchPoint(TouchPoint &&other) : d(other.d) { other.d = 0; }
735         TouchPoint &operator=(TouchPoint &&other)
736         { qSwap(d, other.d); return *this; }
737 #endif
738         ~TouchPoint();
739
740         TouchPoint &operator=(const TouchPoint &other)
741         { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; }
742
743         void swap(TouchPoint &other) { qSwap(d, other.d); }
744
745         int id() const;
746
747         Qt::TouchPointState state() const;
748
749         QPointF pos() const;
750         QPointF startPos() const;
751         QPointF lastPos() const;
752
753         QPointF scenePos() const;
754         QPointF startScenePos() const;
755         QPointF lastScenePos() const;
756
757         QPointF screenPos() const;
758         QPointF startScreenPos() const;
759         QPointF lastScreenPos() const;
760
761         QPointF normalizedPos() const;
762         QPointF startNormalizedPos() const;
763         QPointF lastNormalizedPos() const;
764
765         QRectF rect() const;
766         QRectF sceneRect() const;
767         QRectF screenRect() const;
768
769         qreal pressure() const;
770         QVector2D velocity() const;
771         InfoFlags flags() const;
772         QVector<QPointF> rawScreenPositions() const;
773
774         // internal
775         void setId(int id);
776         void setState(Qt::TouchPointStates state);
777         void setPos(const QPointF &pos);
778         void setScenePos(const QPointF &scenePos);
779         void setScreenPos(const QPointF &screenPos);
780         void setNormalizedPos(const QPointF &normalizedPos);
781         void setStartPos(const QPointF &startPos);
782         void setStartScenePos(const QPointF &startScenePos);
783         void setStartScreenPos(const QPointF &startScreenPos);
784         void setStartNormalizedPos(const QPointF &startNormalizedPos);
785         void setLastPos(const QPointF &lastPos);
786         void setLastScenePos(const QPointF &lastScenePos);
787         void setLastScreenPos(const QPointF &lastScreenPos);
788         void setLastNormalizedPos(const QPointF &lastNormalizedPos);
789         void setRect(const QRectF &rect);
790         void setSceneRect(const QRectF &sceneRect);
791         void setScreenRect(const QRectF &screenRect);
792         void setPressure(qreal pressure);
793         void setVelocity(const QVector2D &v);
794         void setFlags(InfoFlags flags);
795         void setRawScreenPositions(const QVector<QPointF> &positions);
796
797     private:
798         QTouchEventTouchPointPrivate *d;
799         friend class QGuiApplication;
800         friend class QGuiApplicationPrivate;
801         friend class QApplication;
802         friend class QApplicationPrivate;
803     };
804
805 #if QT_DEPRECATED_SINCE(5, 0)
806     QT_DEPRECATED enum DeviceType {
807         TouchScreen,
808         TouchPad
809     };
810 #endif
811
812     explicit QTouchEvent(QEvent::Type eventType,
813                          QTouchDevice *device = 0,
814                          Qt::KeyboardModifiers modifiers = Qt::NoModifier,
815                          Qt::TouchPointStates touchPointStates = 0,
816                          const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
817     ~QTouchEvent();
818
819     inline QWindow *window() const { return _window; }
820     inline QObject *target() const { return _target; }
821 #if QT_DEPRECATED_SINCE(5, 0)
822     QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
823 #endif
824     inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
825     inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
826     inline QTouchDevice *device() const { return _device; }
827
828     // internal
829     inline void setWindow(QWindow *awindow) { _window = awindow; }
830     inline void setTarget(QObject *atarget) { _target = atarget; }
831     inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
832     inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
833     inline void setDevice(QTouchDevice *adevice) { _device = adevice; }
834
835 protected:
836     QWindow *_window;
837     QObject *_target;
838     QTouchDevice *_device;
839     Qt::TouchPointStates _touchPointStates;
840     QList<QTouchEvent::TouchPoint> _touchPoints;
841
842     friend class QGuiApplication;
843     friend class QGuiApplicationPrivate;
844     friend class QApplication;
845     friend class QApplicationPrivate;
846 };
847 Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE);
848 Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
849
850 class QScrollPrepareEventPrivate;
851 class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent
852 {
853 public:
854     explicit QScrollPrepareEvent(const QPointF &startPos);
855     ~QScrollPrepareEvent();
856
857     QPointF startPos() const;
858
859     QSizeF viewportSize() const;
860     QRectF contentPosRange() const;
861     QPointF contentPos() const;
862
863     void setViewportSize(const QSizeF &size);
864     void setContentPosRange(const QRectF &rect);
865     void setContentPos(const QPointF &pos);
866
867 private:
868     QScrollPrepareEventPrivate *d_func();
869     const QScrollPrepareEventPrivate *d_func() const;
870 };
871
872
873 class QScrollEventPrivate;
874 class Q_GUI_EXPORT QScrollEvent : public QEvent
875 {
876 public:
877     enum ScrollState
878     {
879         ScrollStarted,
880         ScrollUpdated,
881         ScrollFinished
882     };
883
884     QScrollEvent(const QPointF &contentPos, const QPointF &overshoot, ScrollState scrollState);
885     ~QScrollEvent();
886
887     QPointF contentPos() const;
888     QPointF overshootDistance() const;
889     ScrollState scrollState() const;
890
891 private:
892     QScrollEventPrivate *d_func();
893     const QScrollEventPrivate *d_func() const;
894 };
895
896 class QScreenOrientationChangeEventPrivate;
897 class Q_GUI_EXPORT QScreenOrientationChangeEvent : public QEvent
898 {
899 public:
900     QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation orientation);
901     ~QScreenOrientationChangeEvent();
902
903     QScreen *screen() const;
904     Qt::ScreenOrientation orientation() const;
905
906 private:
907     QScreenOrientationChangeEventPrivate *d_func();
908     const QScreenOrientationChangeEventPrivate *d_func() const;
909 };
910
911 QT_END_NAMESPACE
912
913 QT_END_HEADER
914
915 #endif // QEVENT_H