webengine/webkitutils/stmgesturefw/src/stmgestureinterface.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 28 d39add9822e2
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
       
     1 /*
       
     2 * Copyright (c) 2008 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 the License "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 helper implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Gesture UI Engine
       
    20 #include "statemachine.h"
       
    21 
       
    22 // Gesture Library: Framework
       
    23 #include "gestureframework.h"
       
    24 #include "rt_gestureengineif.h"
       
    25 
       
    26 // Gesture Library: Recognizers
       
    27 #include "tapgesturerecogniser.h"
       
    28 #include "pangesturerecogniser.h"
       
    29 #include "edgescrollgesturerecogniser.h"
       
    30 #include "longpressgesturerecogniser.h"
       
    31 #include "pinchgesturerecogniser.h"
       
    32 #include "touchgesturerecogniser.h"
       
    33 #include "releasegesturerecogniser.h"
       
    34 #include "flickgesturerecogniser.h"
       
    35 #include "zoomgesturerecogniser.h"
       
    36 
       
    37 #include "stmgestureinterface.h"
       
    38 #include "gesturehelpereventsender.h"
       
    39 
       
    40 #ifndef ICS_DCHECK
       
    41 #define ICS_DCHECK(test)
       
    42 #endif
       
    43 
       
    44 #define LOG(args...)
       
    45 
       
    46 
       
    47 EXPORT_C CStmGestureParameters::CStmGestureParameters()
       
    48     {
       
    49 
       
    50     }
       
    51 
       
    52 EXPORT_C CStmGestureParameters::CStmGestureParameters(
       
    53     const CStmGestureParameters& aParams )
       
    54     {
       
    55     Mem::Copy(&iParam[0], &aParams.iParam[0], sizeof(iParam));
       
    56     Mem::Copy(&iAreaSettings[0], &aParams.iAreaSettings[0], sizeof(iAreaSettings));
       
    57     Mem::Copy(&iEnabled[0], &aParams.iEnabled[0], sizeof(iEnabled));
       
    58     }
       
    59 
       
    60 EXPORT_C CStmGestureEngine* CStmGestureEngine::NewL()
       
    61     {
       
    62     CStmGestureEngine* eng = new(ELeave) CStmGestureEngine();
       
    63     CleanupStack::PushL(eng);
       
    64     eng->ConstructL();
       
    65     CleanupStack::Pop(eng);
       
    66     return eng;
       
    67     }
       
    68 
       
    69 CStmGestureEngine::CStmGestureEngine()
       
    70     {
       
    71 
       
    72     }
       
    73 
       
    74 void CStmGestureEngine::ConstructL()
       
    75     {
       
    76     iGf = stmGesture::CGestureFramework::NewL();
       
    77     }
       
    78 
       
    79 CStmGestureEngine::~CStmGestureEngine()
       
    80     {
       
    81     // Prevent reactivation of contexts as they remove themselves
       
    82     iDtorPhase = ETrue;
       
    83 
       
    84     iContexts.ResetAndDestroy();
       
    85     iCtxtStack.Reset();
       
    86     delete iGf;
       
    87     }
       
    88 
       
    89 EXPORT_C CStmGestureContext* CStmGestureEngine::CreateContextL(
       
    90     TInt /*aId*/ )
       
    91     {
       
    92     CStmGestureContext* ctxt = new(ELeave) CStmGestureContext(*this);
       
    93     CleanupStack::PushL(ctxt);
       
    94     ctxt->ConstructL();
       
    95     CleanupStack::Pop(ctxt);
       
    96     return ctxt;
       
    97     }
       
    98 
       
    99 EXPORT_C CStmGestureContext* CStmGestureEngine::Context(
       
   100     TInt /*aId*/ )
       
   101     {
       
   102     return NULL;
       
   103     }
       
   104 
       
   105 void CStmGestureEngine::EnableContextL(
       
   106     CStmGestureContext& aContext )
       
   107     {
       
   108     // NB: enabling context puts it on top of the Context Stack
       
   109     TInt idx = iCtxtStack.Find(&aContext);
       
   110     if(idx >= 0)
       
   111         {
       
   112         iCtxtStack.Remove(idx);
       
   113         }
       
   114 
       
   115     SetupRecognizersL(aContext, ETrue);
       
   116 
       
   117     iCtxtStack.AppendL(&aContext);
       
   118     }
       
   119 
       
   120 void CStmGestureEngine::DisableContextL(
       
   121     CStmGestureContext& aContext )
       
   122     {
       
   123     TInt idx = iCtxtStack.Find(&aContext);
       
   124     ICS_DCHECK(idx >= 0);
       
   125     if(idx == KErrNotFound)
       
   126         {
       
   127         return;
       
   128         }
       
   129 
       
   130     iCtxtStack.Remove(idx);
       
   131 
       
   132     stmGesture::MGestureEngineIf* ge = iGf->getGestureEngine();
       
   133 
       
   134     for(TInt i = 0; i < stmGesture::EStmGestureUid_Count; ++i)
       
   135         {
       
   136         MStmGestureRecogniser* rec = aContext.iRecognizers[i];
       
   137         if(rec)
       
   138             {
       
   139             ge->removeGesture(rec);
       
   140             }
       
   141         }
       
   142 
       
   143     // re-activate previous (new top-most) context
       
   144     // NB: if deleted context is not top-most (active) one, no updates done
       
   145     TInt count = iCtxtStack.Count();
       
   146     if(idx == count && count > 0 && !iDtorPhase)
       
   147         {
       
   148         CStmGestureContext* previous = iCtxtStack[count - 1];
       
   149         SetupRecognizersL(*previous, EFalse);
       
   150         }
       
   151     }
       
   152 
       
   153 template<class T>
       
   154 void CStmGestureEngine::InitRecognizerL(
       
   155     T*& aGesture,
       
   156     CStmGestureContext& aContext,
       
   157     TBool aNewContext )
       
   158     {
       
   159     stmGesture::MGestureRecogniserIf*& recognizer = aContext.iRecognizers[T::KUid];
       
   160     aGesture = static_cast<T*>(recognizer);
       
   161     if(!aGesture && aNewContext)
       
   162         {
       
   163         recognizer = aGesture = T::NewL(&aContext);
       
   164         recognizer->enableLogging((aContext.iLogging & (1<<T::KUid)) != 0);
       
   165         }
       
   166     else
       
   167         {
       
   168         ICS_DCHECK(gesture && !aNewContext); // should exist in restored top context
       
   169         }
       
   170 
       
   171     // TODO: Add in right place according to gesture class
       
   172     TBool added = iGf->getGestureEngine()->addGesture(aGesture);
       
   173     if(!added)
       
   174         {
       
   175         User::Leave(KErrNoMemory);
       
   176         }
       
   177     }
       
   178 
       
   179 void CStmGestureEngine::SetupRecognizersL(
       
   180     CStmGestureContext& aContext,
       
   181     TBool aNewContext )
       
   182     {
       
   183     LOG("Setup recognizers");
       
   184     // Order of recognizers in the Gesture Engine (upper ones receive input before lower ones)
       
   185     //
       
   186     // PINCH
       
   187     // CORNER_ZOOM
       
   188     // EDGE_SCROLL
       
   189     // LONGPRESS
       
   190     // TOUCH
       
   191     // UP_DOWN
       
   192     // LEFT_RIGHT
       
   193     // HOVER
       
   194     // PAN
       
   195     // TAP / DOUBLE_TAP
       
   196     // FLICK
       
   197     // RELEASE
       
   198     // UNKNOWN
       
   199 
       
   200     stmUiEventEngine::CStateMachine* stateMachine = iGf->getUiStateMachine();
       
   201     stmGesture::MGestureEngineIf* gestureEngine = iGf->getGestureEngine();
       
   202 
       
   203     MStmGestureParameters& conf = aContext.Config();
       
   204 
       
   205     TBool filter = conf.Param(stmGesture::EEnableFiltering) != 0;
       
   206 
       
   207     // TOUCH AREA
       
   208     TStmGestureArea& touchArea = *conf.Area(stmGesture::ETouchArea);
       
   209     TInt touchAreaSizeInMm = touchArea.iSize.iWidth;
       
   210     stateMachine->setTouchAreaShape ( stmUiEventEngine::TAreaShape(touchArea.iShape) );
       
   211     stateMachine->setTouchArea      ( !filter ? 0 : touchAreaSizeInMm );
       
   212     stateMachine->setTouchTimeout   ( !filter ? 0 : touchArea.iTimeout * 1000);
       
   213     CCoeControl* gestureContext = aContext.getOwner();
       
   214     TRect ctxtRect = gestureContext->Rect();
       
   215 
       
   216     // ===================================================== PINCH
       
   217     using stmGesture::CPinchGestureRecogniser;
       
   218 
       
   219     if (conf.Enabled(CPinchGestureRecogniser::KUid))
       
   220         {
       
   221         CPinchGestureRecogniser* gesture = NULL;
       
   222         InitRecognizerL(gesture, aContext, aNewContext);
       
   223 
       
   224         if(gesture)
       
   225             {
       
   226             TReal32 pspeed = conf.Param(stmGesture::EPinchSpeed) / 1000.f;
       
   227             gesture->setPinchingSpeed(pspeed);
       
   228             }
       
   229         }
       
   230 
       
   231     // ===================================================== LONG PRESS
       
   232     using stmGesture::CLongPressGestureRecogniser;
       
   233 
       
   234     if (conf.Enabled(CLongPressGestureRecogniser::KUid))
       
   235         {
       
   236         CLongPressGestureRecogniser* gesture = NULL;
       
   237         InitRecognizerL(gesture, aContext, aNewContext);
       
   238 
       
   239         if(gesture)
       
   240             {
       
   241             gesture->setArea(ctxtRect);
       
   242             }
       
   243         }
       
   244 
       
   245     // ===================================================== TOUCH
       
   246     using stmGesture::CTouchGestureRecogniser;
       
   247 
       
   248     if (conf.Enabled(CTouchGestureRecogniser::KUid))
       
   249         {
       
   250         CTouchGestureRecogniser* gesture = NULL;
       
   251         InitRecognizerL(gesture, aContext, aNewContext);
       
   252 
       
   253         if(gesture)
       
   254             {
       
   255             // define empty area so that touch is reported only inside
       
   256             // our window (touch recogniser handles either an area or the target window)
       
   257             gesture->setArea(TRect());
       
   258             }
       
   259         }
       
   260 
       
   261 
       
   262     // ===================================================== PAN
       
   263     using stmGesture::CPanGestureRecogniser;
       
   264 
       
   265     if (conf.Enabled(CPanGestureRecogniser::KUid))
       
   266         {
       
   267         CPanGestureRecogniser* gesture = NULL;
       
   268         InitRecognizerL(gesture, aContext, aNewContext);
       
   269 
       
   270         if(gesture)
       
   271             {
       
   272             gesture->setPanningSpeedLow ( conf.Param(stmGesture::EPanSpeedLow)  / 1000.f );
       
   273             gesture->setPanningSpeedHigh( conf.Param(stmGesture::EPanSpeedHigh) / 1000.f );
       
   274             }
       
   275         }
       
   276 
       
   277     // ===================================================== TAP / DOUBLE TAP
       
   278     /// Add recognizer before any existing Flick, Release, Unknown
       
   279     // Add the gesture to the gesture engine
       
   280     // TODO: Tap recognizer is special - it can combine multiple listeners,
       
   281     //       so no need to create new one if it already exists, just add new listeners to it
       
   282 
       
   283     using stmGesture::CTapGestureRecogniser;
       
   284 
       
   285     if (conf.Enabled(CTapGestureRecogniser::KUid))
       
   286         {
       
   287         CTapGestureRecogniser* gesture = NULL;
       
   288         InitRecognizerL(gesture, aContext, aNewContext);
       
   289 
       
   290         if(gesture)
       
   291             {
       
   292             gesture->setDoubleTapTimeout(conf.Param(stmGesture::EDoubleTapTimeout) * 1000);
       
   293             gesture->setDoubleTapRange( touchAreaSizeInMm );
       
   294             gesture->ignoreFirstTap(EFalse);
       
   295 
       
   296             aContext.iLogging |= 1<<CTapGestureRecogniser::KUid;
       
   297             }
       
   298         }
       
   299 
       
   300     // ===================================================== FLICK
       
   301     using stmGesture::CFlickGestureRecogniser;
       
   302 
       
   303     if (conf.Enabled(CFlickGestureRecogniser::KUid))
       
   304         {
       
   305         CFlickGestureRecogniser* gesture = NULL;
       
   306         InitRecognizerL(gesture, aContext, aNewContext);
       
   307 
       
   308         if(gesture)
       
   309             {
       
   310             TReal32 flickSpeed = conf.Param(stmGesture::EFlickSpeed) / 1000.f;
       
   311             gesture->setFlickingSpeed(flickSpeed);
       
   312             }
       
   313         }
       
   314 
       
   315     // ===================================================== RELEASE
       
   316     using stmGesture::CReleaseGestureRecogniser;
       
   317 
       
   318     if (conf.Enabled(CReleaseGestureRecogniser::KUid))
       
   319         {
       
   320         CReleaseGestureRecogniser* gesture = NULL;
       
   321         InitRecognizerL(gesture, aContext, aNewContext);
       
   322 
       
   323         if(gesture)
       
   324             {
       
   325             gesture->setArea(TRect());
       
   326             }
       
   327         }
       
   328 
       
   329 #if 0 // use in future depending upon browser requirement
       
   330     // ===================================================== CORNER ZOOM
       
   331     using stmGesture::CZoomGestureRecogniser;
       
   332 
       
   333     if (conf.Enabled(CZoomGestureRecogniser::KUid))
       
   334         {
       
   335         CZoomGestureRecogniser* gesture = NULL;
       
   336         InitRecognizerL(gesture, aContext, aNewContext);
       
   337 
       
   338         if(gesture)
       
   339             {
       
   340             gesture->setArea(ctxtRect);
       
   341             gesture->setRange(conf.Param(stmGesture::EZoomCornerSize));
       
   342             }
       
   343         }
       
   344 
       
   345     // ===================================================== EDGE SCROLL
       
   346     using stmGesture::CEdgeScrollGestureRecogniser;
       
   347 
       
   348     if (conf.Enabled(CEdgeScrollGestureRecogniser::KUid))
       
   349         {
       
   350         CEdgeScrollGestureRecogniser* gesture = NULL;
       
   351         InitRecognizerL(gesture, aContext, aNewContext);
       
   352 
       
   353         if(gesture)
       
   354             {
       
   355             gesture->setArea(ctxtRect);
       
   356             gesture->setScrollRange(conf.Param(stmGesture::EEdgeScrollRange)); // range is 20 pixels from the edge TODO: add this to settings...
       
   357             }
       
   358         }
       
   359 
       
   360     // ===================================================== LEFT-RIGHT
       
   361     using stmGesture::CLeftrightGestureRecogniser;
       
   362 
       
   363     if (conf.Enabled(CLeftrightGestureRecogniser::KUid))
       
   364         {
       
   365         CLeftrightGestureRecogniser* gesture = NULL;
       
   366         InitRecognizerL(gesture, aContext, aNewContext);
       
   367         }
       
   368 
       
   369     // ===================================================== UP-DOWN
       
   370     using stmGesture::CUpdownGestureRecogniser;
       
   371 
       
   372     if (conf.Enabled(CUpdownGestureRecogniser::KUid))
       
   373         {
       
   374         CUpdownGestureRecogniser* gesture = NULL;
       
   375         InitRecognizerL(gesture, aContext, aNewContext);
       
   376         }
       
   377 
       
   378     // ===================================================== HOVER
       
   379     using stmGesture::CHoveringGestureRecogniser;
       
   380 
       
   381     if (conf.Enabled(CHoveringGestureRecogniser::KUid))
       
   382         {
       
   383         CHoveringGestureRecogniser* gesture = NULL;
       
   384         InitRecognizerL(gesture, aContext, aNewContext);
       
   385         if(gesture)
       
   386             {
       
   387             gesture->setHoveringSpeed(conf.Param(stmGesture::EHoverSpeed) / 1000.f);
       
   388             }
       
   389         }
       
   390 
       
   391     // ===================================================== UNKNOWN
       
   392     using stmGesture::CUnknownGestureRecogniser;
       
   393 
       
   394     if (conf.Enabled(CUnknownGestureRecogniser::KUid))
       
   395         {
       
   396         CUnknownGestureRecogniser* gesture = NULL;
       
   397         InitRecognizerL(gesture, aContext, aNewContext);
       
   398         }
       
   399 #endif
       
   400 
       
   401     // ===========================================================
       
   402     if(aNewContext)
       
   403         {
       
   404         for(TInt i = 0; i < stmGesture::EStmGestureUid_Count; ++i)
       
   405             {
       
   406             MStmGestureRecogniser* rec = aContext.iRecognizers[i];
       
   407             if(rec)
       
   408                 {
       
   409                 rec->enableLogging(aContext.iLogging & (1<<i)) ;
       
   410                 }
       
   411             }
       
   412         }
       
   413 
       
   414 
       
   415     // HOLD AREA
       
   416     TStmGestureArea& holdArea = *conf.Area(stmGesture::EHoldArea);
       
   417     TInt holdAreaSizeInMm = holdArea.iSize.iWidth;
       
   418     stateMachine->setHoldAreaShape  ( stmUiEventEngine::TAreaShape(holdArea.iShape) );
       
   419     stateMachine->setHoldArea       ( !filter ? 0 : holdAreaSizeInMm );
       
   420     stateMachine->setHoldTimeout    ( !filter ? 0 : holdArea.iTimeout * 1000);
       
   421 
       
   422     // TOUCH-TIME AREA
       
   423     TStmGestureArea& tTimeArea = *conf.Area(stmGesture::ETouchTimeArea);
       
   424     TInt tTimeAreaSizeInMm = tTimeArea.iSize.iWidth;
       
   425     // NB: shape <-- TouchAreaShape
       
   426     stateMachine->setTouchTimeArea      ( !filter ? 0 : tTimeAreaSizeInMm );
       
   427 
       
   428     // Timeouts, Adjustments, etc.
       
   429     stateMachine->setTouchSuppressTimeout(!filter ? 0 :
       
   430                                             conf.Param(stmGesture::ESuppressTimeout)*1000) ;
       
   431     stateMachine->setMoveSuppressTimeout(!filter ? 0 :
       
   432                                             conf.Param(stmGesture::EMoveSuppressTimeout)*1000) ;
       
   433     stateMachine->enableCapacitiveUp    (!filter ? 0 :
       
   434                                             conf.Param(stmGesture::ECapacitiveUpUsed));
       
   435     stateMachine->enableYadjustment     (!filter ? 0 : conf.Param(stmGesture::EAdjustYPos));
       
   436     stateMachine->enableLogging(false);
       
   437 
       
   438     stateMachine->EnableWsEventMonitoring(false);
       
   439     LOG("Setup recognizers -- DONE");
       
   440     }
       
   441 
       
   442 EXPORT_C void CStmGestureEngine::HandlePointerEventL(
       
   443     const TPointerEvent& aPointerEvent,
       
   444     void* target)
       
   445     {
       
   446     iGf->getUiStateMachine()->HandlePointerEventL(aPointerEvent,target);
       
   447     }
       
   448 
       
   449 // =============================================================
       
   450 
       
   451 CStmGestureContext::CStmGestureContext(
       
   452     CStmGestureEngine& aEngine ) :
       
   453     iEngine(aEngine),
       
   454     iEventSender(NULL)
       
   455     {
       
   456 
       
   457     }
       
   458 
       
   459 void CStmGestureContext::ConstructL()
       
   460     {
       
   461     iEngine.iContexts.AppendL(this);
       
   462     iConfig = new(ELeave) CStmGestureParameters();
       
   463     }
       
   464 
       
   465 CStmGestureContext::~CStmGestureContext()
       
   466     {
       
   467     // Remove all gesture listeners
       
   468     for(TInt i = iListeners.Count() - 1; i >= 0; --i)
       
   469         {
       
   470         MStmGestureListener* listener = iListeners[i];
       
   471         iListeners.Remove(i);
       
   472         }
       
   473 
       
   474     iListeners.Reset();
       
   475 
       
   476     // Remove all context's recognizers from the Gesture Engine
       
   477     Deactivate();
       
   478 
       
   479     if (iEventSender)
       
   480         delete iEventSender;
       
   481 
       
   482     // Destroy all recognizers
       
   483     for(TInt r = 0; r < stmGesture::EStmGestureUid_Count; ++r)
       
   484         {
       
   485         MStmGestureRecogniser*& rec = iRecognizers[r];
       
   486         if(rec)
       
   487             {
       
   488             delete rec;
       
   489             rec = NULL;
       
   490             }
       
   491         }
       
   492 
       
   493     // Remove context from the Gesture Engine
       
   494     TInt idx = iEngine.iContexts.Find(this);
       
   495     if(idx != -1)
       
   496         {
       
   497         iEngine.iContexts.Remove(idx);
       
   498         }
       
   499     delete iConfig;
       
   500     }
       
   501 
       
   502 EXPORT_C void CStmGestureContext::AddListenerL(
       
   503     MStmGestureListener* aListener,
       
   504     TInt aPos )
       
   505     {
       
   506     iEventSender = CGestureEventSender::NewL(*aListener);
       
   507     iListeners.InsertL(aListener, aPos);
       
   508     }
       
   509 
       
   510 EXPORT_C TInt CStmGestureContext::RemoveListener(
       
   511     MStmGestureListener* aListener )
       
   512     {
       
   513     TInt ind = iListeners.Find(aListener);
       
   514     if(ind >= 0)
       
   515         {
       
   516         iListeners.Remove(ind);
       
   517         }
       
   518     return ind;
       
   519     }
       
   520 
       
   521 EXPORT_C void CStmGestureContext::SetContext(
       
   522     CCoeControl* aControl )
       
   523     {
       
   524     iOwnerControl = aControl;
       
   525 
       
   526     for(TInt i = 0; i < stmGesture::EStmGestureUid_Count; ++i)
       
   527         {
       
   528         MStmGestureRecogniser* rec = iRecognizers[i];
       
   529         if(rec)
       
   530             {
       
   531             rec->setOwner(aControl);
       
   532             }
       
   533         }
       
   534     }
       
   535 
       
   536 EXPORT_C void CStmGestureContext::ActivateL()
       
   537     {
       
   538     if(IsActive())
       
   539         {
       
   540         // re-enable all recognizers
       
   541         EnableRecognizersL();
       
   542         return;
       
   543         }
       
   544     /// 1. Tell Engine to deactivate active context
       
   545 
       
   546     /// 2. Setup all gesture recognizers
       
   547     iEngine.EnableContextL(*this);
       
   548 
       
   549     /// 3. Notify listeners
       
   550 
       
   551     //
       
   552     EnableRecognizersL();
       
   553 
       
   554     ///
       
   555     iActivated = ETrue;
       
   556     }
       
   557 
       
   558 EXPORT_C void CStmGestureContext::Deactivate()
       
   559     {
       
   560     // NB: reactivation of previous context may leave
       
   561     TRAP_IGNORE(iEngine.DisableContextL(*this));
       
   562     iActivated = EFalse;
       
   563     }
       
   564 
       
   565 void CStmGestureContext::gestureEnter(
       
   566     MStmGesture& aGesture )
       
   567     {
       
   568     TRAP_IGNORE(DispatchGestureEventL(aGesture.gestureUid(), &aGesture));
       
   569     }
       
   570 
       
   571 void CStmGestureContext::gestureExit(
       
   572     TStmGestureUid aGestureUid )
       
   573     {
       
   574     TRAP_IGNORE(DispatchGestureEventL(aGestureUid, NULL));
       
   575     }
       
   576 
       
   577 CCoeControl* CStmGestureContext::getOwner()
       
   578     {
       
   579     return iOwnerControl;
       
   580     }
       
   581 
       
   582 void CStmGestureContext::DispatchGestureEventL(
       
   583     TStmGestureUid aUid,
       
   584     MStmGesture* aGesture )
       
   585     {
       
   586     iEventSender->AddEvent(aUid, aGesture);
       
   587     }
       
   588 
       
   589 void CStmGestureContext::SuspendRecognizer(
       
   590     TStmGestureUid aUid )
       
   591     {
       
   592     MStmGestureRecogniser* rec = iRecognizers[aUid];
       
   593     if(rec && !rec->isEnabled())
       
   594         {
       
   595         rec->enable(EFalse);
       
   596         // TODO: Notify listener
       
   597         }
       
   598     }
       
   599 
       
   600 void CStmGestureContext::EnableRecognizersL()
       
   601     {
       
   602     for(TInt i = 0; i < stmGesture::EStmGestureUid_Count; ++i)
       
   603         {
       
   604         EnableRecognizerL(TStmGestureUid(i));
       
   605         }
       
   606     }
       
   607 
       
   608 void CStmGestureContext::EnableRecognizerL(
       
   609     TStmGestureUid aUid )
       
   610     {
       
   611     MStmGestureRecogniser* rec = iRecognizers[aUid];
       
   612     if(rec && !rec->isEnabled())
       
   613         {
       
   614         rec->enable(ETrue);
       
   615         // TODO: Notify listener
       
   616         }
       
   617     }
       
   618