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 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 control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // class include |
|
20 #include "rt_gesturecontrol.h" |
|
21 |
|
22 // system includes |
|
23 #include <alf/alfevent.h> |
|
24 |
|
25 // local includes |
|
26 #include "rt_gesturehelper.h" |
|
27 |
|
28 using namespace RT_GestureHelper; |
|
29 |
|
30 // ---------------------------------------------------------------------------- |
|
31 // Two-phase constructor |
|
32 // ---------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CGestureControl* CGestureControl::NewLC( MGestureObserver& aObserver, |
|
35 CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId ) |
|
36 { |
|
37 CGestureControl* self = new ( ELeave ) CGestureControl; |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL( aObserver, aEnv, aDisplay, aFreeControlGroupId ); |
|
40 // create a full screen visual to capture pointer events anywhere on screen |
|
41 self->AppendVisualL( EAlfVisualTypeVisual ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // ---------------------------------------------------------------------------- |
|
46 // Constructor |
|
47 // ---------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CGestureControl::CGestureControl() |
|
50 { |
|
51 // do nothing |
|
52 } |
|
53 |
|
54 // ---------------------------------------------------------------------------- |
|
55 // Second-phase constructor |
|
56 // ---------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C void CGestureControl::ConstructL( MGestureObserver& aObserver, |
|
59 CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId ) |
|
60 { |
|
61 CAlfControl::ConstructL( aEnv ); |
|
62 iHelper = CGestureHelper::NewL( aObserver ); |
|
63 iHelper->InitAlfredPointerCaptureL( aEnv, aDisplay, aFreeControlGroupId ); |
|
64 } |
|
65 |
|
66 // ---------------------------------------------------------------------------- |
|
67 // Destructor |
|
68 // ---------------------------------------------------------------------------- |
|
69 // |
|
70 EXPORT_C CGestureControl::~CGestureControl() |
|
71 { |
|
72 delete iHelper; |
|
73 } |
|
74 |
|
75 // ---------------------------------------------------------------------------- |
|
76 // OfferEventL |
|
77 // ---------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C TBool CGestureControl::OfferEventL( const TAlfEvent& aEvent ) |
|
80 { |
|
81 return iHelper->OfferEventL( aEvent ); |
|
82 } |
|
83 |
|
84 // ---------------------------------------------------------------------------- |
|
85 // SetHoldingEnabled |
|
86 // ---------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C void CGestureControl::SetHoldingEnabled( TBool aEnabled ) |
|
89 { |
|
90 iHelper->SetHoldingEnabled( aEnabled ); |
|
91 } |
|
92 |
|
93 // ---------------------------------------------------------------------------- |
|
94 // IsHoldingEnabled |
|
95 // ---------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C TBool CGestureControl::IsHoldingEnabled() const |
|
98 { |
|
99 return iHelper->IsHoldingEnabled(); |
|
100 } |
|
101 |
|
102 // ---------------------------------------------------------------------------- |
|
103 // SetDoubleTapEnabled |
|
104 // ---------------------------------------------------------------------------- |
|
105 // |
|
106 EXPORT_C void CGestureControl::SetDoubleTapEnabled( TBool aEnabled ) |
|
107 { |
|
108 iHelper->SetDoubleTapEnabled( aEnabled ); |
|
109 } |
|
110 |
|
111 // ---------------------------------------------------------------------------- |
|
112 // IsDoubleTapEnabled |
|
113 // ---------------------------------------------------------------------------- |
|
114 // |
|
115 EXPORT_C TBool CGestureControl::IsDoubleTapEnabled() const |
|
116 { |
|
117 return iHelper->IsDoubleTapEnabled(); |
|
118 } |
|