videoplayback/videoplaybackcontrols/src/mpxvideoplaybackbutton.cpp
branchRCL_3
changeset 15 8f0df5c82986
parent 6 7d91903f795f
equal deleted inserted replaced
14:55fa1ec415c6 15:8f0df5c82986
    13 *
    13 *
    14 * Description: Button control
    14 * Description: Button control
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 9 %
    18 
    19 
    19 // Version : %version: 10 %
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <eikenv.h>
    23 #include <eikenv.h>
    24 #include <gulicon.h>
    24 #include <gulicon.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( CMPXVideoPlaybackControlsController* aController, 
    42 void CMPXVideoPlaybackButton::ConstructL( CMPXVideoPlaybackControlsController* aController,
    43                                           TRect aRect, const TDesC &aIconPath )
    43                                           TRect aRect, const TDesC &aIconPath )
    44 {
    44 {
    45     MPX_DEBUG(_L("CMPXVideoPlaybackButton::ConstructL()"));
    45     MPX_DEBUG(_L("CMPXVideoPlaybackButton::ConstructL()"));
    46 
    46 
    47     iIConPath = aIconPath.AllocL();
    47     iIConPath = aIconPath.AllocL();
    53 // -------------------------------------------------------------------------------------------------
    53 // -------------------------------------------------------------------------------------------------
    54 // CMPXVideoPlaybackButton::NewL()
    54 // CMPXVideoPlaybackButton::NewL()
    55 // Two-phased constructor.
    55 // Two-phased constructor.
    56 // -------------------------------------------------------------------------------------------------
    56 // -------------------------------------------------------------------------------------------------
    57 //
    57 //
    58 CMPXVideoPlaybackButton* CMPXVideoPlaybackButton::NewL( CMPXVideoPlaybackControlsController* aController, 
    58 CMPXVideoPlaybackButton*
    59                                                         TRect aRect, const TDesC &aIconPath)
    59 CMPXVideoPlaybackButton::NewL( CMPXVideoPlaybackControlsController* aController,
       
    60                                TRect aRect, const TDesC &aIconPath )
    60 {
    61 {
    61     MPX_DEBUG(_L("CMPXVideoPlaybackButton::NewL()"));
    62     MPX_DEBUG(_L("CMPXVideoPlaybackButton::NewL()"));
    62 
    63 
    63     CMPXVideoPlaybackButton* self = new ( ELeave ) CMPXVideoPlaybackButton();
    64     CMPXVideoPlaybackButton* self = new ( ELeave ) CMPXVideoPlaybackButton();
    64 
    65 
   194     MPX_DEBUG(_L("CMPXVideoPlaybackButton::Draw()"));
   195     MPX_DEBUG(_L("CMPXVideoPlaybackButton::Draw()"));
   195 
   196 
   196     CWindowGc& gc = SystemGc();
   197     CWindowGc& gc = SystemGc();
   197     gc.SetClippingRect( aRect );
   198     gc.SetClippingRect( aRect );
   198 
   199 
   199     if ( iController->SetBackgroundBlack() )
   200     if ( Window().DisplayMode() == EColor16MAP )
   200     {
   201     {
   201         if ( Window().DisplayMode() == EColor16MAP )
   202         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   202         {
   203         gc.SetBrushColor( TRgb::Color16MAP( 255 ) );
   203             gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   204         gc.Clear( aRect );
   204             gc.SetBrushColor( TRgb::Color16MAP( 255 ) );
   205     }
   205             gc.Clear( aRect );
   206     else if ( Window().DisplayMode() == EColor16MA )
   206         }
   207     {
   207         else if ( Window().DisplayMode() == EColor16MA )
   208         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   208         {
   209         gc.SetBrushColor( TRgb::Color16MA( 0 ) );
   209             gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   210         gc.Clear( aRect );
   210             gc.SetBrushColor( TRgb::Color16MA( 0 ) );
   211     }
   211             gc.Clear( aRect );
   212 
   212         }
   213     switch ( iState )
   213     }
       
   214     else
       
   215     {
       
   216         // draw a solid background so that the entire progress
       
   217         // bar is shown not just the area representing the
       
   218         // portion that has been played.
       
   219         gc.SetBrushColor( KRgbBlack );
       
   220         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   221         gc.DrawRect( aRect );
       
   222         gc.SetBrushStyle( CGraphicsContext::ENullBrush );
       
   223     }
       
   224 
       
   225     switch( iState )
       
   226     {
   214     {
   227         case EMPXButtonNormal:
   215         case EMPXButtonNormal:
   228         {
   216         {
   229             gc.BitBltMasked( Rect().iTl,
   217             gc.BitBltMasked( Rect().iTl,
   230                              iDefaultButton->Bitmap(),
   218                              iDefaultButton->Bitmap(),