webengine/webkitutils/rt_gesturehelper/src/gesturehelper.cpp
author Chetan Kapoor <chetank@symbian.org>
Wed, 16 Jun 2010 16:08:48 +0100
branchGCC_SURGE
changeset 79 300705f43270
parent 65 5bfc169077b2
permissions -rw-r--r--
Bug 2962 - GCC compilation issues in sf/mw/web
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
65
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  Gesture helper interface
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
// class include
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include "rt_gesturehelper.h"
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
// local includes
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include "gesturehelperimpl.h"
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
using namespace RT_GestureHelper;
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
// Two-phase constructor
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
//
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
EXPORT_C CGestureHelper* CGestureHelper::NewL( MGestureObserver& aObserver )
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
    {
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
    CGestureHelper* self = new ( ELeave ) CGestureHelper;
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
    CleanupStack::PushL( self );
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
    self->iImpl = CGestureHelperImpl::NewL( aObserver );    
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
    CleanupStack::Pop( self );
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
    return self;
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
    }
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
// Destructor
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
//
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
EXPORT_C CGestureHelper::~CGestureHelper()
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
    {
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
    delete iImpl;
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
    }
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
// SetHoldingEnabled
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
//
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
EXPORT_C void CGestureHelper::SetHoldingEnabled( TBool aEnabled )
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
    {
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    iImpl->SetHoldingEnabled( aEnabled );
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
    }
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
// IsHoldingEnabled
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
//
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
EXPORT_C TBool CGestureHelper::IsHoldingEnabled() const
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    {
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
    return iImpl->IsHoldingEnabled();
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
    }
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
// SetDoubleTapEnabled
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
//
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
EXPORT_C void CGestureHelper::SetDoubleTapEnabled( TBool aEnabled )
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
    {
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    iImpl->SetDoubleTapEnabled( aEnabled );
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
    }
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
// IsDoubleTapEnabled
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
//
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
EXPORT_C TBool CGestureHelper::IsDoubleTapEnabled() const
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    {
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    return iImpl->IsDoubleTapEnabled();
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
    }
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
    
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
// HandlePointerEventL
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
//
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
EXPORT_C TBool CGestureHelper::HandlePointerEventL( const TPointerEvent& aEvent )
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    {
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    return iImpl->HandlePointerEventL( aEvent );
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    }
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
// Cancel
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
// ----------------------------------------------------------------------------
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
//
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
EXPORT_C void CGestureHelper::Cancel()
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    {
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    iImpl->Reset();
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    }
5bfc169077b2 Revision: 201006
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109