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