|
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 #ifndef _RT_GESTURECONTROL_H_ |
|
20 #define _RT_GESTURECONTROL_H_ |
|
21 |
|
22 #include <alf/alfcontrol.h> |
|
23 |
|
24 class CAlfEnv; |
|
25 class CAlfDisplay; |
|
26 |
|
27 namespace RT_GestureHelper |
|
28 { |
|
29 |
|
30 class CGestureHelper; |
|
31 class MGestureObserver; |
|
32 |
|
33 /** |
|
34 * Gesture control provides pointer event forwarding to gesture helper. |
|
35 * |
|
36 * Gesture control can be created as |
|
37 * - Stand-alone: This functionality is usable by clients that want to |
|
38 * capture pointer events from anywhere in the screen. For example, a view |
|
39 * that wants to know if user tapped anywhere on the screen could use this. |
|
40 * - Derived: client can use the forward-pointer-events-to-gesture-helper |
|
41 * functionality by deriving from CGestureControl. Client has to create at |
|
42 * least one visual that captures pointer events. This base class will |
|
43 * receive the events and forward them to CGestureHelper. |
|
44 * |
|
45 * The client can keep other widgets on top of this control, to allow them |
|
46 * priority of capturing the pointer events. |
|
47 */ |
|
48 class CGestureControl : public CAlfControl |
|
49 { |
|
50 public: |
|
51 /** |
|
52 * Creates a stand-alone gesture control. |
|
53 * Creates a full screen visual that captures pointer events. Converts |
|
54 * pointer events to gestures and calls back on aObserver. |
|
55 * @param aFreeControlGroupId control group id that client does not use |
|
56 */ |
|
57 IMPORT_C static CGestureControl* NewLC( MGestureObserver& aObserver, |
|
58 CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId ); |
|
59 |
|
60 /** Destructor */ |
|
61 IMPORT_C ~CGestureControl(); |
|
62 |
|
63 // From CAlfControl |
|
64 IMPORT_C TBool OfferEventL( const TAlfEvent& aEvent ); |
|
65 |
|
66 /** @see CGestureHelper::SetHoldingEnabled */ |
|
67 IMPORT_C void SetHoldingEnabled( TBool aEnabled ); |
|
68 /** @see CGestureHelper::IsHoldingEnabled */ |
|
69 IMPORT_C TBool IsHoldingEnabled() const; |
|
70 /** @see CGestureHelper::SetDoubleTapEnabled */ |
|
71 IMPORT_C void SetDoubleTapEnabled( TBool aEnabled ); |
|
72 /** @see CGestureHelper::IsDoubleTapEnabled */ |
|
73 IMPORT_C TBool IsDoubleTapEnabled() const; |
|
74 |
|
75 protected: |
|
76 /** Constructor */ |
|
77 IMPORT_C CGestureControl(); |
|
78 |
|
79 /** |
|
80 * Deriving class is expected to create a visual to receive pointer events. |
|
81 * This base class does not create a visual (unless creates via NewLC, i.e., |
|
82 * in that case this class is not derived from) |
|
83 * @param aFreeControlGroupId control group id that client does not use |
|
84 */ |
|
85 IMPORT_C void ConstructL( MGestureObserver& aObserver, |
|
86 CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId ); |
|
87 |
|
88 private: |
|
89 /// Helper that provides gestures |
|
90 CGestureHelper* iHelper; |
|
91 }; |
|
92 |
|
93 } // namespace RT_GestureHelper |
|
94 |
|
95 #endif // _RT_GESTURECONTROL_H_ |