williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Interface for using area registry and direct feedback from
|
williamr@2
|
15 |
* applications and UI controls.
|
williamr@4
|
16 |
* Part of: Tactile Feedback.
|
williamr@2
|
17 |
*
|
williamr@2
|
18 |
*/
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#ifndef M_TOUCHFEEDBACK_H
|
williamr@2
|
23 |
#define M_TOUCHFEEDBACK_H
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#include <e32std.h>
|
williamr@2
|
26 |
#include <e32base.h>
|
williamr@2
|
27 |
#include <coemain.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
#include <touchlogicalfeedback.h>
|
williamr@4
|
30 |
#include <touchfeedbackspec.h>
|
williamr@2
|
31 |
|
williamr@2
|
32 |
class CCoeControl;
|
williamr@2
|
33 |
|
williamr@2
|
34 |
/**
|
williamr@2
|
35 |
* This is the Tactile Feedback interface for UI Controls.
|
williamr@2
|
36 |
*
|
williamr@2
|
37 |
* Provides an interface to add, modify and remove feedback areas
|
williamr@2
|
38 |
* in the registry. There is also an option to trigger direct feedback,
|
williamr@2
|
39 |
* hence bypassing the registry.
|
williamr@2
|
40 |
*
|
williamr@2
|
41 |
* Feedback areas must always be related to some UI Control (derived
|
williamr@2
|
42 |
* from CCoeControl). Areas are distinguished from each other based on
|
williamr@2
|
43 |
* control's address and an index number (so that it is possible
|
williamr@2
|
44 |
* to register and maintain multiple areas for same control).
|
williamr@2
|
45 |
*
|
williamr@2
|
46 |
* Clients must add, maintain and remove their feedback areas using this
|
williamr@2
|
47 |
* API according to the state changes of the application / control, and
|
williamr@2
|
48 |
* according to for e.g. device wide layout changes.
|
williamr@2
|
49 |
*
|
williamr@2
|
50 |
* There are two cases when tactile framework automatically updates the
|
williamr@2
|
51 |
* feedback areas for control: Feedback is always disabled when control
|
williamr@2
|
52 |
* becomes dimmed and re-enabled when control becomes undimmed again.
|
williamr@2
|
53 |
* If control becomes invisible, then feedback areas are (temporarily)
|
williamr@2
|
54 |
* removed, and they will be automatically added again when control
|
williamr@2
|
55 |
* becomes visible again.
|
williamr@2
|
56 |
*
|
williamr@2
|
57 |
* This class is not intended for derivation outside the library.
|
williamr@2
|
58 |
*
|
williamr@2
|
59 |
* @lib touchfeedback.lib
|
williamr@2
|
60 |
* @since S60 v5.0
|
williamr@2
|
61 |
*/
|
williamr@2
|
62 |
class MTouchFeedback
|
williamr@2
|
63 |
{
|
williamr@2
|
64 |
public:
|
williamr@2
|
65 |
|
williamr@2
|
66 |
/**
|
williamr@2
|
67 |
* Used for acquiring a pointer to touch feedback instance.
|
williamr@2
|
68 |
*
|
williamr@2
|
69 |
* Pointer is retrieved from thread local storage, and thus it is best
|
williamr@2
|
70 |
* to store the returned pointer as member variable in case it will
|
williamr@2
|
71 |
* be needed frequently.
|
williamr@2
|
72 |
*
|
williamr@2
|
73 |
* NULL is returned in case there is no instance. In that case
|
williamr@2
|
74 |
* CreateInstanceL -function can be used for creating a new instance.
|
williamr@2
|
75 |
*
|
williamr@2
|
76 |
* @since S60 5.0
|
williamr@2
|
77 |
* @return Pointer to touch feedback instance created for this
|
williamr@2
|
78 |
* application process.
|
williamr@2
|
79 |
*/
|
williamr@2
|
80 |
IMPORT_C static MTouchFeedback* Instance();
|
williamr@2
|
81 |
|
williamr@2
|
82 |
/**
|
williamr@2
|
83 |
* Creates a new touch feedback instance. The usage of
|
williamr@2
|
84 |
* this function should only be necessary from processes which
|
williamr@2
|
85 |
* are not GUI applications, but which still have user interface
|
williamr@2
|
86 |
* (or want to play direct feedback).
|
williamr@2
|
87 |
*
|
williamr@2
|
88 |
* DestroyInstance -function must be called for deleting the instance
|
williamr@2
|
89 |
* when it is no longer needed.
|
williamr@2
|
90 |
*
|
williamr@2
|
91 |
* @since S60 5.0
|
williamr@2
|
92 |
* @return Pointer to new touch feedback instance.
|
williamr@2
|
93 |
*/
|
williamr@2
|
94 |
IMPORT_C static MTouchFeedback* CreateInstanceL();
|
williamr@2
|
95 |
|
williamr@2
|
96 |
/**
|
williamr@2
|
97 |
* Destroys the touch feedback instance and clears pointer in
|
williamr@2
|
98 |
* thread local storage.
|
williamr@2
|
99 |
*
|
williamr@2
|
100 |
* This function must only be used in case touch feedback has been
|
williamr@2
|
101 |
* created with CreateInstanceL -function. I.e. normal GUI applications
|
williamr@2
|
102 |
* should never call this function.
|
williamr@2
|
103 |
*
|
williamr@2
|
104 |
* @since S60 5.0
|
williamr@2
|
105 |
*/
|
williamr@2
|
106 |
IMPORT_C static void DestroyInstance();
|
williamr@2
|
107 |
|
williamr@2
|
108 |
/**
|
williamr@2
|
109 |
* This function can be used to check, whether touch feedback is
|
williamr@2
|
110 |
* supported at all in the device.
|
williamr@2
|
111 |
*
|
williamr@2
|
112 |
* All the API functions can be called safely even if touch feedback
|
williamr@2
|
113 |
* is not enabled (for e.g. in devices without touch screen). But in
|
williamr@2
|
114 |
* some situations registry updates can require complex calculations,
|
williamr@2
|
115 |
* which can be skipped if touch feedback is not enabled at all.
|
williamr@2
|
116 |
*
|
williamr@2
|
117 |
* Notice that the settings related to touch feedback have no effect
|
williamr@2
|
118 |
* on the behavior of this function. I.e. even if user turns touch
|
williamr@2
|
119 |
* feedback OFF from settings, this function still returns
|
williamr@2
|
120 |
* ETrue. The reason for this is that registry updates must be done
|
williamr@2
|
121 |
* anyway even if the feedback is not on for the moment, because
|
williamr@2
|
122 |
* user can turn it on at anytime, and it is not possible to force
|
williamr@2
|
123 |
* an update for all applications in that case.
|
williamr@2
|
124 |
*
|
williamr@2
|
125 |
* @since S60 5.0
|
williamr@2
|
126 |
* @return ETrue if touch feedback is supported in this device.
|
williamr@2
|
127 |
*/
|
williamr@2
|
128 |
virtual TBool TouchFeedbackSupported() = 0;
|
williamr@2
|
129 |
|
williamr@2
|
130 |
/**
|
williamr@2
|
131 |
* Used for disabling or enabling feedback in the application.
|
williamr@2
|
132 |
*
|
williamr@2
|
133 |
* Tactile feedback is enabled by default, and thus standard
|
williamr@2
|
134 |
* S60 components (such as CBA, lists and options menu) automatically
|
williamr@2
|
135 |
* give feedback even if the application itself would make no effort
|
williamr@2
|
136 |
* for producing feedback.
|
williamr@2
|
137 |
*
|
williamr@2
|
138 |
* For some applications (such as games) feedback might not be
|
williamr@2
|
139 |
* wanted at all. In addition some applications may need to disable
|
williamr@2
|
140 |
* feedback in some specific situations. For example: A camera
|
williamr@2
|
141 |
* application may need to disable feedback during video recording,
|
williamr@2
|
142 |
* because otherwise feedbacks may cause disturbing sounds that
|
williamr@2
|
143 |
* will be recorded into the video clip.
|
williamr@2
|
144 |
*
|
williamr@2
|
145 |
* Notice that this function only affects direct feedback and
|
williamr@2
|
146 |
* area registry based feedback for this application. I.e. if this
|
williamr@2
|
147 |
* application is taken to background, other applications can still
|
williamr@2
|
148 |
* produce feedback.
|
williamr@2
|
149 |
*
|
williamr@2
|
150 |
* Also notice that enabling feedback doesn't still mean that feedback
|
williamr@2
|
151 |
* would necessarily be generated, because user may have disabled the
|
williamr@2
|
152 |
* feedback for whole device from the settings.
|
williamr@2
|
153 |
*
|
williamr@2
|
154 |
* @since S60 5.0
|
williamr@2
|
155 |
* @param aEnabled - Give ETrue as parameter for enabling feedback, and
|
williamr@2
|
156 |
* EFalse for disabling feedback.
|
williamr@2
|
157 |
*/
|
williamr@2
|
158 |
virtual void SetFeedbackEnabledForThisApp( TBool aEnabled ) = 0;
|
williamr@2
|
159 |
|
williamr@2
|
160 |
/**
|
williamr@2
|
161 |
* Used to check whether feedback is enabled for this application.
|
williamr@2
|
162 |
*
|
williamr@2
|
163 |
* Notice that this function only returns what was given as parameter
|
williamr@2
|
164 |
* to SetFeedbackEnabledForThisApp -function. I.e. this function
|
williamr@2
|
165 |
* can return ETrue even if feedback would be currently disabled
|
williamr@2
|
166 |
* from settings.
|
williamr@2
|
167 |
*
|
williamr@2
|
168 |
* If only vibra or audio feedback is enabled, this function still
|
williamr@2
|
169 |
* returns ETrue.
|
williamr@2
|
170 |
*
|
williamr@2
|
171 |
* @since S60 5.0
|
williamr@2
|
172 |
* @return ETrue if feedback is enabled for this application.
|
williamr@2
|
173 |
*/
|
williamr@2
|
174 |
virtual TBool FeedbackEnabledForThisApp() = 0;
|
williamr@2
|
175 |
|
williamr@2
|
176 |
/**
|
williamr@2
|
177 |
* Sets or updates rectangular feedback area to registry.
|
williamr@2
|
178 |
*
|
williamr@2
|
179 |
* If this is new area (i.e. there is not yet area with given control
|
williamr@2
|
180 |
* address and area index in the registry), then this area will be
|
williamr@2
|
181 |
* added as the top priority area for its window, i.e. this
|
williamr@2
|
182 |
* area will be hit test first when pointer event arrives.
|
williamr@2
|
183 |
*
|
williamr@2
|
184 |
* Notice however, that this area will remain as top priority area only
|
williamr@2
|
185 |
* until the next new area is added to the registry, or until
|
williamr@2
|
186 |
* MoveFeedbackAreaToFirstPriority -function is called. I.e. new areas
|
williamr@2
|
187 |
* are always put on top priority, but they will only remain on top
|
williamr@2
|
188 |
* until they will be overridden by next area.
|
williamr@2
|
189 |
*
|
williamr@2
|
190 |
* The control that is given as parameter should usually be the one
|
williamr@2
|
191 |
* that is responsible of handling the pointer events on the
|
williamr@2
|
192 |
* corresponding feedback area.
|
williamr@2
|
193 |
*
|
williamr@2
|
194 |
* The area can later be identified by passing control pointer and
|
williamr@2
|
195 |
* index as parameters to the other functions (for modifying or
|
williamr@2
|
196 |
* removing the feedback area). In case control only
|
williamr@2
|
197 |
* registers one area, then index 0 can always be used. Usually most
|
williamr@2
|
198 |
* sensible approach is to use indexes 1, 2, 3 etc. for additional
|
williamr@2
|
199 |
* feedback areas, but in practice any desired index values can be
|
williamr@2
|
200 |
* used.
|
williamr@2
|
201 |
*
|
williamr@2
|
202 |
* Notice that if given control is dimmed, then feedback type will
|
williamr@2
|
203 |
* be set to "None". If given control is not visible, then feedback
|
williamr@2
|
204 |
* area will not be added to registry at all (for now). However,
|
williamr@2
|
205 |
* registry is automatically updated when control's dimming or
|
williamr@2
|
206 |
* visibility changes, so one can call this function also for
|
williamr@2
|
207 |
* dimmed and invisible control.
|
williamr@2
|
208 |
*
|
williamr@2
|
209 |
* When the control given as parameter to this function is destroyed,
|
williamr@2
|
210 |
* then the RemoveFeedbackForControl -function must be called while
|
williamr@2
|
211 |
* giving the same control as parameter again. This is necessary
|
williamr@2
|
212 |
* for removing all the feedback areas, and also for resetting the
|
williamr@2
|
213 |
* state information stored by the API implementation.
|
williamr@2
|
214 |
*
|
williamr@2
|
215 |
* @since S60 5.0
|
williamr@2
|
216 |
* @param aControl - The control handling pointer events on this
|
williamr@2
|
217 |
feedback area.
|
williamr@2
|
218 |
* @param aIndex - The index number of the area to be added.
|
williamr@2
|
219 |
* @param aRect - The feedback area rectangle.
|
williamr@2
|
220 |
* @param aFeedbackType - The logical feedback type given
|
williamr@2
|
221 |
* @param aEventType - The pointer event type that triggers the
|
williamr@2
|
222 |
* feedback (currently only ETouchEventStylusDown
|
williamr@2
|
223 |
* is supported).
|
williamr@2
|
224 |
* @return KErrNone, or one of standard Symbian OS error codes
|
williamr@2
|
225 |
* if setting of area to registry failed.
|
williamr@2
|
226 |
* Some specific error codes:
|
williamr@2
|
227 |
* KErrArgument - A NULL pointer was given as first parameter, or
|
williamr@2
|
228 |
* the given control does not have any window
|
williamr@2
|
229 |
* associated to it.
|
williamr@2
|
230 |
* KErrNotSupported - Unsupported logical feedback type or
|
williamr@2
|
231 |
* event type was given as parameter.
|
williamr@2
|
232 |
*/
|
williamr@2
|
233 |
virtual TInt SetFeedbackArea( const CCoeControl* aControl,
|
williamr@2
|
234 |
TUint32 aIndex,
|
williamr@2
|
235 |
TRect aRect,
|
williamr@2
|
236 |
TTouchLogicalFeedback aFeedbackType,
|
williamr@2
|
237 |
TTouchEventType aEventType ) = 0;
|
williamr@2
|
238 |
|
williamr@2
|
239 |
/**
|
williamr@2
|
240 |
* Removes feedback area from the registry.
|
williamr@2
|
241 |
*
|
williamr@2
|
242 |
* This function is designed to be used in case feedback areas
|
williamr@2
|
243 |
* need to be removed elsewhere than in control's destructor. In
|
williamr@2
|
244 |
* control's destructor RemoveFeedbackForControl -function must be
|
williamr@2
|
245 |
* used instead.
|
williamr@2
|
246 |
*
|
williamr@2
|
247 |
* @since S60 5.0
|
williamr@2
|
248 |
* @param aControl - The control, who has registered the area.
|
williamr@2
|
249 |
* @param aIndex - The index of the area to be removed.
|
williamr@2
|
250 |
*/
|
williamr@2
|
251 |
virtual void RemoveFeedbackArea( const CCoeControl* aControl,
|
williamr@2
|
252 |
TUint32 aIndex ) = 0;
|
williamr@2
|
253 |
|
williamr@2
|
254 |
/**
|
williamr@2
|
255 |
* Removes all feedback areas of specified control from registry.
|
williamr@2
|
256 |
*
|
williamr@2
|
257 |
* This function also clears all related data that has been cached
|
williamr@2
|
258 |
* by the API implementation, and thus it must always be called from
|
williamr@2
|
259 |
* control's destructor in case control has used any of the following
|
williamr@2
|
260 |
* functions:
|
williamr@2
|
261 |
* - SetFeedbackArea
|
williamr@2
|
262 |
* - EnableFeedbackForControl
|
williamr@2
|
263 |
*
|
williamr@2
|
264 |
* Especially notice that it is not enough to remove all feedback areas
|
williamr@2
|
265 |
* individually by using RemoveFeedbackArea -function.
|
williamr@2
|
266 |
*
|
williamr@2
|
267 |
* The difference between this function and EnableFeedbackForControl
|
williamr@2
|
268 |
* -function is that this function really removes all areas related
|
williamr@2
|
269 |
* to this control from registry, whereas EnableFeedbackForControl
|
williamr@2
|
270 |
* (when EFalse if given as parameter) only temporarily disables
|
williamr@2
|
271 |
* those areas.
|
williamr@2
|
272 |
*
|
williamr@2
|
273 |
* @since S60 5.0
|
williamr@2
|
274 |
* @param aControl - Pointer to the control, whose area registry
|
williamr@2
|
275 |
* entries and cached information will be removed.
|
williamr@2
|
276 |
*/
|
williamr@2
|
277 |
virtual void RemoveFeedbackForControl( const CCoeControl* aControl ) = 0;
|
williamr@2
|
278 |
|
williamr@2
|
279 |
/**
|
williamr@2
|
280 |
* Changes feedback area in the registry.
|
williamr@2
|
281 |
*
|
williamr@2
|
282 |
* The area must have been originally added to the registry with
|
williamr@2
|
283 |
* SetFeedbackArea -function, or otherwise this function will
|
williamr@2
|
284 |
* do nothing.
|
williamr@2
|
285 |
*
|
williamr@2
|
286 |
* This function is intended to be used especially in
|
williamr@2
|
287 |
* portrait / landscape changes.
|
williamr@2
|
288 |
*
|
williamr@2
|
289 |
* If given CCoeControl pointer is NULL, then this function call
|
williamr@2
|
290 |
* does nothing.
|
williamr@2
|
291 |
*
|
williamr@2
|
292 |
* @since S60 5.0
|
williamr@2
|
293 |
* @param aControl - The control, who has registered the area.
|
williamr@2
|
294 |
* @param aIndex - The index number of the area, that will be changed.
|
williamr@2
|
295 |
* @param aNewRect - New area rectangle for given feedback area.
|
williamr@2
|
296 |
*/
|
williamr@2
|
297 |
virtual void ChangeFeedbackArea( const CCoeControl* aControl,
|
williamr@2
|
298 |
TUint32 aIndex,
|
williamr@2
|
299 |
TRect aNewRect ) = 0;
|
williamr@2
|
300 |
|
williamr@2
|
301 |
/**
|
williamr@2
|
302 |
* Changes feedback type in the registry.
|
williamr@2
|
303 |
*
|
williamr@2
|
304 |
* Feedback can be temporarily disabled by giving ETouchFeedbackNone
|
williamr@2
|
305 |
* as parameter (although using EnableFeedbackForControl function with
|
williamr@2
|
306 |
* parameter EFalse is usually better for this functionality).
|
williamr@2
|
307 |
*
|
williamr@2
|
308 |
* The area must have been originally added to the registry with
|
williamr@2
|
309 |
* SetFeedbackArea -function, or otherwise this function will
|
williamr@2
|
310 |
* do nothing.
|
williamr@2
|
311 |
*
|
williamr@2
|
312 |
* If given control pointer is NULL, then this function call
|
williamr@2
|
313 |
* is ignored.
|
williamr@2
|
314 |
*
|
williamr@4
|
315 |
* This function only changes feedback type for down event.
|
williamr@4
|
316 |
* To change feedback types for all the events in the feedback area use
|
williamr@4
|
317 |
* function SetFeedbackArea with CFeedbackSpec container class
|
williamr@4
|
318 |
* definion instead.
|
williamr@4
|
319 |
*
|
williamr@2
|
320 |
* @since S60 5.0
|
williamr@2
|
321 |
* @param aControl - The control, who has registered the area.
|
williamr@2
|
322 |
* @param aIndex - The index number of the area, that will be changed.
|
williamr@2
|
323 |
* @param aNewType - New feedback type for the area.
|
williamr@2
|
324 |
*/
|
williamr@2
|
325 |
virtual void ChangeFeedbackType( const CCoeControl* aControl,
|
williamr@2
|
326 |
TUint32 aIndex,
|
williamr@2
|
327 |
TTouchLogicalFeedback aNewType ) = 0;
|
williamr@2
|
328 |
|
williamr@2
|
329 |
|
williamr@2
|
330 |
/**
|
williamr@2
|
331 |
* Makes the given feedback area the first priority area in the window
|
williamr@2
|
332 |
* where it is located.
|
williamr@2
|
333 |
*
|
williamr@2
|
334 |
* In practice this means that this will be the first area that is
|
williamr@2
|
335 |
* hit tested when a pointer event arrives.
|
williamr@2
|
336 |
*
|
williamr@2
|
337 |
* Notice however, that this area will only keep its top priority status
|
williamr@2
|
338 |
* until the next area is added to the registry, or until
|
williamr@2
|
339 |
* this function is called again for some other area. I.e. there is no
|
williamr@2
|
340 |
* way for giving any area a permanent status as top priority area
|
williamr@2
|
341 |
* (Registry works as a stack, and new items are added on top).
|
williamr@2
|
342 |
*
|
williamr@2
|
343 |
* If given control pointer is NULL, this function call does nothing.
|
williamr@2
|
344 |
*
|
williamr@2
|
345 |
* @since S60 5.0
|
williamr@2
|
346 |
* @param aControl - The control, who has registered the area.
|
williamr@2
|
347 |
* @param aIndex - The index number of the area, which
|
williamr@2
|
348 |
* will be prioritized.
|
williamr@2
|
349 |
*/
|
williamr@2
|
350 |
virtual void MoveFeedbackAreaToFirstPriority( const CCoeControl* aControl,
|
williamr@2
|
351 |
TUint32 aIndex ) = 0;
|
williamr@2
|
352 |
|
williamr@2
|
353 |
/**
|
williamr@2
|
354 |
* This function forces all registry changes made on client side to be
|
williamr@2
|
355 |
* sent to server side immediately.
|
williamr@2
|
356 |
*
|
williamr@2
|
357 |
* This operation causes always immediate and synchronous client-server
|
williamr@2
|
358 |
* transaction, and can possibly also cause flushing of window server
|
williamr@2
|
359 |
* client side buffer. Hence this function should only be used in case
|
williamr@2
|
360 |
* there is a synchronization problem so that feedback triggered from
|
williamr@2
|
361 |
* area registry does not correspond to the areas defined by application.
|
williamr@2
|
362 |
*
|
williamr@2
|
363 |
* This function is only likely to help in such situation, where this
|
williamr@2
|
364 |
* application's active objects are running all the time for several seconds,
|
williamr@2
|
365 |
* because in that case updates won't be transferred to server immediately.
|
williamr@2
|
366 |
*
|
williamr@2
|
367 |
* Calling this function has no effect in case there are no pending
|
williamr@2
|
368 |
* area registry updates.
|
williamr@2
|
369 |
*
|
williamr@2
|
370 |
* @since S60 5.0
|
williamr@2
|
371 |
*/
|
williamr@2
|
372 |
virtual void FlushRegistryUpdates( ) = 0;
|
williamr@2
|
373 |
|
williamr@2
|
374 |
/**
|
williamr@2
|
375 |
* Gives direct feedback.
|
williamr@2
|
376 |
*
|
williamr@2
|
377 |
* Notice that the feedback might not be actually played, if
|
williamr@2
|
378 |
* for example user has disabled the feedback from the settings.
|
williamr@2
|
379 |
*
|
williamr@2
|
380 |
* This function always causes a synchronous client-server transaction,
|
williamr@2
|
381 |
* and potentially flushing of window server client-side buffer.
|
williamr@2
|
382 |
*
|
williamr@2
|
383 |
* @since S60 5.0
|
williamr@2
|
384 |
* @param aType - The logical feedback type to play.
|
williamr@2
|
385 |
*/
|
williamr@2
|
386 |
virtual void InstantFeedback( TTouchLogicalFeedback aType ) = 0;
|
williamr@2
|
387 |
|
williamr@2
|
388 |
/**
|
williamr@2
|
389 |
* Gives direct feedback if given control has not disabled it.
|
williamr@2
|
390 |
*
|
williamr@2
|
391 |
* This function only gives feedback, if EnableFeedbackForControl
|
williamr@2
|
392 |
* function has NOT been called on given control with second
|
williamr@2
|
393 |
* parameter EFalse.
|
williamr@2
|
394 |
*
|
williamr@2
|
395 |
* This overload is recommended when
|
williamr@2
|
396 |
* feedback is triggered from UI controls, because then the owner
|
williamr@2
|
397 |
* of the control can decide whether both area registry based and
|
williamr@2
|
398 |
* direct feedback should be enabled or not.
|
williamr@2
|
399 |
*
|
williamr@2
|
400 |
* If feedback is enabled for the given control, then this function
|
williamr@2
|
401 |
* causes a synchronous client-server transaction,
|
williamr@2
|
402 |
* and potentially flushing of window server client-side buffer.
|
williamr@2
|
403 |
*
|
williamr@2
|
404 |
* @since S60 5.0
|
williamr@4
|
405 |
* @param aControl - The control, who wishes to play feedback.
|
williamr@2
|
406 |
* @param aType - The logical feedback type to play.
|
williamr@2
|
407 |
*/
|
williamr@2
|
408 |
virtual void InstantFeedback( const CCoeControl* aControl,
|
williamr@2
|
409 |
TTouchLogicalFeedback aType ) = 0;
|
williamr@2
|
410 |
|
williamr@2
|
411 |
|
williamr@2
|
412 |
/**
|
williamr@2
|
413 |
* Can be used for querying, whether given control has any feedback
|
williamr@2
|
414 |
* areas registered.
|
williamr@2
|
415 |
*
|
williamr@2
|
416 |
* It does not matter whether the areas are disabled or enabled for
|
williamr@2
|
417 |
* the moment.
|
williamr@2
|
418 |
*
|
williamr@2
|
419 |
* Notice that one should not usually call this function, as it
|
williamr@2
|
420 |
* is always allowed to call for example RemoveFeedbackArea
|
williamr@2
|
421 |
* -function without checking if the area really exists (this
|
williamr@2
|
422 |
* is done internally in the API implementation anyway).
|
williamr@2
|
423 |
*
|
williamr@2
|
424 |
* @since S60 5.0
|
williamr@2
|
425 |
* @param aControl - Pointer to the control, whose feedback is
|
williamr@2
|
426 |
* queried.
|
williamr@2
|
427 |
* @return ETrue if the given control has at least one feedback
|
williamr@2
|
428 |
* area defined. EFalse otherwise.
|
williamr@2
|
429 |
*/
|
williamr@2
|
430 |
virtual TBool ControlHasFeedback( const CCoeControl* aControl ) = 0;
|
williamr@2
|
431 |
|
williamr@2
|
432 |
/**
|
williamr@2
|
433 |
* Can be used for querying, whether given control has a feedback
|
williamr@2
|
434 |
* area defined with given index number.
|
williamr@2
|
435 |
*
|
williamr@2
|
436 |
* It does not matter whether the areas are disabled or enabled for
|
williamr@2
|
437 |
* the moment.
|
williamr@2
|
438 |
*
|
williamr@2
|
439 |
* Notice that one should not usually call this function, as it
|
williamr@2
|
440 |
* is always allowed to call for example RemoveFeedbackArea
|
williamr@2
|
441 |
* -function without checking if the area really exists (this
|
williamr@2
|
442 |
* is done internally in the API implementation anyway).
|
williamr@2
|
443 |
*
|
williamr@2
|
444 |
* @since S60 5.0
|
williamr@2
|
445 |
* @param aControl - Pointer to the control, whose feedback is
|
williamr@2
|
446 |
* queried.
|
williamr@2
|
447 |
* @param aIndex - The index number of the area which is queried.
|
williamr@2
|
448 |
* @return ETrue if the given control has a feedback area defined
|
williamr@2
|
449 |
* with given index number. EFalse otherwise.
|
williamr@2
|
450 |
*/
|
williamr@2
|
451 |
virtual TBool ControlHasFeedback( const CCoeControl* aControl,
|
williamr@2
|
452 |
TUint32 aIndex ) = 0;
|
williamr@2
|
453 |
|
williamr@2
|
454 |
/**
|
williamr@2
|
455 |
* This function enables or disables all feedback areas registered for
|
williamr@2
|
456 |
* the given control. Disabling also affects to the overloaded version
|
williamr@2
|
457 |
* of InstantFeedback -function, so that feedback is not played if
|
williamr@2
|
458 |
* the control given as parameter has its feedback disabled.
|
williamr@2
|
459 |
*
|
williamr@2
|
460 |
* This function can be used for temporarily disabling
|
williamr@2
|
461 |
* the feedback for some given control. Calling with second parameter
|
williamr@2
|
462 |
* ETrue re-enables feedback areas, but it still does not
|
williamr@2
|
463 |
* guarantee any feedback (control can be dimmed, invisible, of may not
|
williamr@2
|
464 |
* even have any feedback areas registered).
|
williamr@2
|
465 |
*
|
williamr@2
|
466 |
* This function affects both vibra- and audio feedback.
|
williamr@2
|
467 |
*
|
williamr@2
|
468 |
* Any control that uses this function must call RemoveFeedbackForControl
|
williamr@2
|
469 |
* -function in its destructor.
|
williamr@2
|
470 |
*
|
williamr@2
|
471 |
* @since S60 5.0
|
williamr@2
|
472 |
* @param aControl - Pointer to control, whose feedback will be
|
williamr@2
|
473 |
* enabled or disabled according to second parameter.
|
williamr@2
|
474 |
* @param aEnable - Use EFalse for temporary disabling the feedback for
|
williamr@2
|
475 |
* this control, and ETrue for restoring the situation
|
williamr@2
|
476 |
* to normal.
|
williamr@2
|
477 |
*/
|
williamr@2
|
478 |
virtual void EnableFeedbackForControl( const CCoeControl* aControl,
|
williamr@2
|
479 |
TBool aEnable ) = 0;
|
williamr@2
|
480 |
|
williamr@2
|
481 |
/**
|
williamr@2
|
482 |
* This function can be used for separately enabling or disabling audio-
|
williamr@2
|
483 |
* and vibra feedback for the given control.
|
williamr@2
|
484 |
*
|
williamr@2
|
485 |
* Otherwise the function behaves in the same way as the overload with
|
williamr@2
|
486 |
* only one TBool parameter.
|
williamr@2
|
487 |
*
|
williamr@2
|
488 |
* Any control that uses this function must call RemoveFeedbackForControl
|
williamr@2
|
489 |
* -function in its destructor.
|
williamr@2
|
490 |
*
|
williamr@2
|
491 |
* @since S60 5.0
|
williamr@2
|
492 |
* @param aControl - Pointer to control, whose audio- and vibra
|
williamr@2
|
493 |
* feedback will be enabled or disabled according
|
williamr@2
|
494 |
* to given parameters.
|
williamr@2
|
495 |
* @param aEnableVibra - Use EFalse for temporary disabling the vibra
|
williamr@2
|
496 |
* feedback for this control, and ETrue for
|
williamr@2
|
497 |
* restoring the situation to normal.
|
williamr@2
|
498 |
* @param aEnableAudio - Use EFalse for temporary disabling the audio
|
williamr@2
|
499 |
* feedback for this control, and ETrue for
|
williamr@2
|
500 |
* restoring the situation to normal.
|
williamr@2
|
501 |
*/
|
williamr@2
|
502 |
virtual void EnableFeedbackForControl( const CCoeControl* aControl,
|
williamr@2
|
503 |
TBool aEnableVibra,
|
williamr@2
|
504 |
TBool aEnableAudio ) = 0;
|
williamr@2
|
505 |
|
williamr@2
|
506 |
/**
|
williamr@4
|
507 |
* Used for disabling/enabling audio/vibra feedback in
|
williamr@4
|
508 |
* the application.
|
williamr@2
|
509 |
*
|
williamr@2
|
510 |
* This is identical with the overload which has only one parameter,
|
williamr@2
|
511 |
* with the exception that one can disable audio and vibra feedback
|
williamr@2
|
512 |
* separately with this version.
|
williamr@2
|
513 |
*
|
williamr@2
|
514 |
* @since S60 5.0
|
williamr@2
|
515 |
* @param aVibraEnabled - Give ETrue as parameter for enabling vibra
|
williamr@2
|
516 |
* feedback, and EFalse for disabling vibra
|
williamr@2
|
517 |
* feedback for this application.
|
williamr@2
|
518 |
* @param aAudioEnabled - Give ETrue as parameter for enabling audio
|
williamr@2
|
519 |
* feedback, and EFalse for disabling audio
|
williamr@2
|
520 |
* feedback for this application.
|
williamr@2
|
521 |
*/
|
williamr@2
|
522 |
virtual void SetFeedbackEnabledForThisApp( TBool aVibraEnabled,
|
williamr@4
|
523 |
TBool aAudioEnabled ) = 0;
|
williamr@4
|
524 |
|
williamr@4
|
525 |
|
williamr@4
|
526 |
/**
|
williamr@4
|
527 |
* Used to check whether audio or vibra feedback is enabled for this application.
|
williamr@4
|
528 |
*
|
williamr@4
|
529 |
* Notice that this function only returns what was given as parameter
|
williamr@4
|
530 |
* to SetFeedbackEnabledForThisApp -function. I.e. this function
|
williamr@4
|
531 |
* can return ETrue even if feedback would be currently disabled
|
williamr@4
|
532 |
* from settings.
|
williamr@4
|
533 |
*
|
williamr@4
|
534 |
* @since S60 5.2
|
williamr@4
|
535 |
* @param aFeedbackType - Feedback type.
|
williamr@4
|
536 |
* @return ETrue if asked feedback type is enabled for this application.
|
williamr@4
|
537 |
*/
|
williamr@4
|
538 |
virtual TBool FeedbackEnabledForThisApp( TTouchFeedbackType aFeedbackType ) = 0;
|
williamr@4
|
539 |
|
williamr@4
|
540 |
/**
|
williamr@4
|
541 |
* Starts continuous feedback if given control has not disabled it.
|
williamr@4
|
542 |
*
|
williamr@4
|
543 |
* Only one continuous feedback per control can be played simultaneously.
|
williamr@4
|
544 |
* Started feedback will be stopped automatically if application loses
|
williamr@4
|
545 |
* key focus or application crashes or some other control starts
|
williamr@4
|
546 |
* continuous feedback.
|
williamr@4
|
547 |
*
|
williamr@4
|
548 |
* If StartFeedback is called again for the same control, then feedback
|
williamr@4
|
549 |
* type and intensity are modified accordingly. This may cause a break
|
williamr@4
|
550 |
* in the feedback effect in case feedback type changes.
|
williamr@4
|
551 |
*
|
williamr@4
|
552 |
* EnableFeedbackForControl also affects to this function so that
|
williamr@4
|
553 |
* feedback is not given if EnableFeedbackForControl
|
williamr@4
|
554 |
* function has been called with second and third parameter EFalse.
|
williamr@4
|
555 |
*
|
williamr@4
|
556 |
* @since S60 5.2
|
williamr@4
|
557 |
* @param aControl - The control, who wishes to play feedback.
|
williamr@4
|
558 |
* @param aType - The continuous feedback type to play.
|
williamr@4
|
559 |
* @param aPointerEvent - Pointer event which triggered this feedback
|
williamr@4
|
560 |
* (give NULL as parameter if no related pointer
|
williamr@4
|
561 |
* event available)
|
williamr@4
|
562 |
* @param aIntensity - Feedback intensity to begin with. range 0-100%.
|
williamr@4
|
563 |
* Use 50% if no reason to use other value.
|
williamr@4
|
564 |
* @param aTimeout - Timeout value to automatically stop continuous
|
williamr@4
|
565 |
* feedback if there's no new Start call within the
|
williamr@4
|
566 |
* timeout. Use value 0 if timeout is not used.
|
williamr@4
|
567 |
*/
|
williamr@4
|
568 |
virtual void StartFeedback( const CCoeControl* aControl,
|
williamr@4
|
569 |
TTouchContinuousFeedback aType,
|
williamr@4
|
570 |
const TPointerEvent* aPointerEvent,
|
williamr@4
|
571 |
TInt aIntensity,
|
williamr@4
|
572 |
TTimeIntervalMicroSeconds32 aTimeout ) = 0;
|
williamr@4
|
573 |
|
williamr@4
|
574 |
|
williamr@4
|
575 |
/**
|
williamr@4
|
576 |
* This function modifies intensity of continuous feedback on the fly.
|
williamr@4
|
577 |
*
|
williamr@4
|
578 |
* @since S60 5.2
|
williamr@4
|
579 |
* @param aControl - The control which continuous feedback is modified.
|
williamr@4
|
580 |
* @param aIntensity - New intensity value. range 0-100%
|
williamr@4
|
581 |
*/
|
williamr@4
|
582 |
virtual void ModifyFeedback( const CCoeControl* aControl,
|
williamr@4
|
583 |
TInt aIntensity ) = 0;
|
williamr@4
|
584 |
|
williamr@4
|
585 |
|
williamr@4
|
586 |
/**
|
williamr@4
|
587 |
* This function stops continuous feedback.
|
williamr@4
|
588 |
*
|
williamr@4
|
589 |
* @since S60 5.2
|
williamr@4
|
590 |
* @param aControl - The control which continuous feedback is stopped.
|
williamr@4
|
591 |
*/
|
williamr@4
|
592 |
virtual void StopFeedback( const CCoeControl* aControl ) = 0;
|
williamr@4
|
593 |
|
williamr@4
|
594 |
|
williamr@4
|
595 |
/**
|
williamr@4
|
596 |
* This function enables or disables audio or/and vibra feedback in
|
williamr@4
|
597 |
* whole device.
|
williamr@4
|
598 |
*
|
williamr@4
|
599 |
* Tactile feedback is enabled by default, and thus standard
|
williamr@4
|
600 |
* S60 components (such as CBA, lists and options menu) automatically
|
williamr@4
|
601 |
* give feedback even if the application itself would make no effort
|
williamr@4
|
602 |
* for producing feedback.
|
williamr@4
|
603 |
*
|
williamr@4
|
604 |
* Requires WriteDeviceData capability
|
williamr@4
|
605 |
*
|
williamr@4
|
606 |
* @since S60 5.2
|
williamr@4
|
607 |
* @param aFeedbackType - Feedback types to be enabled/disabled defined as
|
williamr@4
|
608 |
* a bitmask combination of enumeration items from
|
williamr@4
|
609 |
* TTouchFeedbackType
|
williamr@4
|
610 |
* @return KErrNone, or one of standard Symbian OS error codes
|
williamr@4
|
611 |
* if user has not WriteDeviceData capability.
|
williamr@4
|
612 |
*/
|
williamr@4
|
613 |
virtual TInt SetFeedbackEnabledForDevice( TTouchFeedbackType aFeedbackType ) = 0;
|
williamr@4
|
614 |
|
williamr@4
|
615 |
|
williamr@4
|
616 |
/**
|
williamr@4
|
617 |
* Used to check enabled feedback types for the device.
|
williamr@4
|
618 |
*
|
williamr@4
|
619 |
* Notice that this function only returns what was given as parameter
|
williamr@4
|
620 |
* to SetFeedbackEnabledForDevice -function. I.e. this function
|
williamr@4
|
621 |
* can return ETrue even if feedback would be currently disabled
|
williamr@4
|
622 |
* from settings.
|
williamr@4
|
623 |
*
|
williamr@4
|
624 |
* @since S60 5.2
|
williamr@4
|
625 |
* @return Enabled/disabled feedback types as bitmask combination.
|
williamr@4
|
626 |
*/
|
williamr@4
|
627 |
virtual TTouchFeedbackType FeedbackEnabledForDevice() = 0;
|
williamr@4
|
628 |
|
williamr@4
|
629 |
|
williamr@4
|
630 |
/**
|
williamr@4
|
631 |
* Gives direct feedback if given control has not disabled it.
|
williamr@4
|
632 |
*
|
williamr@4
|
633 |
* This overload is recommended when triggered feedback is related
|
williamr@4
|
634 |
* to pointer event. System uses aPointerEvent to avoiding
|
williamr@4
|
635 |
* two (or more) direct feedbacks for the same pointer event.
|
williamr@4
|
636 |
*
|
williamr@4
|
637 |
* @since S60 5.2
|
williamr@4
|
638 |
* @param aControl - The control, who wishes to play feedback.
|
williamr@4
|
639 |
* @param aType - The logical feedback type to play.
|
williamr@4
|
640 |
* @param aPointerEvent - pointer event which triggered this feedback.
|
williamr@4
|
641 |
*/
|
williamr@4
|
642 |
virtual void InstantFeedback( const CCoeControl* aControl,
|
williamr@4
|
643 |
TTouchLogicalFeedback aType,
|
williamr@4
|
644 |
const TPointerEvent& aPointerEvent ) = 0;
|
williamr@4
|
645 |
|
williamr@4
|
646 |
|
williamr@4
|
647 |
/**
|
williamr@4
|
648 |
* Sets or updates rectangular feedback area to registry.
|
williamr@4
|
649 |
*
|
williamr@4
|
650 |
* This overload allows user to set more than one touch event types to
|
williamr@4
|
651 |
* one feedback area. Otherwise the function behaves in the same way
|
williamr@4
|
652 |
* as the overload with separated feedback type and event type parameters.
|
williamr@4
|
653 |
*
|
williamr@4
|
654 |
* @since S60 5.2
|
williamr@4
|
655 |
* @param aControl - The control handling pointer events on this
|
williamr@4
|
656 |
* feedback area.
|
williamr@4
|
657 |
* @param aIndex - The index number of the area to be added.
|
williamr@4
|
658 |
* @param aRect - The feedback area rectangle.
|
williamr@4
|
659 |
* @param aFeedbackSpec - The specification how this feedback area
|
williamr@4
|
660 |
* triggers feedback for different touch events.
|
williamr@4
|
661 |
* @return KErrNone, or one of standard Symbian OS error codes
|
williamr@4
|
662 |
* if setting of area to registry failed.
|
williamr@4
|
663 |
* Some specific error codes:
|
williamr@4
|
664 |
* KErrArgument - A NULL pointer was given as first parameter, or
|
williamr@4
|
665 |
* the given control does not have any window
|
williamr@4
|
666 |
* associated to it.
|
williamr@4
|
667 |
* KErrNotSupported - Unsupported predefined feedback profile
|
williamr@4
|
668 |
* was given as parameter.
|
williamr@4
|
669 |
*/
|
williamr@4
|
670 |
virtual TInt SetFeedbackArea( const CCoeControl* aControl,
|
williamr@4
|
671 |
TUint32 aIndex,
|
williamr@4
|
672 |
TRect aRect,
|
williamr@4
|
673 |
CFeedbackSpec* aFeedbackSpec ) = 0;
|
williamr@4
|
674 |
|
williamr@4
|
675 |
/**
|
williamr@4
|
676 |
* Gives direct feedback if given control has not disabled it.
|
williamr@4
|
677 |
*
|
williamr@4
|
678 |
* This overload is recommended when triggered feedback is related
|
williamr@4
|
679 |
* to pointer event. System uses aPointerEvent to avoiding
|
williamr@4
|
680 |
* two (or more) direct feedbacks for the same pointer event. Using this
|
williamr@4
|
681 |
* overload it is also possible to disable unwanted feedback (vibra/audio)
|
williamr@4
|
682 |
* by giving only wanted feedback type as parameter.
|
williamr@4
|
683 |
*
|
williamr@4
|
684 |
* @since S60 5.2
|
williamr@4
|
685 |
* @param aControl - The control, who wishes to play feedback.
|
williamr@4
|
686 |
* @param aType - The logical feedback type to play.
|
williamr@4
|
687 |
* @param aFeedbackType - Feedback types to be played as a bitmask
|
williamr@4
|
688 |
* combination of enumeration items from
|
williamr@4
|
689 |
* TTouchFeedbackType
|
williamr@4
|
690 |
* @param aPointerEvent - Pointer event, which triggered this feedback.
|
williamr@4
|
691 |
*/
|
williamr@4
|
692 |
virtual void InstantFeedback( const CCoeControl* aControl,
|
williamr@4
|
693 |
TTouchLogicalFeedback aType,
|
williamr@4
|
694 |
TTouchFeedbackType aFeedbackType,
|
williamr@4
|
695 |
const TPointerEvent& aPointerEvent ) = 0;
|
williamr@4
|
696 |
|
williamr@4
|
697 |
|
williamr@4
|
698 |
|
williamr@2
|
699 |
};
|
williamr@2
|
700 |
|
williamr@2
|
701 |
|
williamr@2
|
702 |
|
williamr@2
|
703 |
#endif // M_TOUCHFEEDBACK_H
|