videoplayback/videoplaybackcontrols/tsrc/videoplaybackcontrols_test/src/mpxvpbuih_stub.cpp
changeset 0 96612d01cf9f
child 6 7d91903f795f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Implementation of playback view's input handler
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: ou1cpsw#6 %
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <w32std.h> // RWindowBase
       
    24 #include <e32base.h>
       
    25 #include <stringloader.h>
       
    26 #include <aknutils.h>
       
    27 #include <eikclbd.h>
       
    28 #include <aknconsts.h>
       
    29 #include <AknUtils.h>
       
    30 #include <AknIconUtils.h>  // SetSize for the icons
       
    31 #include <remconcoreapi.h>
       
    32 #include <RemConCoreApiTarget.h>
       
    33 #include <remconinterfaceselector.h> // Side volume key
       
    34 #include <mpxplaybackframeworkdefs.h>
       
    35 
       
    36 #include "mpxvpbc_stub.h"
       
    37 #include "mpxvideoplaybackcontrol.hrh"
       
    38 #include "mpxvpbuih_stub.h"
       
    39 
       
    40 #include <mpxvideoplaybackdefs.h>
       
    41 #include "mpxcommonvideoplaybackview.hrh"
       
    42 #include "mpxvideo_debug.h"
       
    43 
       
    44 
       
    45 // CONSTANTS
       
    46 
       
    47 // ======== MEMBER FUNCTIONS =======================================================================
       
    48 
       
    49 // -------------------------------------------------------------------------------------------------
       
    50 // MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler()
       
    51 // -------------------------------------------------------------------------------------------------
       
    52 //
       
    53 CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler(CMPXVideoPlaybackContainer* aContainer)
       
    54    : iContainer(aContainer)
       
    55 {
       
    56 }
       
    57 
       
    58 // -------------------------------------------------------------------------------------------------
       
    59 // CMPXVideoPlaybackUserInputHandler::NewL()
       
    60 // -------------------------------------------------------------------------------------------------
       
    61 //
       
    62 CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL(
       
    63 																												CMPXVideoPlaybackContainer* aContainer)
       
    64 {
       
    65     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::NewL()"));
       
    66 
       
    67     CMPXVideoPlaybackUserInputHandler* self = new (ELeave) CMPXVideoPlaybackUserInputHandler( aContainer );
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL();
       
    70     CleanupStack::Pop();
       
    71     return self;
       
    72 }
       
    73 
       
    74 // -------------------------------------------------------------------------------------------------
       
    75 // CMPXVideoPlaybackUserInputHandler::ConstructL
       
    76 // Symbian 2nd phase constructor can leave.
       
    77 // -------------------------------------------------------------------------------------------------
       
    78 //
       
    79 void CMPXVideoPlaybackUserInputHandler::ConstructL()
       
    80 {
       
    81     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ConstructL()"));
       
    82 
       
    83     iProcessingInputType = EMpxVideoNone;
       
    84 }
       
    85 
       
    86 // -------------------------------------------------------------------------------------------------
       
    87 // CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
       
    88 // -------------------------------------------------------------------------------------------------
       
    89 //
       
    90 CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
       
    91 {
       
    92 }
       
    93 
       
    94 // -------------------------------------------------------------------------------------------------
       
    95 // CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent()
       
    96 // -------------------------------------------------------------------------------------------------
       
    97 //
       
    98 void CMPXVideoPlaybackUserInputHandler::ProcessPointerEventL( CCoeControl* aControl,
       
    99                                                               const TPointerEvent& aPointerEvent,
       
   100                                                               TMPXVideoControlType /*aMPXControl*/ )
       
   101 {
       
   102     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent"));
       
   103 
       
   104     switch (iProcessingInputType)
       
   105     {
       
   106         case EMpxVideoNone:
       
   107         {
       
   108             if (aPointerEvent.iType == TPointerEvent::EButton1Down)
       
   109             {
       
   110                 iProcessingInputType = EMpxVideoTouch;
       
   111                 static_cast<CMPXVideoPlaybackControl*>(aControl)->DoHandlePointerEventL( aPointerEvent );
       
   112             }
       
   113             break;
       
   114         }
       
   115         case EMpxVideoTouch:
       
   116         {
       
   117             if (aPointerEvent.iType != TPointerEvent::EButton1Down)
       
   118             {
       
   119                 static_cast<CMPXVideoPlaybackControl*>(aControl)->DoHandlePointerEventL( aPointerEvent );
       
   120 
       
   121                 // reset the value only on pointer up event - but not on drag
       
   122                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   123                 {
       
   124                     iProcessingInputType = EMpxVideoNone;
       
   125                 }
       
   126             }
       
   127             break;
       
   128         }
       
   129         default:
       
   130         {
       
   131             // user input is disallowed
       
   132             break;
       
   133         }
       
   134     } // switch
       
   135 }
       
   136 
       
   137 
       
   138 // -------------------------------------------------------------------------------------------------
       
   139 // CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent()
       
   140 // -------------------------------------------------------------------------------------------------
       
   141 //
       
   142 void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& aKeyEvent,
       
   143                                                           TEventCode aType )
       
   144 {
       
   145     MPX_DEBUG(_L("MPXVideoPlaybackUserInputHandler::ProcessKeyEvent"));
       
   146 
       
   147     switch (iProcessingInputType)
       
   148     {
       
   149         case EMpxVideoNone:
       
   150         {
       
   151             if (aType == EEventKeyDown)
       
   152             {
       
   153                 iProcessingInputType = EMpxVideoKeyboard;
       
   154                 iLastPressedKeyCode = aKeyEvent.iCode;
       
   155                 iLastPressedKeyScanCode = aKeyEvent.iScanCode;
       
   156                 iContainer->DoHandleKeyEventL(aKeyEvent, aType);
       
   157             }
       
   158             break;
       
   159         }
       
   160         case EMpxVideoKeyboard:
       
   161         {
       
   162             if (aType == EEventKeyUp)
       
   163             {
       
   164                 // only handle up event for the key being handled
       
   165                 // ignore spurious key presses
       
   166                 if (aKeyEvent.iCode == iLastPressedKeyCode  &&
       
   167                     aKeyEvent.iScanCode == iLastPressedKeyScanCode)
       
   168                 {
       
   169                     iContainer->DoHandleKeyEventL(aKeyEvent, aType);
       
   170 
       
   171                     // reset the value only on key up event
       
   172                     iProcessingInputType = EMpxVideoNone;
       
   173                 }
       
   174             }
       
   175             break;
       
   176         }
       
   177         default:
       
   178         {
       
   179             // user input is disallowed
       
   180             break;
       
   181         }
       
   182     } // switch
       
   183 }
       
   184 
       
   185 // EOF