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