videoplayback/videoplaybackviews/src/mpxvideoplaybackuserinputhandler.cpp
branchRCL_3
changeset 12 7f2b2a65da29
parent 11 8970fbd719ec
child 16 67eb01668b0e
equal deleted inserted replaced
11:8970fbd719ec 12:7f2b2a65da29
    13 *
    13 *
    14 * Description:  Implementation of playback view's input handler
    14 * Description:  Implementation of playback view's input handler
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 17 %
    18 // Version : %version: 18 %
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include <w32std.h> // RWindowBase
    22 #include <w32std.h> // RWindowBase
    23 #include <e32base.h>
    23 #include <e32base.h>
   355 EXPORT_C void
   355 EXPORT_C void
   356 CMPXVideoPlaybackUserInputHandler::ProcessPointerEventL( CCoeControl* aControl,
   356 CMPXVideoPlaybackUserInputHandler::ProcessPointerEventL( CCoeControl* aControl,
   357                                                          const TPointerEvent& aPointerEvent,
   357                                                          const TPointerEvent& aPointerEvent,
   358                                                          TMPXVideoControlType aMPXControl )
   358                                                          TMPXVideoControlType aMPXControl )
   359 {
   359 {
   360     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent()"));
   360     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent()"),
       
   361                    _L("iProcessingInputType = %d, aPointerEvent.iType = %d"),
       
   362                    iProcessingInputType, aPointerEvent.iType );
   361 
   363 
   362     switch ( iProcessingInputType )
   364     switch ( iProcessingInputType )
   363     {
   365     {
   364         case EMpxVideoNone:
   366         case EMpxVideoNone:
   365         {
   367         {
   366             if ( aPointerEvent.iType == TPointerEvent::EButton1Down && iForeground )
   368             if ( aPointerEvent.iType == TPointerEvent::EButton1Down && iForeground )
   367             {
   369             {
   368                 iProcessingInputType = EMpxVideoTouch;
   370                 iProcessingInputType = EMpxVideoTouch;
   369 
   371 
       
   372                 //
       
   373                 //  Save the active controls pointer to reroute invalid pointer events
       
   374                 //
       
   375                 iActiveControlPtr = aControl;
       
   376                 iActiveControlType = aMPXControl;
       
   377 
   370                 ReRoutePointerEventL( aControl, aPointerEvent, aMPXControl );
   378                 ReRoutePointerEventL( aControl, aPointerEvent, aMPXControl );
   371             }
   379             }
       
   380 
   372             break;
   381             break;
   373         }
   382         }
   374         case EMpxVideoTouch:
   383         case EMpxVideoTouch:
   375         {
   384         {
   376             if ( aPointerEvent.iType != TPointerEvent::EButton1Down )
   385             if ( aControl == iActiveControlPtr )
   377             {
   386             {
   378                 ReRoutePointerEventL( aControl, aPointerEvent, aMPXControl );
   387                 //
   379 
   388                 //  Event is from the active control, process pointer event normally
   380                 // reset the value only on pointer up event - but not on drag
   389                 //
       
   390                 if ( aPointerEvent.iType != TPointerEvent::EButton1Down )
       
   391                 {
       
   392                     ReRoutePointerEventL( aControl, aPointerEvent, aMPXControl );
       
   393 
       
   394                     //
       
   395                     //  reset the value only on pointer up event - but not on drag
       
   396                     //
       
   397                     if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   398                     {
       
   399                         iProcessingInputType = EMpxVideoNone;
       
   400                         iActiveControlPtr = NULL;
       
   401                     }
       
   402                 }
       
   403             }
       
   404             else
       
   405             {
       
   406                 //
       
   407                 //  Event is from non active control
       
   408                 //  This should not happen, but if event is a button up event,
       
   409                 //  end the current active control pointer processing
       
   410                 //
   381                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   411                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   382                 {
   412                 {
       
   413                     //
       
   414                     //  Reroute button up event to active control and end current 
       
   415                     //  control processing
       
   416                     //
       
   417                     ReRoutePointerEventL( iActiveControlPtr, aPointerEvent, iActiveControlType );
   383                     iProcessingInputType = EMpxVideoNone;
   418                     iProcessingInputType = EMpxVideoNone;
       
   419                     iActiveControlPtr = NULL;
   384                 }
   420                 }
   385             }
   421             }
       
   422 
   386             break;
   423             break;
   387         }
   424         }
   388     } // switch
   425     } // switch
   389 }
   426 }
   390 
   427 
       
   428 // -------------------------------------------------------------------------------------------------
       
   429 //   CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()
       
   430 // -------------------------------------------------------------------------------------------------
       
   431 //
       
   432 void CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL( CCoeControl* aControl,
       
   433                                                               const TPointerEvent& aPointerEvent,
       
   434                                                               TMPXVideoControlType aMPXControl )
       
   435 {
       
   436     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()"),
       
   437                    _L("aMPXControl = %d"), aMPXControl );
       
   438 
       
   439     if ( aMPXControl == EMpxVideoPlaybackContainer )
       
   440     {
       
   441         iContainer->DoHandlePointerEventL( aPointerEvent );
       
   442     }
       
   443     else if ( aMPXControl == EMpxVideoPlaybackControl )
       
   444     {
       
   445         static_cast<CMPXVideoPlaybackControl*>(aControl)->DoHandlePointerEventL( aPointerEvent );
       
   446     }
       
   447 }
   391 
   448 
   392 // -------------------------------------------------------------------------------------------------
   449 // -------------------------------------------------------------------------------------------------
   393 // CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent()
   450 // CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent()
   394 // -------------------------------------------------------------------------------------------------
   451 // -------------------------------------------------------------------------------------------------
   395 //
   452 //
   513     }
   570     }
   514 
   571 
   515     iContainer->HandleCommandL( command );
   572     iContainer->HandleCommandL( command );
   516 }
   573 }
   517 
   574 
   518 
       
   519 // -------------------------------------------------------------------------------------------------
       
   520 //   CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()
       
   521 // -------------------------------------------------------------------------------------------------
       
   522 //
       
   523 void CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL( CCoeControl* aControl,
       
   524                                                               const TPointerEvent& aPointerEvent,
       
   525                                                               TMPXVideoControlType aMPXControl )
       
   526 {
       
   527     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()"));
       
   528 
       
   529     if ( aMPXControl == EMpxVideoPlaybackContainer )
       
   530     {
       
   531         iContainer->DoHandlePointerEventL(aPointerEvent);
       
   532     }
       
   533     else if ( aMPXControl == EMpxVideoPlaybackControl )
       
   534     {
       
   535         static_cast<CMPXVideoPlaybackControl*>(aControl)->DoHandlePointerEventL(aPointerEvent);
       
   536     }
       
   537 }
       
   538 
       
   539 // -------------------------------------------------------------------------------------------------
   575 // -------------------------------------------------------------------------------------------------
   540 //   CMPXVideoPlaybackUserInputHandler::SetForeground()
   576 //   CMPXVideoPlaybackUserInputHandler::SetForeground()
   541 // -------------------------------------------------------------------------------------------------
   577 // -------------------------------------------------------------------------------------------------
   542 //
   578 //
   543 void CMPXVideoPlaybackUserInputHandler::SetForeground( TBool aForeground )
   579 void CMPXVideoPlaybackUserInputHandler::SetForeground( TBool aForeground )