ginebra2/Gestures/GestureEvent.h
changeset 10 232fbd5a2dcb
equal deleted inserted replaced
6:1c3b8676e58c 10:232fbd5a2dcb
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 *
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not,
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:
       
    19 *
       
    20 */
       
    21 
       
    22 /*
       
    23  W A R N I N G
       
    24  -------------
       
    25  THIS IS A TEMPORARY GESTURE CODE. WOULD BE REPLACED WHEN BROWSER HAS ITS OWN GESTURE FRAMEWORK
       
    26  */
       
    27 
       
    28 #ifndef GestureEvent_h
       
    29 #define GestureEvent_h
       
    30 
       
    31 #include <QObject>
       
    32 #include <QPoint>
       
    33 #include <QPointF>
       
    34 
       
    35 namespace GVA {
       
    36 
       
    37 class GestureEvent : public QObject {
       
    38     Q_OBJECT
       
    39     Q_PROPERTY(GestureEvent::Type type READ type WRITE setType)
       
    40     Q_PROPERTY(QPointF position READ position WRITE setPosition)
       
    41     Q_PROPERTY(QPoint delta READ delta WRITE setDelta)
       
    42     Q_PROPERTY(QPointF velocity READ velocity WRITE setVelocity)
       
    43 
       
    44 public:
       
    45     enum Type {
       
    46         //FIX ME : We can use Tap for Touch & Release
       
    47         //But at present ginebra chrome elements such as
       
    48         //Bookmark/History needs separate touch and release
       
    49         //for drag and drop handling.
       
    50         None,
       
    51         Touch,
       
    52         Release,
       
    53         Pan,
       
    54         Flick,
       
    55         DoubleTap,
       
    56         LongTap
       
    57     };
       
    58 
       
    59     GestureEvent();
       
    60     GestureEvent(const GestureEvent&);
       
    61     GestureEvent& operator=(const GestureEvent&);
       
    62     ~GestureEvent();
       
    63 
       
    64     GestureEvent::Type type() const;
       
    65     void setType(GestureEvent::Type type);
       
    66 
       
    67     QPointF position() const;
       
    68     void setPosition(const QPointF& p);
       
    69 
       
    70     QPoint delta() const;
       
    71     void setDelta(const QPoint& p);
       
    72 
       
    73     QPointF velocity() const;
       
    74     void setVelocity(const QPointF& p);
       
    75 
       
    76 private:
       
    77     GestureEvent::Type m_type;
       
    78     QPointF m_pos;
       
    79     QPoint m_delta;
       
    80     QPointF m_velocity;
       
    81 };
       
    82 
       
    83 } //namespace GVA
       
    84 #endif //GestureEvent_h