qstmgesturelib/qstmgenericsimplegesture.h
changeset 16 3c88a81ff781
parent 3 0954f5dd2cd0
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
    37  */
    37  */
    38 class QStm_GenericSimpleGesture : public QStm_GestureIf
    38 class QStm_GenericSimpleGesture : public QStm_GestureIf
    39 {
    39 {
    40 public:
    40 public:
    41     QStm_GenericSimpleGesture(
    41     QStm_GenericSimpleGesture(
    42         QStm_GestureUid uid, const QPoint& loc, int type = 0,
    42         QStm_GestureUid uid, const QPoint& loc, QTime timestamp, int type = 0,
    43         const qstmUiEventEngine::QStm_UiEventSpeedIf* speedIf = NULL);
    43         const qstmUiEventEngine::QStm_UiEventSpeedIf* speedIf = NULL);
    44 
    44 
    45 public: // implementation of QStm_GestureIf
    45 public: // implementation of QStm_GestureIf
    46 
    46 
    47     QStm_GestureUid gestureUid() const { return m_uid; }
    47     QStm_GestureUid gestureUid() const { return m_uid; }
    48     void setDetails(void* details) { m_details = details;}  // additional info can be passed here.
    48     void setDetails(void* details) { m_details = details;}  // additional info can be passed here.
    49     virtual QPoint getLocation() const ;  // Location where the gesture happened (if applicable)
    49     virtual QPoint getLocation() const ;  // Location where the gesture happened (if applicable)
       
    50     virtual QPoint getLocation2() const;
    50     virtual int getType() const ;         // If the gesture can have different types
    51     virtual int getType() const ;         // If the gesture can have different types
    51     
    52     
    52     virtual float getSpeed() const /*__SOFTFP*/
    53     virtual float getSpeed() const /*__SOFTFP*/
    53     {
    54     {
    54         return m_speed ? m_speed->speed() : 0.f;
    55         return m_speed ? m_speed->speed() : 0.f;
    64     virtual void setName(const QString& name) ;
    65     virtual void setName(const QString& name) ;
    65     virtual QString getGestureName() ;       // String name for gesture
    66     virtual QString getGestureName() ;       // String name for gesture
    66 
    67 
    67     virtual void setTarget(void* target) { m_target = target; }
    68     virtual void setTarget(void* target) { m_target = target; }
    68     virtual void* target() { return m_target; }
    69     virtual void* target() { return m_target; }
       
    70     virtual QTime timestamp() const { return m_timestamp; }
    69     
    71     
    70 public:
    72 public:
    71     void setType(int type) { m_type = type; }
    73     void setType(int type) { m_type = type; }
    72 
    74 
    73 protected:
    75 protected:
    74     QPoint              m_location ;
    76     QPoint              m_location ;
       
    77     QPoint              m_location2 ;
    75     QStm_GestureUid     m_uid;
    78     QStm_GestureUid     m_uid;
    76     int                 m_type ;
    79     int                 m_type ;
    77     void*               m_details ;
    80     void*               m_details ;
    78     const qstmUiEventEngine::QStm_UiEventSpeedIf* m_speed ;
    81     const qstmUiEventEngine::QStm_UiEventSpeedIf* m_speed ;
    79     QString             m_name ;
    82     QString             m_name ;
    80     void*               m_target;
    83     void*               m_target;
       
    84     QTime               m_timestamp;
    81 };
    85 };
    82 
    86 
    83 class QStm_DirectionalGesture : public QStm_GenericSimpleGesture
    87 class QStm_DirectionalGesture : public QStm_GenericSimpleGesture
    84 {
    88 {
    85 public:
    89 public:
    86     QStm_DirectionalGesture(
    90     QStm_DirectionalGesture(
    87         QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc,
    91         QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc, QTime timestamp,
    88         const qstmUiEventEngine::QStm_UiEventSpeedIf* speedIf = NULL, bool logging = false);
    92         const qstmUiEventEngine::QStm_UiEventSpeedIf* speedIf = NULL, bool logging = false);
    89 
    93 
    90     void setVector(const QPoint& last, const QPoint& previous) ;
    94     void setVector(const QPoint& last, const QPoint& previous) ;
    91     void setLogging(bool enabled) { m_loggingEnabled = enabled; }
    95     void setLogging(bool enabled) { m_loggingEnabled = enabled; }
    92 
    96 
   103 };
   107 };
   104 
   108 
   105 class QStm_TwoPointGesture : public QStm_DirectionalGesture
   109 class QStm_TwoPointGesture : public QStm_DirectionalGesture
   106 {
   110 {
   107 public:
   111 public:
   108     QStm_TwoPointGesture(QStm_GestureUid uid, const QPoint& pos1, const QPoint& pos2);
   112     QStm_TwoPointGesture(QStm_GestureUid uid, const QPoint& pos1, const QPoint& pos2, QTime timestamp);
   109 
       
   110 private:
       
   111     QPoint m_location2 ;
       
   112 };
   113 };
   113 
   114 
   114 } // namespace
   115 } // namespace
   115 
   116 
   116 
   117