|
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 #include "gestureframeworkimpl.h" |
|
20 #include "GestureEngine.h" |
|
21 #include "statemachine.h" |
|
22 |
|
23 using namespace stmGesture ; |
|
24 |
|
25 CGestureFrameworkImpl::CGestureFrameworkImpl() |
|
26 { |
|
27 // No implementation required |
|
28 } |
|
29 |
|
30 CGestureFrameworkImpl::~CGestureFrameworkImpl() |
|
31 { |
|
32 m_statemachine->removeUiEventObserver(m_gestureEngine) ; |
|
33 delete m_gestureEngine ; |
|
34 delete m_statemachine ; |
|
35 } |
|
36 |
|
37 CGestureFrameworkImpl* CGestureFrameworkImpl::NewLC() |
|
38 { |
|
39 CGestureFrameworkImpl* self = new (ELeave) CGestureFrameworkImpl(); |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CGestureFrameworkImpl* CGestureFrameworkImpl::NewL() |
|
46 { |
|
47 CGestureFrameworkImpl* self = CGestureFrameworkImpl::NewLC(); |
|
48 CleanupStack::Pop(self); |
|
49 return self; |
|
50 } |
|
51 |
|
52 void CGestureFrameworkImpl::ConstructL() |
|
53 { |
|
54 /*! |
|
55 * create the gesture engine and the low level UI event engine |
|
56 */ |
|
57 m_gestureEngine = new (ELeave)CGestureEngine() ; |
|
58 m_statemachine = stmUiEventEngine::CStateMachine::NewL() ; |
|
59 // TODO: all kinds of default settings for the lower layer, but in the test app |
|
60 // they are set from the settings menu so no need now... |
|
61 // Add the gesture engine to be the observer of UI events... |
|
62 m_statemachine->addUiEventObserver(m_gestureEngine) ; |
|
63 } |
|
64 MGestureEngineIf* CGestureFrameworkImpl::getGestureEngine() |
|
65 { |
|
66 return m_gestureEngine ; |
|
67 } |
|
68 |
|
69 void CGestureFrameworkImpl::enableLogging(bool loggingEnabled) |
|
70 { |
|
71 m_loggingenabled = loggingEnabled; |
|
72 if (m_gestureEngine) |
|
73 { |
|
74 m_gestureEngine->enableLogging(loggingEnabled) ; |
|
75 } |
|
76 } |
|
77 |