|
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: Area registry for one window. |
|
15 * Part of: Tactile Feedback. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_TOUCHFEEDBACKREGISTRY_H |
|
21 #define C_TOUCHFEEDBACKREGISTRY_H |
|
22 |
|
23 |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <e32base.h> |
|
27 #include <coemain.h> |
|
28 |
|
29 #include "touchlogicalfeedback.h" |
|
30 |
|
31 |
|
32 /** |
|
33 * Area registry entry |
|
34 * |
|
35 * There is one entry like this for each area that has been |
|
36 * added to the registry. |
|
37 */ |
|
38 struct TFeedbackEntry |
|
39 { |
|
40 TUint iId; |
|
41 TRect iRect; |
|
42 TTouchLogicalFeedback iFeedbackTypeDown; |
|
43 TTouchFeedbackType iFeedbackDown; |
|
44 TTouchLogicalFeedback iFeedbackTypeUp; |
|
45 TTouchFeedbackType iFeedbackUp; |
|
46 TTouchEventType iEventType; |
|
47 TBool iVibraEnabled; |
|
48 TBool iAudioEnabled; |
|
49 TBool iVisible; |
|
50 }; |
|
51 |
|
52 /** |
|
53 * Registry entry for one window. |
|
54 * |
|
55 * This class maintains area registry for one window. It offers |
|
56 * services for adding, removing and mofidying areas in the |
|
57 * registry, as well as resolving whether a pointer event |
|
58 * hit any area on the registry or not. |
|
59 * |
|
60 * @lib N/A (no exported functions) |
|
61 * @since S60 v5.0 |
|
62 */ |
|
63 NONSHARABLE_CLASS( CTouchFeedbackRegistry ): |
|
64 public CBase |
|
65 { |
|
66 |
|
67 |
|
68 public: |
|
69 |
|
70 /** |
|
71 * Instantiation mehtod |
|
72 * |
|
73 * @since S60 5.0 |
|
74 * @param aWindowHandle - The Id of the window, where this registry is |
|
75 * associated. |
|
76 */ |
|
77 static CTouchFeedbackRegistry* NewL( TUint aWindowHandle ); |
|
78 |
|
79 |
|
80 virtual ~CTouchFeedbackRegistry(); |
|
81 |
|
82 /** |
|
83 * Adds feedback area to registry. |
|
84 * |
|
85 * @param aRect - The feedback area rectangle |
|
86 * @param aFeedbackType - The logical feedback type given |
|
87 * @param aEventType - The pointer event type that triggers |
|
88 * the feedback |
|
89 * @param aId - The unique identifier for this registry area |
|
90 * @param aVibraEnabled - If ETrue is given, then vibra feedback is |
|
91 * enabled for the added area. |
|
92 * @param aAudioEnabled - If ETrue is given, then audio feedback is |
|
93 * enabled for the added area. |
|
94 * @param aVisible - If EFalse is given, then the whole area will |
|
95 * not be put to the registry. The information is |
|
96 * still stored on client-side so that area can |
|
97 * be added in case control becomes visible. |
|
98 */ |
|
99 void AddFeedbackAreaL( |
|
100 TRect aRect, |
|
101 TTouchLogicalFeedback aFeedbackTypeDown, |
|
102 TTouchFeedbackType aFeedbackDown, |
|
103 TTouchLogicalFeedback aFeedbackTypeUp, |
|
104 TTouchFeedbackType aFeedbackUp, |
|
105 TTouchEventType aEventType, |
|
106 TUint aId, |
|
107 TBool aVibraEnabled, |
|
108 TBool aAudioEnabled, |
|
109 TBool aVisible ); |
|
110 |
|
111 /** |
|
112 * Removes feedback area from the registry. |
|
113 * |
|
114 * @param aId - Identifier of the feedback area to be removed. |
|
115 */ |
|
116 void RemoveFeedbackArea( TUint aId ); |
|
117 |
|
118 /** |
|
119 * Changes feedback area in the registry. |
|
120 * |
|
121 * @param aId - Identifier of the feedback area to be changed. |
|
122 * @param aNewRect - New feedback area rectangle. |
|
123 * @return ETrue the given area was found, and if it's feedback type |
|
124 * really changed. |
|
125 * (in practice this means that changes need to be |
|
126 * updated to server). |
|
127 * EFalse otherwise. |
|
128 */ |
|
129 TBool ChangeFeedbackArea( |
|
130 TUint aId, |
|
131 TRect aNewRect ); |
|
132 |
|
133 /** |
|
134 * Changes feedback type for given area in the registry. |
|
135 * |
|
136 * @param aId - Identifier of the feedback area to be changed. |
|
137 * @param aNewFeedbackTypeDown - New logical feedback type for down event. |
|
138 * @param aNewFeedbackTypeUp - New logical feedback type for up event. |
|
139 * @return ETrue the given area was found, and if it really changed. |
|
140 * (in practice this means that changes need to be |
|
141 * updated to server). |
|
142 * EFalse otherwise. |
|
143 */ |
|
144 TBool ChangeFeedbackType( |
|
145 TUint aId, |
|
146 TTouchLogicalFeedback aNewFeedbackTypeDown, |
|
147 TTouchLogicalFeedback aNewFeedbackTypeUp ); |
|
148 |
|
149 /** |
|
150 * Makes the given feedback area a first priority area in this window |
|
151 * @param aId - The identifier of the area, which shall be prioritized. |
|
152 * @return KErrNotFound if an area with given ID is not found from the registry. |
|
153 */ |
|
154 TInt MoveFeedbackAreaToFirstPriority( TUint aId ); |
|
155 |
|
156 /** |
|
157 * Enables or disables given feedback area. This does not change area's |
|
158 * actual feedback type. |
|
159 * @param aId - The identifier of the area, which feedback shall be |
|
160 * enabled / disabled. |
|
161 * @param aVibraEnabled - Give ETrue to enable vibra feedback, and |
|
162 * EFalse to disable vibra feedback for this area. |
|
163 * @param aAudioEnabled - Give ETrue to enable audio feedback, and |
|
164 * EFalse to disable audio feedback for this area. |
|
165 * @param aVisible - Visibility status of the control, who owns |
|
166 * the area. |
|
167 * @return ETrue if registry actually changed due to this function call. |
|
168 */ |
|
169 TBool SetFeedbackEnabled( TUint aId, |
|
170 TBool aVibraEnabled, |
|
171 TBool aAudioEnabled, |
|
172 TBool aVisible ); |
|
173 |
|
174 /** |
|
175 * Returns the window handle, where this registry is associated. |
|
176 * |
|
177 * @return Window handle of associated window. |
|
178 */ |
|
179 TUint WindowHandle() const; |
|
180 |
|
181 /** |
|
182 * Returns count of areas in this registry |
|
183 */ |
|
184 TInt AreaCount(); |
|
185 |
|
186 RArray<TFeedbackEntry>* WindowRegistry(); |
|
187 |
|
188 |
|
189 private: |
|
190 |
|
191 |
|
192 CTouchFeedbackRegistry( TUint aWindowHandle ); |
|
193 |
|
194 |
|
195 private: // data |
|
196 |
|
197 /** |
|
198 * Handle number of the window, to which this registry is related. |
|
199 */ |
|
200 TUint iWindowHandle; |
|
201 |
|
202 /** |
|
203 * Array of area registry items in this window |
|
204 */ |
|
205 RArray<TFeedbackEntry> iAreaArray; |
|
206 }; |
|
207 |
|
208 |
|
209 |
|
210 #endif // C_TOUCHFEEDBACKREGISTRY_H |