videoplayback/videoplaybackcontrols/src/mpxvideoplaybackbutton.cpp
branchRCL_3
changeset 6 7d91903f795f
parent 0 96612d01cf9f
child 15 8f0df5c82986
equal deleted inserted replaced
2:dec420019252 6:7d91903f795f
    13 *
    13 *
    14 * Description: Button control
    14 * Description: Button control
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 8 %
    18 // Version : %version: 9 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <eikenv.h>
    23 #include <eikenv.h>
    37 // -------------------------------------------------------------------------------------------------
    37 // -------------------------------------------------------------------------------------------------
    38 // CMPXVideoPlaybackButton::ConstructL()
    38 // CMPXVideoPlaybackButton::ConstructL()
    39 // Symbian 2nd phase constructor can leave.
    39 // Symbian 2nd phase constructor can leave.
    40 // -------------------------------------------------------------------------------------------------
    40 // -------------------------------------------------------------------------------------------------
    41 //
    41 //
    42 void CMPXVideoPlaybackButton::ConstructL( TRect aRect, const TDesC &aIconPath )
    42 void CMPXVideoPlaybackButton::ConstructL( CMPXVideoPlaybackControlsController* aController, 
       
    43                                           TRect aRect, const TDesC &aIconPath )
    43 {
    44 {
    44     MPX_DEBUG(_L("CMPXVideoPlaybackButton::ConstructL()"));
    45     MPX_DEBUG(_L("CMPXVideoPlaybackButton::ConstructL()"));
    45 
    46 
    46     iIConPath = aIconPath.AllocL();
    47     iIConPath = aIconPath.AllocL();
       
    48     iController = aController;
    47 
    49 
    48     SetRect( aRect );
    50     SetRect( aRect );
    49 }
    51 }
    50 
    52 
    51 // -------------------------------------------------------------------------------------------------
    53 // -------------------------------------------------------------------------------------------------
    52 // CMPXVideoPlaybackButton::NewL()
    54 // CMPXVideoPlaybackButton::NewL()
    53 // Two-phased constructor.
    55 // Two-phased constructor.
    54 // -------------------------------------------------------------------------------------------------
    56 // -------------------------------------------------------------------------------------------------
    55 //
    57 //
    56 CMPXVideoPlaybackButton* CMPXVideoPlaybackButton::NewL( TRect aRect, const TDesC &aIconPath)
    58 CMPXVideoPlaybackButton* CMPXVideoPlaybackButton::NewL( CMPXVideoPlaybackControlsController* aController, 
       
    59                                                         TRect aRect, const TDesC &aIconPath)
    57 {
    60 {
    58     MPX_DEBUG(_L("CMPXVideoPlaybackButton::NewL()"));
    61     MPX_DEBUG(_L("CMPXVideoPlaybackButton::NewL()"));
    59 
    62 
    60     CMPXVideoPlaybackButton* self = new ( ELeave ) CMPXVideoPlaybackButton();
    63     CMPXVideoPlaybackButton* self = new ( ELeave ) CMPXVideoPlaybackButton();
    61 
    64 
    62     CleanupStack::PushL( self );
    65     CleanupStack::PushL( self );
    63     self->ConstructL( aRect, aIconPath );
    66     self->ConstructL( aController, aRect, aIconPath );
    64     CleanupStack::Pop();
    67     CleanupStack::Pop();
    65     return self;
    68     return self;
    66 }
    69 }
    67 
    70 
    68 // -------------------------------------------------------------------------------------------------
    71 // -------------------------------------------------------------------------------------------------
   191     MPX_DEBUG(_L("CMPXVideoPlaybackButton::Draw()"));
   194     MPX_DEBUG(_L("CMPXVideoPlaybackButton::Draw()"));
   192 
   195 
   193     CWindowGc& gc = SystemGc();
   196     CWindowGc& gc = SystemGc();
   194     gc.SetClippingRect( aRect );
   197     gc.SetClippingRect( aRect );
   195 
   198 
   196     if ( Window().DisplayMode() == EColor16MAP )
   199     if ( iController->SetBackgroundBlack() )
   197     {
   200     {
   198         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   201         if ( Window().DisplayMode() == EColor16MAP )
   199         gc.SetBrushColor( TRgb::Color16MAP( 255 ) );
   202         {
   200         gc.Clear( aRect );
   203             gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   201     }
   204             gc.SetBrushColor( TRgb::Color16MAP( 255 ) );
   202     else if ( Window().DisplayMode() == EColor16MA )
   205             gc.Clear( aRect );
   203     {
   206         }
   204         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   207         else if ( Window().DisplayMode() == EColor16MA )
   205         gc.SetBrushColor( TRgb::Color16MA( 0 ) );
   208         {
   206         gc.Clear( aRect );
   209             gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
       
   210             gc.SetBrushColor( TRgb::Color16MA( 0 ) );
       
   211             gc.Clear( aRect );
       
   212         }
   207     }
   213     }
   208     else
   214     else
   209     {
   215     {
   210         // draw a solid background so that the entire progress
   216         // draw a solid background so that the entire progress
   211         // bar is shown not just the area representing the
   217         // bar is shown not just the area representing the