videoplayback/videoplaybackcontrols/src/mpxvideoplaybackaspectratioicon.cpp
branchRCL_3
changeset 15 8f0df5c82986
parent 6 7d91903f795f
equal deleted inserted replaced
14:55fa1ec415c6 15:8f0df5c82986
    13 *
    13 *
    14 * Description: Aspect ratio control
    14 * Description: Aspect ratio control
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 12 %
    18 
       
    19 // Version : %version: 14 %
    19 
    20 
    20 
    21 
    21 // INCLUDE FILES
    22 // INCLUDE FILES
    22 #include <eikenv.h>
    23 #include <eikenv.h>
    23 #include <gulicon.h>
    24 #include <gulicon.h>
    48 // Symbian 2nd phase constructor can leave.
    49 // Symbian 2nd phase constructor can leave.
    49 // -------------------------------------------------------------------------------------------------
    50 // -------------------------------------------------------------------------------------------------
    50 //
    51 //
    51 void CMPXVideoPlaybackAspectRatioIcon::ConstructL( TRect aRect )
    52 void CMPXVideoPlaybackAspectRatioIcon::ConstructL( TRect aRect )
    52 {
    53 {
    53     MPX_DEBUG(_L("CMPXVideoPlaybackAspectRatioIcon::ConstructL()"));
    54     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackAspectRatioIcon::ConstructL()"));
    54 
    55 
    55     SetRect( TRect( 0, 0, aRect.Width(), aRect.Height() ) );
    56     SetRect( TRect( 0, 0, aRect.Width(), aRect.Height() ) );
    56 
    57 
    57     iAspectRatioRect = TRect( Rect().iTl.iX + 15,
    58     iAspectRatioRect = TRect( Rect().iTl.iX + 15,
    58                               Rect().iTl.iY + 15,
    59                               Rect().iTl.iY + 15,
    91 // Destructor.
    92 // Destructor.
    92 // -------------------------------------------------------------------------------------------------
    93 // -------------------------------------------------------------------------------------------------
    93 //
    94 //
    94 CMPXVideoPlaybackAspectRatioIcon::~CMPXVideoPlaybackAspectRatioIcon()
    95 CMPXVideoPlaybackAspectRatioIcon::~CMPXVideoPlaybackAspectRatioIcon()
    95 {
    96 {
    96     MPX_DEBUG(_L("CMPXVideoPlaybackAspectRatioIcon::~CMPXVideoPlaybackAspectRatioIcon()"));
    97     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackAspectRatioIcon::~CMPXVideoPlaybackAspectRatioIcon()"));
    97 
    98 
    98     if ( iNaturalIcon )
    99     if ( iNaturalIcon )
    99     {
   100     {
   100         delete iNaturalIcon;
   101         delete iNaturalIcon;
   101         iNaturalIcon = NULL;
   102         iNaturalIcon = NULL;
   112         delete iZoomIcon;
   113         delete iZoomIcon;
   113         iZoomIcon = NULL;
   114         iZoomIcon = NULL;
   114     }
   115     }
   115 
   116 
   116 #ifdef RD_TACTILE_FEEDBACK
   117 #ifdef RD_TACTILE_FEEDBACK
   117     if (iFeedback)
   118     if ( iFeedback )
   118     {
   119     {
   119         iFeedback->RemoveFeedbackForControl(this);
   120         iFeedback->RemoveFeedbackForControl(this);
   120     }
   121     }
   121 #endif //RD_TACTILE_FEEDBACK
   122 #endif //RD_TACTILE_FEEDBACK
   122 }
   123 }
   125 // CMPXVideoPlaybackAspectRatioIcon::SkinChangeL()
   126 // CMPXVideoPlaybackAspectRatioIcon::SkinChangeL()
   126 // -------------------------------------------------------------------------------------------------
   127 // -------------------------------------------------------------------------------------------------
   127 //
   128 //
   128 void CMPXVideoPlaybackAspectRatioIcon::SkinChangeL()
   129 void CMPXVideoPlaybackAspectRatioIcon::SkinChangeL()
   129 {
   130 {
   130     MPX_DEBUG(_L("CMPXVideoPlaybackAspectRatioIcon::SkinChangeL()"));
   131     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackAspectRatioIcon::SkinChangeL()"));
   131 
   132 
   132     //
   133     //
   133     // Create icons
   134     // Create icons
   134     //
   135     //
   135     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   136     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   216     MPX_DEBUG(_L("CMPXVideoPlaybackAspectRatioIcon::Draw()"));
   217     MPX_DEBUG(_L("CMPXVideoPlaybackAspectRatioIcon::Draw()"));
   217 
   218 
   218     CWindowGc& gc = SystemGc();
   219     CWindowGc& gc = SystemGc();
   219     gc.SetClippingRect( aRect );
   220     gc.SetClippingRect( aRect );
   220 
   221 
   221     if ( iController->SetBackgroundBlack() )
   222     if ( Window().DisplayMode() == EColor16MAP )
   222     {
   223     {
   223         if ( Window().DisplayMode() == EColor16MAP )
   224         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   224         {
   225         gc.SetBrushColor( TRgb::Color16MAP( 255 ) );
   225             gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   226         gc.Clear( aRect );
   226             gc.SetBrushColor( TRgb::Color16MAP( 255 ) );
   227     }
   227             gc.Clear( aRect );
   228     else if ( Window().DisplayMode() == EColor16MA )
   228         }
   229     {
   229         else if ( Window().DisplayMode() == EColor16MA )
   230         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   230         {
   231         gc.SetBrushColor( TRgb::Color16MA( 0 ) );
   231             gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   232         gc.Clear( aRect );
   232             gc.SetBrushColor( TRgb::Color16MA( 0 ) );
   233     }
   233             gc.Clear( aRect );
   234 
   234         }
   235     switch ( iController->AspectRatio() )
   235     }
       
   236     else
       
   237     {
       
   238         // draw a solid background so that the entire progress
       
   239         // bar is shown not just the area representing the
       
   240         // portion that has been played.
       
   241         gc.SetBrushColor( KRgbBlack );
       
   242         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   243         gc.DrawRect( aRect );
       
   244         gc.SetBrushStyle( CGraphicsContext::ENullBrush );
       
   245     }
       
   246 
       
   247     switch( iAspectRatio )
       
   248     {
   236     {
   249         case EMMFStretch:
   237         case EMMFStretch:
   250         {
   238         {
   251             gc.BitBltMasked( iAspectRatioRect.iTl,
   239             gc.BitBltMasked( iAspectRatioRect.iTl,
   252                              iZoomIcon->Bitmap(),
   240                              iZoomIcon->Bitmap(),
   280 // CMPXVideoPlaybackAspectRatioIcon::HandlePointerEventL()
   268 // CMPXVideoPlaybackAspectRatioIcon::HandlePointerEventL()
   281 // -------------------------------------------------------------------------------------------------
   269 // -------------------------------------------------------------------------------------------------
   282 //
   270 //
   283 void CMPXVideoPlaybackAspectRatioIcon::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   271 void CMPXVideoPlaybackAspectRatioIcon::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   284 {
   272 {
   285     MPX_DEBUG(_L("CMPXVideoPlaybackAspectRatioIcon::HandlePointerEventL()"));
   273     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackAspectRatioIcon::HandlePointerEventL()"),
       
   274                    _L("aPointerEvent.iType = %d"), aPointerEvent.iType );
   286 
   275 
   287     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
   276     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
   288     {
   277     {
   289 #ifdef RD_TACTILE_FEEDBACK
   278 #ifdef RD_TACTILE_FEEDBACK
   290         if ( iFeedback )
   279         if ( iFeedback )
   299     }
   288     }
   300     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   289     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   301     {
   290     {
   302         TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdNaturalAspectRatio;
   291         TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdNaturalAspectRatio;
   303 
   292 
   304         switch ( iAspectRatio )
   293         switch ( iController->AspectRatio() )
   305         {
   294         {
   306             case EMMFStretch:
   295             case EMMFStretch:
   307             {
   296             {
   308                 cmd = EMPXPbvCmdZoomAspectRatio;
   297                 cmd = EMPXPbvCmdZoomAspectRatio;
   309                 break;
   298                 break;
   325 //
   314 //
   326 void CMPXVideoPlaybackAspectRatioIcon::AspectRatioChanged( TInt aAspectRatio )
   315 void CMPXVideoPlaybackAspectRatioIcon::AspectRatioChanged( TInt aAspectRatio )
   327 {
   316 {
   328     MPX_DEBUG(_L("CMPXVideoPlaybackAspectRatioIcon::AspectRatioChanged() (%d)"), aAspectRatio);
   317     MPX_DEBUG(_L("CMPXVideoPlaybackAspectRatioIcon::AspectRatioChanged() (%d)"), aAspectRatio);
   329 
   318 
   330     iAspectRatio = (TMMFScalingType)aAspectRatio;
       
   331 
       
   332     if ( IsVisible() )
   319     if ( IsVisible() )
   333     {
   320     {
   334         DrawNow();
   321         DrawNow();
   335     }
   322     }
   336 }
   323 }