Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/kernel/qevent.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5353#include <QtGui/qdrag.h>
    5454#include <QtCore/qvariant.h>
     55#include <QtCore/qmap.h>
     56#include <QtCore/qset.h>
    5557
    5658QT_BEGIN_HEADER
     
    6163
    6264class QAction;
     65class QGesture;
    6366
    6467class Q_GUI_EXPORT QInputEvent : public QEvent
     
    6871    ~QInputEvent();
    6972    inline Qt::KeyboardModifiers modifiers() const { return modState; }
     73    inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
    7074protected:
    7175    Qt::KeyboardModifiers modState;
     
    242246                                           int modifiers, const QString& text = QString(),
    243247                                           bool autorep = false, ushort count = 1)
    244         : QInputEvent(type, (Qt::KeyboardModifiers)(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
     248        : QInputEvent(type, Qt::KeyboardModifiers(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
    245249          c(count), autor(autorep)
    246250    {
     
    425429       Cursor,
    426430       Language,
    427        Ruby
     431       Ruby,
     432       Selection
    428433    };
    429434    class Attribute {
     
    634639public:
    635640    QFileOpenEvent(const QString &file);
     641    QFileOpenEvent(const QUrl &url);
    636642    ~QFileOpenEvent();
    637643
    638644    inline QString file() const { return f; }
     645    QUrl url() const;
    639646private:
    640647    QString f;
     
    681688    ~QClipboardEvent();
    682689
    683     QEventPrivate *data() { return d; };
     690    QEventPrivate *data() { return d; }
    684691};
    685692#endif
     
    720727#endif // QT_NO_SHORTCUT
    721728
     729class QTouchEventTouchPointPrivate;
     730class Q_GUI_EXPORT QTouchEvent : public QInputEvent
     731{
     732public:
     733    class Q_GUI_EXPORT TouchPoint
     734    {
     735    public:
     736        TouchPoint(int id = -1);
     737        TouchPoint(const QTouchEvent::TouchPoint &other);
     738        ~TouchPoint();
     739
     740        int id() const;
     741
     742        Qt::TouchPointState state() const;
     743        bool isPrimary() const;
     744
     745        QPointF pos() const;
     746        QPointF startPos() const;
     747        QPointF lastPos() const;
     748
     749        QPointF scenePos() const;
     750        QPointF startScenePos() const;
     751        QPointF lastScenePos() const;
     752
     753        QPointF screenPos() const;
     754        QPointF startScreenPos() const;
     755        QPointF lastScreenPos() const;
     756
     757        QPointF normalizedPos() const;
     758        QPointF startNormalizedPos() const;
     759        QPointF lastNormalizedPos() const;
     760
     761        QRectF rect() const;
     762        QRectF sceneRect() const;
     763        QRectF screenRect() const;
     764
     765        qreal pressure() const;
     766
     767        // internal
     768        void setId(int id);
     769        void setState(Qt::TouchPointStates state);
     770        void setPos(const QPointF &pos);
     771        void setScenePos(const QPointF &scenePos);
     772        void setScreenPos(const QPointF &screenPos);
     773        void setNormalizedPos(const QPointF &normalizedPos);
     774        void setStartPos(const QPointF &startPos);
     775        void setStartScenePos(const QPointF &startScenePos);
     776        void setStartScreenPos(const QPointF &startScreenPos);
     777        void setStartNormalizedPos(const QPointF &startNormalizedPos);
     778        void setLastPos(const QPointF &lastPos);
     779        void setLastScenePos(const QPointF &lastScenePos);
     780        void setLastScreenPos(const QPointF &lastScreenPos);
     781        void setLastNormalizedPos(const QPointF &lastNormalizedPos);
     782        void setRect(const QRectF &rect);
     783        void setSceneRect(const QRectF &sceneRect);
     784        void setScreenRect(const QRectF &screenRect);
     785        void setPressure(qreal pressure);
     786        QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other);
     787
     788    private:
     789        QTouchEventTouchPointPrivate *d;
     790        friend class QApplication;
     791        friend class QApplicationPrivate;
     792    };
     793
     794    enum DeviceType {
     795        TouchScreen,
     796        TouchPad
     797    };
     798
     799    QTouchEvent(QEvent::Type eventType,
     800                QTouchEvent::DeviceType deviceType = TouchScreen,
     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 QWidget *widget() const { return _widget; }
     807    inline QTouchEvent::DeviceType deviceType() const { return _deviceType; }
     808    inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
     809    inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
     810
     811    // internal
     812    inline void setWidget(QWidget *awidget) { _widget = awidget; }
     813    inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; }
     814    inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
     815    inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
     816
     817protected:
     818    QWidget *_widget;
     819    QTouchEvent::DeviceType _deviceType;
     820    Qt::TouchPointStates _touchPointStates;
     821    QList<QTouchEvent::TouchPoint> _touchPoints;
     822
     823    friend class QApplication;
     824    friend class QApplicationPrivate;
     825};
     826
     827class QGesture;
     828class QGestureEventPrivate;
     829class Q_GUI_EXPORT QGestureEvent : public QEvent
     830{
     831public:
     832    QGestureEvent(const QList<QGesture *> &gestures);
     833    ~QGestureEvent();
     834
     835    QList<QGesture *> gestures() const;
     836    QGesture *gesture(Qt::GestureType type) const;
     837
     838    QList<QGesture *> activeGestures() const;
     839    QList<QGesture *> canceledGestures() const;
     840
     841#ifdef Q_NO_USING_KEYWORD
     842    inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); }
     843    inline bool isAccepted() const { return QEvent::isAccepted(); }
     844
     845    inline void accept() { QEvent::accept(); }
     846    inline void ignore() { QEvent::ignore(); }
     847#else
     848    using QEvent::setAccepted;
     849    using QEvent::isAccepted;
     850    using QEvent::accept;
     851    using QEvent::ignore;
     852#endif
     853
     854    void setAccepted(QGesture *, bool);
     855    void accept(QGesture *);
     856    void ignore(QGesture *);
     857    bool isAccepted(QGesture *) const;
     858
     859    void setAccepted(Qt::GestureType, bool);
     860    void accept(Qt::GestureType);
     861    void ignore(Qt::GestureType);
     862    bool isAccepted(Qt::GestureType) const;
     863
     864    void setWidget(QWidget *widget);
     865    QWidget *widget() const;
     866
     867#ifndef QT_NO_GRAPHICSVIEW
     868    QPointF mapToGraphicsScene(const QPointF &gesturePoint) const;
     869#endif
     870
     871private:
     872    QGestureEventPrivate *d_func();
     873    const QGestureEventPrivate *d_func() const;
     874
     875    friend class QApplication;
     876    friend class QGestureManager;
     877};
     878
    722879QT_END_NAMESPACE
    723880
Note: See TracChangeset for help on using the changeset viewer.