qstmgesturelib/recognisers/qstmmaybetapgesturerecogniser.h
author hgs
Fri, 15 Oct 2010 17:30:59 -0400
changeset 16 3c88a81ff781
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
*
hgs
parents:
diff changeset
     5
* This program is free software: you can redistribute it and/or modify
hgs
parents:
diff changeset
     6
* it under the terms of the GNU Lesser General Public License as published by
hgs
parents:
diff changeset
     7
* the Free Software Foundation, version 2.1 of the License.
hgs
parents:
diff changeset
     8
* 
hgs
parents:
diff changeset
     9
* This program is distributed in the hope that it will be useful,
hgs
parents:
diff changeset
    10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
hgs
parents:
diff changeset
    11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
hgs
parents:
diff changeset
    12
* GNU Lesser General Public License for more details.
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* You should have received a copy of the GNU Lesser General Public License
hgs
parents:
diff changeset
    15
* along with this program.  If not, 
hgs
parents:
diff changeset
    16
* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
hgs
parents:
diff changeset
    17
*
hgs
parents:
diff changeset
    18
* Description:
hgs
parents:
diff changeset
    19
*
hgs
parents:
diff changeset
    20
*/
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
#ifndef QSTMMAYBETAPGESTURERECOGNISER_H_
hgs
parents:
diff changeset
    23
#define QSTMAYBEMTAPGESTURERECOGNISER_H_
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include <qstmgestureengine_if.h>
hgs
parents:
diff changeset
    26
#include <qstmgesture_if.h>
hgs
parents:
diff changeset
    27
#include <qstmgesturelistener_if.h>
hgs
parents:
diff changeset
    28
#include "uitimer.h"
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
namespace qstmGesture
hgs
parents:
diff changeset
    31
{
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
class QStm_MaybeTapGestureRecogniser : public QStm_GestureRecogniser
hgs
parents:
diff changeset
    34
{
hgs
parents:
diff changeset
    35
	Q_OBJECT
hgs
parents:
diff changeset
    36
public:
hgs
parents:
diff changeset
    37
    static const QStm_GestureUid KUid = EGestureUidMaybeTap;
hgs
parents:
diff changeset
    38
hgs
parents:
diff changeset
    39
    virtual ~QStm_MaybeTapGestureRecogniser();
hgs
parents:
diff changeset
    40
hgs
parents:
diff changeset
    41
    virtual QStm_GestureRecognitionState recognise(int numOfActiveStreams, QStm_GestureEngineIf* ge) ;
hgs
parents:
diff changeset
    42
    virtual void release(QStm_GestureEngineIf* ge) ;
hgs
parents:
diff changeset
    43
    virtual void enable(bool enabled) ;
hgs
parents:
diff changeset
    44
    virtual bool isEnabled() ;
hgs
parents:
diff changeset
    45
    virtual void setOwner(void* owner) ;
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
    virtual QStm_GestureUid gestureUid() const { return KUid; }
hgs
parents:
diff changeset
    48
hgs
parents:
diff changeset
    49
    void addTapListener(QStm_GestureListenerIf* listener, void* listenerOwner) ;
hgs
parents:
diff changeset
    50
    void removeTapListener(QStm_GestureListenerIf* listener, void* listenerOwner) ;
hgs
parents:
diff changeset
    51
    virtual void enableLogging(bool loggingOn) ;
hgs
parents:
diff changeset
    52
    void setTapRange(int rangeInMillimetres);
hgs
parents:
diff changeset
    53
    QStm_MaybeTapGestureRecogniser(QStm_GestureListenerIf* listener) ;
hgs
parents:
diff changeset
    54
    
hgs
parents:
diff changeset
    55
private:
hgs
parents:
diff changeset
    56
    bool m_loggingenabled ;
hgs
parents:
diff changeset
    57
    bool isPointClose(const QPoint& firstPoint, const QPoint& secondPoint) ;
hgs
parents:
diff changeset
    58
private:
hgs
parents:
diff changeset
    59
    void* m_powner ; // The owning control for this gesture
hgs
parents:
diff changeset
    60
hgs
parents:
diff changeset
    61
    QPoint m_firstTapXY ;
hgs
parents:
diff changeset
    62
    void* m_firstTapTarget ;
hgs
parents:
diff changeset
    63
    float m_firstTapSpeed ;
hgs
parents:
diff changeset
    64
    bool m_gestureEnabled ;
hgs
parents:
diff changeset
    65
    int  m_rangesizeInPixels ;
hgs
parents:
diff changeset
    66
    // use simple arrays to store the listeners and corresponding windows
hgs
parents:
diff changeset
    67
    QList<QStm_GestureListenerIf*>  m_tapListeners ;
hgs
parents:
diff changeset
    68
    QList<void*>                    m_tapListenerWindows ;
hgs
parents:
diff changeset
    69
    int                             m_numOfActiveStreams;
hgs
parents:
diff changeset
    70
};
hgs
parents:
diff changeset
    71
hgs
parents:
diff changeset
    72
} // namespace
hgs
parents:
diff changeset
    73
hgs
parents:
diff changeset
    74
#endif /* QSTMTAPGESTURERECOGNISER_H_ */