photosgallery/viewframework/views/fullscreenview/inc/glxmediakeyutility.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:    Command object factory
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef T_GLXMEDIAKEYUTILITY_H
       
    22 #define T_GLXMEDIAKEYUTILITY_H
       
    23 
       
    24 #include <ipvideo/ViaPlayerMediaKeyListener.h>	// MViaPlayerMediaKeyListener
       
    25 
       
    26 
       
    27 /**
       
    28  * TGlxMediaKeyUtility
       
    29  *
       
    30  * This is a utility class that simplifies the use of RemCon  
       
    31  * A problem results when an application instantiates more than one
       
    32  * Instance of RemCon.
       
    33  *
       
    34  * This class enables other components to use the same instance on RemCon that the 
       
    35  * It inherits from MRemConCoreApiTargetObserver and links with the RemConCoreApi.lib
       
    36  * It inherits from MViaPlayerMediaKeyListener and links with the ViaPlayerUtilities.lib
       
    37  * It interperets the keys from RemCon via the MediaKeyEventL method and translates them
       
    38  * to standard key which get added to the application event queue for normal processing
       
    39  * (Via OfferKeyEventL).
       
    40  *
       
    41  * Note that TranslateKeyEvent and DispatchKeyEvent methods are virtual.
       
    42  * So if different behaviour is required just create a Sub class and overide
       
    43  * those metheds are needed.
       
    44  * 
       
    45  */
       
    46 
       
    47 class CGlxMediaKeyUtility : public CBase, public MViaPlayerMediaKeyListener
       
    48     {
       
    49 public:
       
    50     /**
       
    51     * Standard NewLC class used for Instantiation
       
    52     
       
    53     * @return Instance of Itself, also on the cleanup stack
       
    54     */
       
    55     static CGlxMediaKeyUtility* NewLC();
       
    56     
       
    57     /**
       
    58     * Standard NewL class used for Instantiation
       
    59     
       
    60     * @return Instance of Itself
       
    61     */
       
    62     static CGlxMediaKeyUtility* NewL();
       
    63     
       
    64     /**
       
    65     * Destructor
       
    66     */
       
    67     virtual ~CGlxMediaKeyUtility();
       
    68 
       
    69 protected:
       
    70     /**
       
    71     * Creates KeyEvent and places it on the application event queue.
       
    72     *
       
    73     * @param aKeyCode this is the action (up, down or click).
       
    74     * @param aScanCode this is the TStdScanCode for the Key Event.
       
    75     */
       
    76     void DoSimulateKeyEvent( TRawEvent::TType aKeyCode, TStdScanCode aScanCode );
       
    77 
       
    78     /**
       
    79     * Converts RemCon key types to standard key types
       
    80     *
       
    81     * @param aOperationId the RemCon key type
       
    82     *
       
    83     * @return the standard key type
       
    84     */
       
    85     virtual TStdScanCode TranslateKeyEvent(TRemConCoreApiOperationId aOperationId);
       
    86     
       
    87     /**
       
    88     * Places the Key Event in the applications quere acording to aButtonAct (up, down, click)
       
    89     *
       
    90     * @param aButtonAct (up, down or click)
       
    91     * @param aScanCode the standard scan code for a key
       
    92     */
       
    93     virtual void DispatchKeyEvent( TRemConCoreApiButtonAction aButtonAct, TStdScanCode aScanCode);
       
    94 
       
    95 private:
       
    96     CGlxMediaKeyUtility();
       
    97     void ConstructL();
       
    98     
       
    99 private: // from MViaPlayerMediaKeyListener
       
   100     void MediaKeyEventL(TRemConCoreApiOperationId aOperationId, 
       
   101                         TRemConCoreApiButtonAction aButtonAct );
       
   102 
       
   103     };
       
   104 
       
   105 #endif
       
   106