src/gui/kernel/qevent_p.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtGui module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QEVENT_P_H
       
    43 #define QEVENT_P_H
       
    44 
       
    45 #include <QtCore/qglobal.h>
       
    46 #include <QtGui/qevent.h>
       
    47 
       
    48 QT_BEGIN_NAMESPACE
       
    49 
       
    50 //
       
    51 //  W A R N I N G
       
    52 //  -------------
       
    53 //
       
    54 // This file is not part of the Qt API.  It exists purely as an
       
    55 // implementation detail.  This header file may change from version to
       
    56 // version without notice, or even be removed.
       
    57 //
       
    58 // We mean it.
       
    59 //
       
    60 
       
    61 // ### Qt 5: remove
       
    62 class QKeyEventEx : public QKeyEvent
       
    63 {
       
    64 public:
       
    65     QKeyEventEx(Type type, int key, Qt::KeyboardModifiers modifiers,
       
    66                 const QString &text, bool autorep, ushort count,
       
    67                 quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers);
       
    68     QKeyEventEx(const QKeyEventEx &other);
       
    69 
       
    70     ~QKeyEventEx();
       
    71 
       
    72 protected:
       
    73     quint32 nScanCode;
       
    74     quint32 nVirtualKey;
       
    75     quint32 nModifiers;
       
    76     friend class QKeyEvent;
       
    77 };
       
    78 
       
    79 // ### Qt 5: remove
       
    80 class QMouseEventEx : public QMouseEvent
       
    81 {
       
    82 public:
       
    83     QMouseEventEx(Type type, const QPointF &pos, const QPoint &globalPos,
       
    84                   Qt::MouseButton button, Qt::MouseButtons buttons,
       
    85                   Qt::KeyboardModifiers modifiers);
       
    86     ~QMouseEventEx();
       
    87 
       
    88 protected:
       
    89     QPointF posF;
       
    90     friend class QMouseEvent;
       
    91 };
       
    92 
       
    93 class QTouchEventTouchPointPrivate
       
    94 {
       
    95 public:
       
    96     inline QTouchEventTouchPointPrivate(int id)
       
    97         : ref(1),
       
    98           id(id),
       
    99           state(Qt::TouchPointReleased),
       
   100           pressure(qreal(-1.))
       
   101     { }
       
   102 
       
   103     inline QTouchEventTouchPointPrivate *detach()
       
   104     {
       
   105         QTouchEventTouchPointPrivate *d = new QTouchEventTouchPointPrivate(*this);
       
   106         d->ref = 1;
       
   107         if (!this->ref.deref())
       
   108             delete this;
       
   109         return d;
       
   110     }
       
   111 
       
   112     QAtomicInt ref;
       
   113     int id;
       
   114     Qt::TouchPointStates state;
       
   115     QRectF rect, sceneRect, screenRect;
       
   116     QPointF normalizedPos,
       
   117             startPos, startScenePos, startScreenPos, startNormalizedPos,
       
   118             lastPos, lastScenePos, lastScreenPos, lastNormalizedPos;
       
   119     qreal pressure;
       
   120 };
       
   121 
       
   122 class QNativeGestureEvent : public QEvent
       
   123 {
       
   124 public:
       
   125     enum Type {
       
   126         None,
       
   127         GestureBegin,
       
   128         GestureEnd,
       
   129         Pan,
       
   130         Zoom,
       
   131         Rotate,
       
   132         Swipe
       
   133     };
       
   134 
       
   135     QNativeGestureEvent()
       
   136         : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0)
       
   137 #ifdef Q_WS_WIN
       
   138         , sequenceId(0), argument(0)
       
   139 #endif
       
   140     {
       
   141     }
       
   142 
       
   143     Type gestureType;
       
   144     float percentage;
       
   145     QPoint position;
       
   146     float angle;
       
   147 #ifdef Q_WS_WIN
       
   148     ulong sequenceId;
       
   149     quint64 argument;
       
   150 #endif
       
   151 };
       
   152 
       
   153 class QGestureEventPrivate
       
   154 {
       
   155 public:
       
   156     inline QGestureEventPrivate(const QList<QGesture *> &list)
       
   157         : gestures(list), widget(0)
       
   158     {
       
   159     }
       
   160 
       
   161     QList<QGesture *> gestures;
       
   162     QWidget *widget;
       
   163     QMap<Qt::GestureType, bool> accepted;
       
   164     QMap<Qt::GestureType, QWidget *> targetWidgets;
       
   165 };
       
   166 
       
   167 QT_END_NAMESPACE
       
   168 
       
   169 #endif // QEVENT_P_H