epoc32/include/mw/touchfeedback.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
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@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.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@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
#ifndef M_TOUCHFEEDBACK_H
williamr@2
    22
#define M_TOUCHFEEDBACK_H
williamr@2
    23
williamr@2
    24
#include <e32std.h>
williamr@2
    25
#include <e32base.h>
williamr@2
    26
#include <coemain.h>
williamr@2
    27
williamr@2
    28
#include <touchlogicalfeedback.h>
williamr@2
    29
williamr@2
    30
class CCoeControl;
williamr@2
    31
williamr@2
    32
williamr@2
    33
/**
williamr@2
    34
 *  This is the Tactile Feedback interface for UI Controls.
williamr@2
    35
 *
williamr@2
    36
 *  Provides an interface to add, modify and remove feedback areas
williamr@2
    37
 *  in the registry. There is also an option to trigger direct feedback, 
williamr@2
    38
 *  hence bypassing the registry.
williamr@2
    39
 *
williamr@2
    40
 *  Feedback areas must always be related to some UI Control (derived
williamr@2
    41
 *  from CCoeControl). Areas are distinguished from each other based on
williamr@2
    42
 *  control's address and an index number (so that it is possible
williamr@2
    43
 *  to register and maintain multiple areas for same control).
williamr@2
    44
 *
williamr@2
    45
 *  Clients must add, maintain and remove their feedback areas using this
williamr@2
    46
 *  API according to the state changes of the application / control, and
williamr@2
    47
 *  according to for e.g. device wide layout changes.
williamr@2
    48
 *
williamr@2
    49
 *  There are two cases when tactile framework automatically updates the
williamr@2
    50
 *  feedback areas for control: Feedback is always disabled when control
williamr@2
    51
 *  becomes dimmed and re-enabled when control becomes undimmed again.
williamr@2
    52
 *  If control becomes invisible, then feedback areas are (temporarily)
williamr@2
    53
 *  removed, and they will be automatically added again when control
williamr@2
    54
 *  becomes visible again.
williamr@2
    55
 *
williamr@2
    56
 *  This class is not intended for derivation outside the library.
williamr@2
    57
 *
williamr@2
    58
 *  @lib touchfeedback.lib
williamr@2
    59
 *  @since S60 v5.0
williamr@2
    60
 */
williamr@2
    61
class MTouchFeedback
williamr@2
    62
    {
williamr@2
    63
public:
williamr@2
    64
williamr@2
    65
    /**
williamr@2
    66
     * Used for acquiring a pointer to touch feedback instance.
williamr@2
    67
     *
williamr@2
    68
     * Pointer is retrieved from thread local storage, and thus it is best
williamr@2
    69
     * to store the returned pointer as member variable in case it will
williamr@2
    70
     * be needed frequently.
williamr@2
    71
     *
williamr@2
    72
     * NULL is returned in case there is no instance. In that case 
williamr@2
    73
     * CreateInstanceL -function can be used for creating a new instance.
williamr@2
    74
     *
williamr@2
    75
     * @since S60 5.0
williamr@2
    76
     * @return Pointer to touch feedback instance created for this
williamr@2
    77
     *         application process.
williamr@2
    78
     */
williamr@2
    79
    IMPORT_C static MTouchFeedback* Instance();
williamr@2
    80
williamr@2
    81
    /**
williamr@2
    82
     * Creates a new touch feedback instance. The usage of
williamr@2
    83
     * this function should only be necessary from processes which
williamr@2
    84
     * are not GUI applications, but which still have user interface
williamr@2
    85
     * (or want to play direct feedback).
williamr@2
    86
     *
williamr@2
    87
     * DestroyInstance -function must be called for deleting the instance
williamr@2
    88
     * when it is no longer needed.
williamr@2
    89
     *
williamr@2
    90
     * @since S60 5.0
williamr@2
    91
     * @return Pointer to new touch feedback instance.
williamr@2
    92
     */
williamr@2
    93
    IMPORT_C static MTouchFeedback* CreateInstanceL();
williamr@2
    94
williamr@2
    95
    /**
williamr@2
    96
     * Destroys the touch feedback instance and clears pointer in 
williamr@2
    97
     * thread local storage.
williamr@2
    98
     *
williamr@2
    99
     * This function must only be used in case touch feedback has been
williamr@2
   100
     * created with CreateInstanceL -function. I.e. normal GUI applications
williamr@2
   101
     * should never call this function.
williamr@2
   102
     *
williamr@2
   103
     * @since S60 5.0
williamr@2
   104
     */
williamr@2
   105
    IMPORT_C static void DestroyInstance();
williamr@2
   106
williamr@2
   107
    /**
williamr@2
   108
     * This function can be used to check, whether touch feedback is
williamr@2
   109
     * supported at all in the device.
williamr@2
   110
     *
williamr@2
   111
     * All the API functions can be called safely even if touch feedback
williamr@2
   112
     * is not enabled (for e.g. in devices without touch screen). But in
williamr@2
   113
     * some situations registry updates can require complex calculations, 
williamr@2
   114
     * which can be skipped if touch feedback is not enabled at all.
williamr@2
   115
     *
williamr@2
   116
     * Notice that the settings related to touch feedback have no effect
williamr@2
   117
     * on the behavior of this function. I.e. even if user turns touch
williamr@2
   118
     * feedback OFF from settings, this function still returns 
williamr@2
   119
     * ETrue. The reason for this is that registry updates must be done
williamr@2
   120
     * anyway even if the feedback is not on for the moment, because 
williamr@2
   121
     * user can turn it on at anytime, and it is not possible to force
williamr@2
   122
     * an update for all applications in that case.
williamr@2
   123
     *
williamr@2
   124
     * @since S60 5.0
williamr@2
   125
     * @return ETrue if touch feedback is supported in this device.
williamr@2
   126
     */
williamr@2
   127
    virtual TBool TouchFeedbackSupported() = 0;
williamr@2
   128
williamr@2
   129
    /**
williamr@2
   130
     * Used for disabling or enabling feedback in the application.
williamr@2
   131
     *
williamr@2
   132
     * Tactile feedback is enabled by default, and thus standard 
williamr@2
   133
     * S60 components (such as CBA, lists and options menu) automatically 
williamr@2
   134
     * give feedback even if the application itself would make no effort 
williamr@2
   135
     * for producing feedback.
williamr@2
   136
     * 
williamr@2
   137
     * For some applications (such as games) feedback might not be
williamr@2
   138
     * wanted at all. In addition some applications may need to disable
williamr@2
   139
     * feedback in some specific situations. For example: A camera 
williamr@2
   140
     * application may need to disable feedback during video recording,
williamr@2
   141
     * because otherwise feedbacks may cause disturbing sounds that 
williamr@2
   142
     * will be recorded into the video clip.
williamr@2
   143
     *
williamr@2
   144
     * Notice that this function only affects direct feedback and 
williamr@2
   145
     * area registry based feedback for this application. I.e. if this 
williamr@2
   146
     * application is taken to background, other applications can still 
williamr@2
   147
     * produce feedback.
williamr@2
   148
     *
williamr@2
   149
     * Also notice that enabling feedback doesn't still mean that feedback
williamr@2
   150
     * would necessarily be generated, because user may have disabled the
williamr@2
   151
     * feedback for whole device from the settings.
williamr@2
   152
     *
williamr@2
   153
     * @since S60 5.0
williamr@2
   154
     * @param aEnabled - Give ETrue as parameter for enabling feedback, and
williamr@2
   155
     *                   EFalse for disabling feedback.
williamr@2
   156
     */
williamr@2
   157
    virtual void SetFeedbackEnabledForThisApp( TBool aEnabled ) = 0;
williamr@2
   158
williamr@2
   159
    /**
williamr@2
   160
     * Used to check whether feedback is enabled for this application.
williamr@2
   161
     *
williamr@2
   162
     * Notice that this function only returns what was given as parameter
williamr@2
   163
     * to SetFeedbackEnabledForThisApp -function. I.e. this function
williamr@2
   164
     * can return ETrue even if  feedback would be currently disabled
williamr@2
   165
     * from settings.
williamr@2
   166
     *
williamr@2
   167
     * If only vibra or audio feedback is enabled, this function still
williamr@2
   168
     * returns ETrue.
williamr@2
   169
     *
williamr@2
   170
     * @since S60 5.0
williamr@2
   171
     * @return ETrue if feedback is enabled for this application.
williamr@2
   172
     */
williamr@2
   173
    virtual TBool FeedbackEnabledForThisApp() = 0;
williamr@2
   174
williamr@2
   175
    /**
williamr@2
   176
     * Sets or updates rectangular feedback area to registry.
williamr@2
   177
     *
williamr@2
   178
     * If this is new area (i.e. there is not yet area with given control
williamr@2
   179
     * address and area index in the registry), then this area will be 
williamr@2
   180
     * added as the top priority area for its window, i.e. this
williamr@2
   181
     * area will be hit test first when pointer event arrives. 
williamr@2
   182
     *
williamr@2
   183
     * Notice however, that this area will remain as top priority area only
williamr@2
   184
     * until the next new area is added to the registry, or until 
williamr@2
   185
     * MoveFeedbackAreaToFirstPriority -function is called. I.e. new areas
williamr@2
   186
     * are always put on top priority, but they will only remain on top
williamr@2
   187
     * until they will be overridden by next area.
williamr@2
   188
     *
williamr@2
   189
     * The control that is given as parameter should usually be the one
williamr@2
   190
     * that is responsible of handling the pointer events on the 
williamr@2
   191
     * corresponding feedback area.
williamr@2
   192
     *
williamr@2
   193
     * The area can later be identified by passing control pointer and
williamr@2
   194
     * index as parameters to the other functions (for modifying or 
williamr@2
   195
     * removing the feedback area). In case control only
williamr@2
   196
     * registers one area, then index 0 can always be used. Usually most
williamr@2
   197
     * sensible approach is to use indexes 1, 2, 3 etc. for additional 
williamr@2
   198
     * feedback areas, but in practice any desired index values can be
williamr@2
   199
     * used.
williamr@2
   200
     *
williamr@2
   201
     * Notice that if given control is dimmed, then feedback type will
williamr@2
   202
     * be set to "None". If given control is not visible, then feedback
williamr@2
   203
     * area will not be added to registry at all (for now). However, 
williamr@2
   204
     * registry is automatically updated when control's dimming or 
williamr@2
   205
     * visibility changes, so one can call this function also for
williamr@2
   206
     * dimmed and invisible control.
williamr@2
   207
     *
williamr@2
   208
     * When the control given as parameter to this function is destroyed,
williamr@2
   209
     * then the RemoveFeedbackForControl -function must be called while
williamr@2
   210
     * giving the same control as parameter again. This is necessary
williamr@2
   211
     * for removing all the feedback areas, and also for resetting the
williamr@2
   212
     * state information stored by the API implementation.
williamr@2
   213
     *
williamr@2
   214
     * @since S60 5.0
williamr@2
   215
     * @param aControl      - The control handling pointer events on this
williamr@2
   216
                              feedback area.
williamr@2
   217
     * @param aIndex        - The index number of the area to be added.
williamr@2
   218
     * @param aRect         - The feedback area rectangle.
williamr@2
   219
     * @param aFeedbackType - The logical feedback type given
williamr@2
   220
     * @param aEventType    - The pointer event type that triggers the 
williamr@2
   221
     *                        feedback (currently only ETouchEventStylusDown
williamr@2
   222
     *                        is supported).
williamr@2
   223
     * @return KErrNone, or one of standard Symbian OS error codes
williamr@2
   224
     *         if setting of area to registry failed. 
williamr@2
   225
     *         Some specific error codes:
williamr@2
   226
     *         KErrArgument - A NULL pointer was given as first parameter, or
williamr@2
   227
     *                        the given control does not have any window
williamr@2
   228
     *                        associated to it.
williamr@2
   229
     *         KErrNotSupported - Unsupported logical feedback type or
williamr@2
   230
     *                            event type was given as parameter.
williamr@2
   231
     */
williamr@2
   232
    virtual TInt SetFeedbackArea( const CCoeControl* aControl, 
williamr@2
   233
                                  TUint32 aIndex,
williamr@2
   234
                                  TRect aRect, 
williamr@2
   235
                                  TTouchLogicalFeedback aFeedbackType, 
williamr@2
   236
                                  TTouchEventType aEventType ) = 0;
williamr@2
   237
    
williamr@2
   238
    /**
williamr@2
   239
     * Removes feedback area from the registry.
williamr@2
   240
     *
williamr@2
   241
     * This function is designed to be used in case feedback areas
williamr@2
   242
     * need to be removed elsewhere than in control's destructor. In 
williamr@2
   243
     * control's destructor RemoveFeedbackForControl -function must be 
williamr@2
   244
     * used instead.
williamr@2
   245
     *
williamr@2
   246
     * @since S60 5.0
williamr@2
   247
     * @param aControl - The control, who has registered the area.
williamr@2
   248
     * @param aIndex   - The index of the area to be removed.
williamr@2
   249
     */
williamr@2
   250
    virtual void RemoveFeedbackArea( const CCoeControl* aControl, 
williamr@2
   251
                                     TUint32 aIndex ) = 0;
williamr@2
   252
    
williamr@2
   253
    /**
williamr@2
   254
     * Removes all feedback areas of specified control from registry.
williamr@2
   255
     *
williamr@2
   256
     * This function also clears all related data that has been cached
williamr@2
   257
     * by the API implementation, and thus it must always be called from 
williamr@2
   258
     * control's destructor in case control has used any of the following 
williamr@2
   259
     * functions:
williamr@2
   260
     *   - SetFeedbackArea
williamr@2
   261
     *   - EnableFeedbackForControl 
williamr@2
   262
     *
williamr@2
   263
     * Especially notice that it is not enough to remove all feedback areas 
williamr@2
   264
     * individually by using RemoveFeedbackArea -function.
williamr@2
   265
     *
williamr@2
   266
     * The difference between this function and EnableFeedbackForControl
williamr@2
   267
     * -function is that this function really removes all areas related
williamr@2
   268
     * to this control from registry, whereas EnableFeedbackForControl
williamr@2
   269
     * (when EFalse if given as parameter) only temporarily disables 
williamr@2
   270
     * those areas.
williamr@2
   271
     *
williamr@2
   272
     * @since S60 5.0
williamr@2
   273
     * @param aControl - Pointer to the control, whose area registry 
williamr@2
   274
     *                   entries and cached information will be removed.
williamr@2
   275
     */
williamr@2
   276
    virtual void RemoveFeedbackForControl( const CCoeControl* aControl ) = 0;
williamr@2
   277
williamr@2
   278
    /**
williamr@2
   279
     * Changes feedback area in the registry.
williamr@2
   280
     *
williamr@2
   281
     * The area must have been originally added to the registry with 
williamr@2
   282
     * SetFeedbackArea -function, or otherwise this function will
williamr@2
   283
     * do nothing.
williamr@2
   284
     *
williamr@2
   285
     * This function is intended to be used especially in 
williamr@2
   286
     * portrait / landscape changes.
williamr@2
   287
     *
williamr@2
   288
     * If given CCoeControl pointer is NULL, then this function call
williamr@2
   289
     * does nothing.
williamr@2
   290
     *
williamr@2
   291
     * @since S60 5.0
williamr@2
   292
     * @param aControl - The control, who has registered the area.
williamr@2
   293
     * @param aIndex   - The index number of the area, that will be changed.
williamr@2
   294
     * @param aNewRect - New area rectangle for given feedback area.
williamr@2
   295
     */
williamr@2
   296
    virtual void ChangeFeedbackArea( const CCoeControl* aControl, 
williamr@2
   297
                                     TUint32 aIndex, 
williamr@2
   298
                                     TRect aNewRect ) = 0;
williamr@2
   299
williamr@2
   300
    /**
williamr@2
   301
     * Changes feedback type in the registry.
williamr@2
   302
     *
williamr@2
   303
     * Feedback can be temporarily disabled by giving ETouchFeedbackNone
williamr@2
   304
     * as parameter (although using EnableFeedbackForControl function with
williamr@2
   305
     * parameter EFalse is usually better for this functionality).
williamr@2
   306
     *
williamr@2
   307
     * The area must have been originally added to the registry with 
williamr@2
   308
     * SetFeedbackArea -function, or otherwise this function will
williamr@2
   309
     * do nothing.
williamr@2
   310
     *
williamr@2
   311
     * If given control pointer is NULL, then this function call
williamr@2
   312
     * is ignored.
williamr@2
   313
     *
williamr@2
   314
     * @since S60 5.0
williamr@2
   315
     * @param aControl - The control, who has registered the area.
williamr@2
   316
     * @param aIndex   - The index number of the area, that will be changed.
williamr@2
   317
     * @param aNewType - New feedback type for the area.
williamr@2
   318
     */
williamr@2
   319
    virtual void ChangeFeedbackType( const CCoeControl* aControl, 
williamr@2
   320
                                     TUint32 aIndex, 
williamr@2
   321
                                     TTouchLogicalFeedback aNewType ) = 0;
williamr@2
   322
williamr@2
   323
    
williamr@2
   324
    /**
williamr@2
   325
     * Makes the given feedback area the first priority area in the window
williamr@2
   326
     * where it is located.
williamr@2
   327
     *
williamr@2
   328
     * In practice this means that this will be the first area that is 
williamr@2
   329
     * hit tested when a pointer event arrives.
williamr@2
   330
     *
williamr@2
   331
     * Notice however, that this area will only keep its top priority status
williamr@2
   332
     * until the next area is added to the registry, or until 
williamr@2
   333
     * this function is called again for some other area. I.e. there is no 
williamr@2
   334
     * way for giving any area a permanent status as top priority area
williamr@2
   335
     * (Registry works as a stack, and new items are added on top).
williamr@2
   336
     *
williamr@2
   337
     * If given control pointer is NULL, this function call does nothing.
williamr@2
   338
     *
williamr@2
   339
     * @since S60 5.0
williamr@2
   340
     * @param aControl - The control, who has registered the area.
williamr@2
   341
     * @param aIndex   - The index number of the area, which 
williamr@2
   342
     *                   will be prioritized.
williamr@2
   343
     */
williamr@2
   344
    virtual void MoveFeedbackAreaToFirstPriority( const CCoeControl* aControl, 
williamr@2
   345
                                                  TUint32 aIndex ) = 0;
williamr@2
   346
williamr@2
   347
    /**
williamr@2
   348
     * This function forces all registry changes made on client side to be
williamr@2
   349
     * sent to server side immediately.
williamr@2
   350
     *
williamr@2
   351
     * This operation causes always immediate and synchronous client-server 
williamr@2
   352
     * transaction, and can possibly also cause flushing of window server
williamr@2
   353
     * client side buffer. Hence this function should only be used in case 
williamr@2
   354
     * there is a synchronization problem so that feedback triggered from 
williamr@2
   355
     * area registry does not correspond to the areas defined by application.
williamr@2
   356
     *
williamr@2
   357
     * This function is only likely to help in such situation, where this
williamr@2
   358
     * application's active objects are running all the time for several seconds,
williamr@2
   359
     * because in that case updates won't be transferred to server immediately.
williamr@2
   360
     *
williamr@2
   361
     * Calling this function has no effect in case there are no pending 
williamr@2
   362
     * area registry updates.
williamr@2
   363
     *
williamr@2
   364
     * @since S60 5.0
williamr@2
   365
     */
williamr@2
   366
    virtual void FlushRegistryUpdates( ) = 0;
williamr@2
   367
    
williamr@2
   368
    /**
williamr@2
   369
     * Gives direct feedback.
williamr@2
   370
     *
williamr@2
   371
     * Notice that the feedback might not be actually played, if 
williamr@2
   372
     * for example user has disabled the feedback from the settings.
williamr@2
   373
     *
williamr@2
   374
     * This function always causes a synchronous client-server transaction, 
williamr@2
   375
     * and potentially flushing of window server client-side buffer.
williamr@2
   376
     *
williamr@2
   377
     * @since S60 5.0
williamr@2
   378
     * @param aType - The logical feedback type to play.
williamr@2
   379
     */
williamr@2
   380
    virtual void InstantFeedback( TTouchLogicalFeedback aType ) = 0;
williamr@2
   381
williamr@2
   382
    /**
williamr@2
   383
     * Gives direct feedback if given control has not disabled it.
williamr@2
   384
     *
williamr@2
   385
     * This function only gives feedback, if EnableFeedbackForControl
williamr@2
   386
     * function has NOT been called on given control with second
williamr@2
   387
     * parameter EFalse.
williamr@2
   388
     * 
williamr@2
   389
     * This overload is recommended when
williamr@2
   390
     * feedback is triggered from UI controls, because then the owner
williamr@2
   391
     * of the control can decide whether both area registry based and
williamr@2
   392
     * direct feedback should be enabled or not.
williamr@2
   393
     *
williamr@2
   394
     * If feedback is enabled for the given control, then this function 
williamr@2
   395
     * causes a synchronous client-server transaction, 
williamr@2
   396
     * and potentially flushing of window server client-side buffer.
williamr@2
   397
     *
williamr@2
   398
     * @since S60 5.0
williamr@2
   399
     * @param aControl - The control, who fishes to play feedback.
williamr@2
   400
     * @param aType    - The logical feedback type to play.
williamr@2
   401
     */
williamr@2
   402
    virtual void InstantFeedback( const CCoeControl* aControl,
williamr@2
   403
                                  TTouchLogicalFeedback aType ) = 0;
williamr@2
   404
                                  
williamr@2
   405
    
williamr@2
   406
    /**
williamr@2
   407
     * Can be used for querying, whether given control has any feedback
williamr@2
   408
     * areas registered.
williamr@2
   409
     *
williamr@2
   410
     * It does not matter whether the areas are disabled or enabled for
williamr@2
   411
     * the moment.
williamr@2
   412
     *
williamr@2
   413
     * Notice that one should not usually call this function, as it
williamr@2
   414
     * is always allowed to call for example RemoveFeedbackArea
williamr@2
   415
     * -function without checking if the area really exists (this
williamr@2
   416
     * is done internally in the API implementation anyway).
williamr@2
   417
     *
williamr@2
   418
     * @since S60 5.0
williamr@2
   419
     * @param aControl - Pointer to the control, whose feedback is
williamr@2
   420
     *                   queried.
williamr@2
   421
     * @return ETrue if the given control has at least one feedback
williamr@2
   422
     *         area defined. EFalse otherwise.
williamr@2
   423
     */
williamr@2
   424
    virtual TBool ControlHasFeedback( const CCoeControl* aControl ) = 0;
williamr@2
   425
    
williamr@2
   426
    /**
williamr@2
   427
     * Can be used for querying, whether given control has a feedback
williamr@2
   428
     * area defined with given index number.
williamr@2
   429
     *
williamr@2
   430
     * It does not matter whether the areas are disabled or enabled for
williamr@2
   431
     * the moment.
williamr@2
   432
     *
williamr@2
   433
     * Notice that one should not usually call this function, as it
williamr@2
   434
     * is always allowed to call for example RemoveFeedbackArea
williamr@2
   435
     * -function without checking if the area really exists (this
williamr@2
   436
     * is done internally in the API implementation anyway).
williamr@2
   437
     *
williamr@2
   438
     * @since S60 5.0
williamr@2
   439
     * @param aControl - Pointer to the control, whose feedback is
williamr@2
   440
     *                   queried.
williamr@2
   441
     * @param aIndex   - The index number of the area which is queried.
williamr@2
   442
     * @return ETrue if the given control has a feedback area defined
williamr@2
   443
     *         with given index number. EFalse otherwise.
williamr@2
   444
     */
williamr@2
   445
    virtual TBool ControlHasFeedback( const CCoeControl* aControl, 
williamr@2
   446
                                      TUint32 aIndex ) = 0;
williamr@2
   447
            
williamr@2
   448
    /**
williamr@2
   449
     * This function enables or disables all feedback areas registered for 
williamr@2
   450
     * the given control. Disabling also affects to the overloaded version
williamr@2
   451
     * of InstantFeedback -function, so that feedback is not played if
williamr@2
   452
     * the control given as parameter has its feedback disabled.
williamr@2
   453
     *
williamr@2
   454
     * This function can be used for temporarily disabling
williamr@2
   455
     * the feedback for some given control. Calling with second parameter 
williamr@2
   456
     * ETrue re-enables feedback areas, but it still does not
williamr@2
   457
     * guarantee any feedback (control can be dimmed, invisible, of may not
williamr@2
   458
     * even have any feedback areas registered).
williamr@2
   459
     *
williamr@2
   460
     * This function affects both vibra- and audio feedback.
williamr@2
   461
     *
williamr@2
   462
     * Any control that uses this function must call RemoveFeedbackForControl
williamr@2
   463
     * -function in its destructor.
williamr@2
   464
     *
williamr@2
   465
     * @since S60 5.0
williamr@2
   466
     * @param aControl - Pointer to control, whose feedback will be 
williamr@2
   467
     *                   enabled or disabled according to second parameter.
williamr@2
   468
     * @param aEnable  - Use EFalse for temporary disabling the feedback for
williamr@2
   469
     *                   this control, and ETrue for restoring the situation
williamr@2
   470
     *                   to normal.
williamr@2
   471
     */
williamr@2
   472
    virtual void EnableFeedbackForControl( const CCoeControl* aControl,
williamr@2
   473
                                           TBool aEnable ) = 0;       
williamr@2
   474
                                           
williamr@2
   475
    /**
williamr@2
   476
     * This function can be used for separately enabling or disabling audio-
williamr@2
   477
     * and vibra feedback for the given control.
williamr@2
   478
     *
williamr@2
   479
     * Otherwise the function behaves in the same way as the overload with
williamr@2
   480
     * only one TBool parameter.
williamr@2
   481
     *
williamr@2
   482
     * Any control that uses this function must call RemoveFeedbackForControl
williamr@2
   483
     * -function in its destructor.
williamr@2
   484
     *
williamr@2
   485
     * @since S60 5.0
williamr@2
   486
     * @param aControl - Pointer to control, whose audio- and vibra 
williamr@2
   487
     *                   feedback will be enabled or disabled according 
williamr@2
   488
     *                   to given parameters.
williamr@2
   489
     * @param aEnableVibra  - Use EFalse for temporary disabling the vibra 
williamr@2
   490
     *                        feedback for this control, and ETrue for 
williamr@2
   491
     *                        restoring the situation to normal.
williamr@2
   492
     * @param aEnableAudio  - Use EFalse for temporary disabling the audio 
williamr@2
   493
     *                        feedback for this control, and ETrue for 
williamr@2
   494
     *                        restoring the situation to normal.
williamr@2
   495
     */
williamr@2
   496
    virtual void EnableFeedbackForControl( const CCoeControl* aControl,
williamr@2
   497
                                           TBool aEnableVibra,
williamr@2
   498
                                           TBool aEnableAudio ) = 0; 
williamr@2
   499
                                           
williamr@2
   500
    /**
williamr@2
   501
     * Used for disabling or enabling feedback in the application.
williamr@2
   502
     *
williamr@2
   503
     * This is identical with the overload which has only one parameter, 
williamr@2
   504
     * with the exception that one can disable audio and vibra feedback 
williamr@2
   505
     * separately with this version.
williamr@2
   506
     *
williamr@2
   507
     * @since S60 5.0
williamr@2
   508
     * @param aVibraEnabled - Give ETrue as parameter for enabling vibra 
williamr@2
   509
     *                        feedback, and EFalse for disabling vibra 
williamr@2
   510
     *                        feedback for this application.
williamr@2
   511
     * @param aAudioEnabled - Give ETrue as parameter for enabling audio 
williamr@2
   512
     *                        feedback, and EFalse for disabling audio
williamr@2
   513
     *                        feedback for this application.
williamr@2
   514
     */
williamr@2
   515
    virtual void SetFeedbackEnabledForThisApp( TBool aVibraEnabled,
williamr@2
   516
                                               TBool aAudioEnabled ) = 0;                                                 
williamr@2
   517
    };
williamr@2
   518
williamr@2
   519
williamr@2
   520
williamr@2
   521
#endif //  M_TOUCHFEEDBACK_H