mulwidgets/gesturehelper/src/gesturecontrol.cpp
branchRCL_3
changeset 25 4ea6f81c838a
parent 23 514d98f21c43
child 26 0e9bb658ef58
equal deleted inserted replaced
23:514d98f21c43 25:4ea6f81c838a
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Gesture control
       
    15 *
       
    16 */
       
    17 
       
    18 // class include
       
    19 #include "gesturecontrol.h"
       
    20 
       
    21 // system includes
       
    22 #include <alf/alfevent.h>
       
    23 
       
    24 // local includes
       
    25 #include "gesturehelper.h"
       
    26 
       
    27 using namespace GestureHelper;
       
    28 
       
    29 // ----------------------------------------------------------------------------
       
    30 // Two-phase constructor
       
    31 // ----------------------------------------------------------------------------
       
    32 //
       
    33 EXPORT_C CGestureControl* CGestureControl::NewLC( MGestureObserver& aObserver,
       
    34         CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId )
       
    35     {
       
    36     CGestureControl* self = new ( ELeave ) CGestureControl;
       
    37     CleanupStack::PushL( self );
       
    38     self->ConstructL( aObserver, aEnv, aDisplay, aFreeControlGroupId );
       
    39     // create a full screen visual to capture pointer events anywhere on screen
       
    40     self->AppendVisualL( EAlfVisualTypeVisual );
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ----------------------------------------------------------------------------
       
    45 // Constructor
       
    46 // ----------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CGestureControl::CGestureControl()
       
    49     {
       
    50     // do nothing
       
    51     }
       
    52 
       
    53 // ----------------------------------------------------------------------------
       
    54 // Second-phase constructor
       
    55 // ----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C void CGestureControl::ConstructL( MGestureObserver& aObserver,
       
    58         CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId )
       
    59     {
       
    60     CAlfControl::ConstructL( aEnv );
       
    61     iHelper = GestureHelper::CGestureHelper::NewL( aObserver );
       
    62     iHelper->InitAlfredPointerCaptureL( aEnv, aDisplay, aFreeControlGroupId );
       
    63     }
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // Destructor
       
    67 // ----------------------------------------------------------------------------
       
    68 //
       
    69 EXPORT_C CGestureControl::~CGestureControl()
       
    70     {
       
    71     delete iHelper;
       
    72     }
       
    73 
       
    74 // ----------------------------------------------------------------------------
       
    75 // OfferEventL
       
    76 // ----------------------------------------------------------------------------
       
    77 //
       
    78 EXPORT_C TBool CGestureControl::OfferEventL( const TAlfEvent& aEvent )
       
    79     {
       
    80     return iHelper->OfferEventL( aEvent );
       
    81     }
       
    82 
       
    83 // ----------------------------------------------------------------------------
       
    84 // SetHoldingEnabled
       
    85 // ----------------------------------------------------------------------------
       
    86 //
       
    87 EXPORT_C void CGestureControl::SetHoldingEnabled( TBool aEnabled )
       
    88     {
       
    89     iHelper->SetHoldingEnabled( aEnabled );
       
    90     }
       
    91 
       
    92 // ----------------------------------------------------------------------------
       
    93 // IsHoldingEnabled
       
    94 // ----------------------------------------------------------------------------
       
    95 //
       
    96 EXPORT_C TBool CGestureControl::IsHoldingEnabled() const
       
    97     {
       
    98     return iHelper->IsHoldingEnabled();
       
    99     }
       
   100 
       
   101 // ----------------------------------------------------------------------------
       
   102 // SetDoubleTapEnabled
       
   103 // ----------------------------------------------------------------------------
       
   104 //
       
   105 EXPORT_C void CGestureControl::SetDoubleTapEnabled( TBool aEnabled )
       
   106     {
       
   107     iHelper->SetDoubleTapEnabled( aEnabled );
       
   108     }
       
   109 
       
   110 // ----------------------------------------------------------------------------
       
   111 // IsDoubleTapEnabled
       
   112 // ----------------------------------------------------------------------------
       
   113 //
       
   114 EXPORT_C TBool CGestureControl::IsDoubleTapEnabled() const
       
   115     {
       
   116     return iHelper->IsDoubleTapEnabled();
       
   117     }