mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverplugincontainer.cpp
branchRCL_3
changeset 53 3de6c4cf6b67
child 66 1f1dad4af8f8
equal deleted inserted replaced
52:14979e23cb5e 53:3de6c4cf6b67
       
     1 /*
       
     2 * Copyright (c) 2006 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 Screen Saver Plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <eikenv.h>
       
    22 #include <data_caging_path_literals.hrh>
       
    23 #include <screensaverplugin.h>
       
    24 #include <AknsUtils.h>
       
    25 #include <AknUtils.h>
       
    26 #include <AknBidiTextUtils.h>
       
    27 #include <eiklabel.h>
       
    28 #include <aknlayoutscalable_avkon.cdl.h>
       
    29 #include <StringLoader.h>
       
    30 #include <bitmaptransforms.h>
       
    31 #include <e32math.h>
       
    32 
       
    33 #include <PUAcodes.hrh>
       
    34 #include <barsread.h>
       
    35 
       
    36 #include <mpxmedia.h>
       
    37 #include <mpxmediageneraldefs.h>
       
    38 #include <mpxscreensaverplugin.rsg>
       
    39 #include <mpxscreensaverplugin.mbg>
       
    40 #include <mpxplaybackframeworkdefs.h>
       
    41 #include <mpxlog.h>
       
    42 #include <mpxuser.h>
       
    43 
       
    44 #include "mpxscreensaverplugincontainer.h"
       
    45 
       
    46 // Constants
       
    47 const TInt KMPXDurationDisplayResvLen = 10;
       
    48 const TInt KMPXNumBackgrounds = 4;
       
    49 #define KMPXIndicatorColor KRgbWhite
       
    50 
       
    51 _LIT( KIconFileName, "mpxscreensaverplugin.mbm" );
       
    52 _LIT( KMXPanicCategory, "CMPXScreenSaverPluginContainer" );
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CMPXScreenSaverPluginContainer::CMPXScreenSaverPluginContainer
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CMPXScreenSaverPluginContainer::CMPXScreenSaverPluginContainer(
       
    59     MScreensaverPluginHost *aHost ):
       
    60     iScreenSaverHost( aHost ),
       
    61     iParentControl( NULL ),
       
    62     iBackground( KMPXNumBackgrounds )
       
    63     {
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CMPXScreenSaverPluginContainer::ConstructL
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CMPXScreenSaverPluginContainer::ConstructL()
       
    71     {
       
    72     MPX_FUNC( "CMPXScreenSaverPluginContainer::ConstructL" );
       
    73 
       
    74     iEikEnv = CEikonEnv::Static();
       
    75     iTitleLabel = new ( ELeave ) CEikLabel();
       
    76     iClockLabel = new ( ELeave ) CEikLabel();
       
    77     iAmPmLabel = new ( ELeave ) CEikLabel();
       
    78 
       
    79     RefreshDisplayInfo();
       
    80     CreateIconsL();
       
    81     }
       
    82 
       
    83 // ----------------------------------------------------------------------------
       
    84 // CMPXScreenSaverPluginContainerContainer::~CMPXScreenSaverPluginContainerContainer
       
    85 // ----------------------------------------------------------------------------
       
    86 //
       
    87 CMPXScreenSaverPluginContainer::
       
    88     ~CMPXScreenSaverPluginContainer()
       
    89     {
       
    90     MPX_DEBUG1( "CMPXScreenSaverPluginContainer::~CMPXScreenSaverPluginContainer START" );
       
    91 
       
    92     delete iPlayIcon;
       
    93     delete iPauseIcon;
       
    94     delete iMessageIcon;
       
    95     delete iMissedCallIcon;
       
    96     delete iNewInstantMessageIcon;
       
    97     delete iNewVoiceMessageIcon;
       
    98     delete iNewEmailIcon;
       
    99     delete iKeyguardIcon;
       
   100 
       
   101     delete iTitleLabel;
       
   102     delete iClockLabel;
       
   103     delete iAmPmLabel;
       
   104     delete iProfileName;
       
   105 
       
   106     iBackground.ResetAndDestroy();
       
   107     iBackground.Close();
       
   108 
       
   109     if ( iIndicatorFont && iOSBitmapDevice )
       
   110         {
       
   111         iOSBitmapDevice->ReleaseFont( iIndicatorFont );
       
   112         }
       
   113 
       
   114     delete iOffScreenBitmap;
       
   115     delete iOSBitmapContext;
       
   116     delete iOSBitmapDevice;
       
   117 
       
   118     MPX_DEBUG1( "CMPXScreenSaverPluginContainer::~CMPXScreenSaverPluginContainer END" );
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CMPXScreenSaverPluginContainer::Draw
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 TInt CMPXScreenSaverPluginContainer::DrawL( CWindowGc& aGc,
       
   126     TMPXPlaybackState aPlaybackState )
       
   127     {
       
   128     MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawL" );
       
   129 
       
   130     TInt colorIndex = GetDrawPositionAndColorIndexL();
       
   131     if ( !iOffScreenBitmap )
       
   132         {
       
   133         TInt backgroundHeight = BackgroundHeightL();
       
   134         // create an off-screen bitmap, device and context
       
   135         iOffScreenBitmap = new ( ELeave ) CFbsBitmap();
       
   136         User::LeaveIfError( iOffScreenBitmap->Create(
       
   137             TSize( iScreenSize.iWidth, backgroundHeight),
       
   138             aGc.Device()->DisplayMode() ) );
       
   139         iOSBitmapDevice = CFbsBitmapDevice::NewL( iOffScreenBitmap );
       
   140         User::LeaveIfError( iOSBitmapDevice->CreateContext( iOSBitmapContext ) );
       
   141 
       
   142         iOSBitmapContext->SetPenColor( KMPXIndicatorColor );
       
   143         // brush style has to be null in order for icon mask to work
       
   144         iOSBitmapContext->SetBrushColor( KRgbBlack );
       
   145         iOSBitmapContext->SetBrushStyle( CGraphicsContext::ENullBrush );
       
   146         iOSBitmapContext->SetPenStyle( CGraphicsContext::ESolidPen );
       
   147 
       
   148         // update the layouts
       
   149         UpdateLayoutL();
       
   150 
       
   151         if ( iIndicatorFont )
       
   152             {
       
   153             iOSBitmapDevice->ReleaseFont( iIndicatorFont );
       
   154             }
       
   155         const CFont* origFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
       
   156         TFontSpec fontSpecTitle = origFont->FontSpecInTwips();
       
   157         fontSpecTitle.iHeight = iRectIndicators.Height();  // Scale smaller
       
   158         iOSBitmapDevice->GetNearestFontToDesignHeightInPixels( iIndicatorFont, fontSpecTitle );
       
   159 
       
   160         // reload the backgrounds
       
   161         LoadBackgroundsL();
       
   162         }
       
   163 
       
   164     iOSBitmapContext->Clear();
       
   165 
       
   166     DrawBackground( *iOSBitmapContext, colorIndex );
       
   167     DrawClockL( *iOSBitmapContext );
       
   168     DrawPlaybackStatusL( *iOSBitmapContext, aPlaybackState );
       
   169     DrawIndicatorsL( *iOSBitmapContext );
       
   170 
       
   171     aGc.SetBrushColor( KRgbBlack );
       
   172     aGc.Clear();
       
   173     // activate partial mode
       
   174     // partial mode is not supported in landscape orientation?
       
   175     TScreensaverPartialMode partialMode;
       
   176     TRect drawArea = TRect( TPoint(0, iStartY),
       
   177         TPoint( iOffScreenBitmap->SizeInPixels().iWidth,
       
   178         iOffScreenBitmap->SizeInPixels().iHeight + iStartY) );
       
   179     partialMode.iBpp = 8;
       
   180     partialMode.iType = EPartialModeTypeMostPowerSaving;
       
   181     TInt status = iScreenSaverHost->SetActiveDisplayArea(
       
   182         drawArea, partialMode );
       
   183     MPX_DEBUG2( "CMPXScreenSaverPluginContainer::DrawL SetActiveDisplayArea status = %d", status );
       
   184     aGc.BitBlt( TPoint(0, iStartY), iOffScreenBitmap );
       
   185 
       
   186     return KErrNone;
       
   187     }
       
   188 
       
   189 // -----------------------------------------------------------------------------
       
   190 // CMPXScreenSaverPluginContainer::SetSongPropertiesL
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 void CMPXScreenSaverPluginContainer::SetSongPropertiesL(
       
   194     const CMPXMedia& aMedia )
       
   195     {
       
   196     MPX_FUNC( "CMPXScreenSaverPluginContainer::SetSongPropertiesL" );
       
   197     iTitleLabel->SetTextL(
       
   198         aMedia.ValueText( KMPXMediaGeneralTitle ) );
       
   199     }
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CMPXScreenSaverPluginContainer::SetNewVoiceMessage
       
   203 // -----------------------------------------------------------------------------
       
   204 //
       
   205 void CMPXScreenSaverPluginContainer::SetParam(
       
   206     MPXScreenSaverPluginParam aType, TInt aValue )
       
   207     {
       
   208     MPX_DEBUG3( "-->CMPXScreenSaverPluginContainer::SetParam type = %d, value = %d", aType, aValue );
       
   209 
       
   210     switch ( aType )
       
   211         {
       
   212         case MPXScreenSaverPluginParamMissedCall:
       
   213             {
       
   214             iMissedCall = aValue;
       
   215             break;
       
   216             }
       
   217         case MPXScreenSaverPluginParamNewMessage:
       
   218             {
       
   219             iNewMessage = aValue;
       
   220             break;
       
   221             }
       
   222         case MPXScreenSaverPluginParamInstantMessage:
       
   223             {
       
   224             iNewInstantMessage = aValue;
       
   225             break;
       
   226             }
       
   227         case MPXScreenSaverPluginParamEmail:
       
   228             {
       
   229             iNewEmail = aValue;
       
   230             break;
       
   231             }
       
   232         case MPXScreenSaverPluginParamVoiceMessage:
       
   233             {
       
   234             iNewVoiceMessage = aValue;
       
   235             break;
       
   236             }
       
   237         case MPXScreenSaverPluginParamKeyguard:
       
   238             {
       
   239             iKeyguard = aValue;
       
   240             break;
       
   241             }
       
   242         case MPXScreenSaverPluginParamIsSilent:
       
   243             {
       
   244             iIsSilent = aValue;
       
   245             break;
       
   246             }
       
   247         default:
       
   248             break;
       
   249         }
       
   250     MPX_DEBUG1( "<--CMPXScreenSaverPluginContainer::SetParam" );
       
   251     }
       
   252 
       
   253 // -----------------------------------------------------------------------------
       
   254 // CMPXScreenSaverPluginContainer::SetProfileNameL
       
   255 // -----------------------------------------------------------------------------
       
   256 //
       
   257 void CMPXScreenSaverPluginContainer::SetProfileNameL(
       
   258     const TDesC& aName, TBool aDisplay )
       
   259     {
       
   260     MPX_FUNC( "CMPXScreenSaverPluginContainer::SetProfileNameL" );
       
   261     delete iProfileName;
       
   262     iProfileName = NULL;
       
   263     if ( aDisplay )
       
   264         {
       
   265         iProfileName = aName.AllocL();
       
   266         }
       
   267     }
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // CMPXScreenSaverPluginContainer::RefreshDisplayInfo
       
   271 // -----------------------------------------------------------------------------
       
   272 //
       
   273 void CMPXScreenSaverPluginContainer::RefreshDisplayInfo()
       
   274     {
       
   275     MPX_FUNC( "CMPXScreenSaverPluginContainer::RefreshDisplayInfo" );
       
   276 
       
   277     TScreensaverDisplayInfo displayInfo;
       
   278     displayInfo.iSize = sizeof( TScreensaverDisplayInfo );
       
   279     iScreenSaverHost->DisplayInfo( &displayInfo );
       
   280     iParentControl = displayInfo.iParent;
       
   281 
       
   282     // screen size from display info may not be full screen size
       
   283     iScreenSize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels();
       
   284     MPX_DEBUG3( "CMPXScreenSaverPluginContainer::RefreshDisplayInfo Screen size: %d %d", iScreenSize.iWidth, iScreenSize.iHeight );
       
   285 
       
   286     // delete them so that they will be recreated next time
       
   287     delete iOffScreenBitmap;
       
   288     iOffScreenBitmap = NULL;
       
   289     delete iOSBitmapContext;
       
   290     iOSBitmapContext = NULL;
       
   291     delete iOSBitmapDevice;
       
   292     iOSBitmapDevice = NULL;
       
   293     }
       
   294 
       
   295 // ---------------------------------------------------------------------------
       
   296 // With this method the plugin may request a one-shot timeout event
       
   297 // (EScreensaverEventTimeout) after the specified amount of seconds
       
   298 // has passed.
       
   299 // ---------------------------------------------------------------------------
       
   300 //
       
   301  void CMPXScreenSaverPluginContainer::RequestTimeout(TInt aSecs)
       
   302 	 {
       
   303 	 iScreenSaverHost->RequestTimeout( aSecs );
       
   304 	 }
       
   305 
       
   306 // ---------------------------------------------------------------------------
       
   307 // Create icons.
       
   308 // ---------------------------------------------------------------------------
       
   309 //
       
   310 void CMPXScreenSaverPluginContainer::CreateIconsL()
       
   311     {
       
   312     MPX_FUNC( "CMPXScreenSaverPluginContainer::CreateIconsL" );
       
   313 
       
   314     TParse parse;
       
   315     parse.Set( KIconFileName, &KDC_APP_RESOURCE_DIR, NULL );
       
   316     TFileName iconFile( parse.FullName() );
       
   317     User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
       
   318 
       
   319     iPlayIcon = CreateIconL(
       
   320         KAknsIIDQgnIndiMupPlay,
       
   321         KAknsIIDQsnIconColors,
       
   322         EAknsCIQsnIconColorsCG1,
       
   323         iconFile,
       
   324         EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_play,
       
   325         EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_play_mask,
       
   326         ETrue );
       
   327 
       
   328     iPauseIcon = CreateIconL(
       
   329         KAknsIIDQgnIndiMupPause,
       
   330         KAknsIIDQsnIconColors,
       
   331         EAknsCIQsnIconColorsCG1,
       
   332         iconFile,
       
   333         EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_pause,
       
   334         EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_pause_mask,
       
   335         ETrue );
       
   336 
       
   337     iMessageIcon = CreateIconL(
       
   338         KAknsIIDQgnStatMessage,
       
   339         KAknsIIDQsnIconColors,
       
   340         EAknsMinorDefault,
       
   341         iconFile,
       
   342         EMbmMpxscreensaverpluginQgn_stat_message,
       
   343         EMbmMpxscreensaverpluginQgn_stat_message_mask,
       
   344         ETrue );
       
   345 
       
   346     iMissedCallIcon = CreateIconL(
       
   347         KAknsIIDQgnStatMissedCallsUni,
       
   348         KAknsIIDQsnIconColors,
       
   349         EAknsMinorDefault,
       
   350         iconFile,
       
   351         EMbmMpxscreensaverpluginQgn_stat_missed_calls_uni,
       
   352         EMbmMpxscreensaverpluginQgn_stat_missed_calls_uni_mask,
       
   353         ETrue );
       
   354 
       
   355     iNewInstantMessageIcon = CreateIconL(
       
   356         KAknsIIDQgnStatImUni,
       
   357         KAknsIIDQsnIconColors,
       
   358         EAknsMinorDefault,
       
   359         iconFile,
       
   360         EMbmMpxscreensaverpluginQgn_stat_im_uni,
       
   361         EMbmMpxscreensaverpluginQgn_stat_im_uni_mask,
       
   362         ETrue );
       
   363 
       
   364     iNewVoiceMessageIcon = CreateIconL(
       
   365         KAknsIIDQgnStatVm0,
       
   366         KAknsIIDQsnIconColors,
       
   367         EAknsMinorDefault,
       
   368         iconFile,
       
   369         EMbmMpxscreensaverpluginQgn_stat_vm0,
       
   370         EMbmMpxscreensaverpluginQgn_stat_vm0_mask,
       
   371         ETrue );
       
   372 
       
   373     iNewEmailIcon = CreateIconL(
       
   374         KAknsIIDQgnStatMessageMail,
       
   375         KAknsIIDQsnIconColors,
       
   376         EAknsMinorDefault,
       
   377         iconFile,
       
   378         EMbmMpxscreensaverpluginQgn_stat_message_mail,
       
   379         EMbmMpxscreensaverpluginQgn_stat_message_mail_mask,
       
   380         ETrue );
       
   381 
       
   382     iKeyguardIcon = CreateIconL(
       
   383         KAknsIIDQgnStatKeyguard,
       
   384         KAknsIIDQsnIconColors,
       
   385         EAknsMinorDefault,
       
   386         iconFile,
       
   387         EMbmMpxscreensaverpluginQgn_stat_keyguard,
       
   388         EMbmMpxscreensaverpluginQgn_stat_keyguard_mask,
       
   389         ETrue );
       
   390 
       
   391     LoadBackgroundsL();
       
   392     }
       
   393 
       
   394 // ---------------------------------------------------------------------------
       
   395 // Create a color icon.
       
   396 // ---------------------------------------------------------------------------
       
   397 //
       
   398 CGulIcon* CMPXScreenSaverPluginContainer::CreateIconL(
       
   399     const TAknsItemID& aID,
       
   400     const TAknsItemID& aColorId,
       
   401     TInt aColorIndex,
       
   402     const TDesC& aBitmapFilename,
       
   403     TInt aFileBitmapId,
       
   404     TInt aFileMaskId,
       
   405     TBool aIsIndicator
       
   406     )
       
   407     {
       
   408     MPX_FUNC( "CMPXScreenSaverPluginContainer::CreateIconL" );
       
   409 
       
   410     MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
       
   411 
       
   412     CFbsBitmap* icon( NULL );
       
   413     CFbsBitmap* mask( NULL );
       
   414 
       
   415     if ( aColorId == KAknsIIDNone )
       
   416         {
       
   417         // do not use theme color, use the default color from the file
       
   418         AknsUtils::CreateIconLC( skin, aID,
       
   419             icon, mask, aBitmapFilename, aFileBitmapId, aFileMaskId );
       
   420         }
       
   421     else
       
   422         {
       
   423         // use theme color
       
   424         AknsUtils::CreateColorIconLC( skin, aID, aColorId, aColorIndex,
       
   425             icon, mask, aBitmapFilename, aFileBitmapId, aFileMaskId, KRgbBlack );
       
   426         }
       
   427 
       
   428     if ( aIsIndicator )
       
   429         {
       
   430         // should not be theme colored since everything else is not?
       
   431         AknIconUtils::SetIconColor( icon, KMPXIndicatorColor );
       
   432         }
       
   433 
       
   434     CGulIcon* res = CGulIcon::NewL( icon, mask );
       
   435     res->SetBitmapsOwnedExternally( EFalse );
       
   436     CleanupStack::Pop( 2 ); // mask, icon
       
   437     return res;
       
   438     }
       
   439 
       
   440 // ---------------------------------------------------------------------------
       
   441 // Load the backgrounds, and resize them to screen size
       
   442 // ---------------------------------------------------------------------------
       
   443 //
       
   444 void CMPXScreenSaverPluginContainer::LoadBackgroundsL()
       
   445     {
       
   446     MPX_FUNC( "CMPXScreenSaverPluginContainer::LoadBackgroundsL" );
       
   447 
       
   448     TParse parse;
       
   449     parse.Set( KIconFileName, &KDC_APP_RESOURCE_DIR, NULL );
       
   450     TFileName iconFile;
       
   451     iconFile.Append( parse.FullName() );
       
   452     User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
       
   453 
       
   454     iBackground.ResetAndDestroy();
       
   455 
       
   456     TInt width = iScreenSize.iWidth;
       
   457     TInt height = BackgroundHeightL();
       
   458 
       
   459     CGulIcon* icon = CreateIconL(
       
   460         KAknsIIDNone,
       
   461         KAknsIIDNone,
       
   462         EAknsMinorNone,
       
   463         iconFile,
       
   464         EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_01,
       
   465         EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_01_mask,
       
   466         EFalse );
       
   467     AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ),
       
   468         EAspectRatioNotPreserved );
       
   469     iBackground.Append( icon );
       
   470     icon = NULL;
       
   471 
       
   472     icon = CreateIconL(
       
   473         KAknsIIDNone,
       
   474         KAknsIIDNone,
       
   475         EAknsMinorNone,
       
   476         iconFile,
       
   477         EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_02,
       
   478         EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_02_mask,
       
   479         EFalse );
       
   480     AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ),
       
   481         EAspectRatioNotPreserved );
       
   482     iBackground.Append( icon );
       
   483     icon = NULL;
       
   484 
       
   485     icon = CreateIconL(
       
   486         KAknsIIDNone,
       
   487         KAknsIIDNone,
       
   488         EAknsMinorNone,
       
   489         iconFile,
       
   490         EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_03,
       
   491         EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_03_mask,
       
   492         EFalse );
       
   493     AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ),
       
   494         EAspectRatioNotPreserved );
       
   495     iBackground.Append( icon );
       
   496     icon = NULL;
       
   497 
       
   498     icon = CreateIconL(
       
   499         KAknsIIDNone,
       
   500         KAknsIIDNone,
       
   501         EAknsMinorNone,
       
   502         iconFile,
       
   503         EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_04,
       
   504         EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_04_mask,
       
   505         EFalse );
       
   506     AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ),
       
   507         EAspectRatioNotPreserved );
       
   508     iBackground.Append( icon );
       
   509     icon = NULL;
       
   510     }
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // CMPXScreenSaverPluginContainer::DrawClock
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 void CMPXScreenSaverPluginContainer::DrawClockL( CBitmapContext& aGc )
       
   517     {
       
   518     MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawClockL" );
       
   519 
       
   520     // Draw clock display
       
   521     TTime time;
       
   522     time.HomeTime();
       
   523     // R_QTN_TIME_USUAL_WITH_ZERO cannot be used because ZDigi does not have
       
   524     // alphabets
       
   525     HBufC* format = StringLoader::LoadLC(
       
   526         R_MPX_SCREENSAVER_TIME_USUAL_WITHOUT_AMPM );
       
   527     HBufC* clockTime = HBufC::NewLC(
       
   528         format->Length() + KMPXDurationDisplayResvLen );
       
   529     TPtr clockTimePtr = clockTime->Des();
       
   530     MPX_TRAPD( err, time.FormatL( clockTimePtr, *format ) );
       
   531     if (err != KErrNone)
       
   532         {
       
   533         clockTimePtr = KNullDesC;
       
   534         }
       
   535     // time digifont does not contain arabic / indic etc numbers.
       
   536     // If clock font is changed, or digifont starts supporting language-
       
   537     // specific numbers, the commented-out call below should be restored
       
   538     /*
       
   539     else
       
   540         {
       
   541         AknTextUtils::LanguageSpecificNumberConversion( clockTimePtr );
       
   542         }
       
   543     */
       
   544 
       
   545     // AM/PM text
       
   546     HBufC* ampmFormat = StringLoader::LoadLC( R_MPX_SCREENSAVER_AMPM );
       
   547     HBufC* ampm = HBufC::NewLC( ampmFormat->Length() + KMPXDurationDisplayResvLen );
       
   548     TPtr ampmPtr = ampm->Des();
       
   549     MPX_TRAP( err, time.FormatL( ampmPtr, *ampmFormat ) );
       
   550     if ( err != KErrNone )
       
   551         {
       
   552         ampmPtr = KNullDesC;
       
   553         }
       
   554 
       
   555     TRgb color( KMPXIndicatorColor );
       
   556     aGc.UseFont( iClockLabel->Font() );
       
   557     aGc.SetPenColor( color );
       
   558     TInt width = iClockLabel->Font()->TextWidthInPixels( clockTimePtr );
       
   559     // align right
       
   560     aGc.DrawText( clockTimePtr,
       
   561             TPoint( iClockLabel->Rect().iBr.iX - width, iClockLabel->Rect().iBr.iY ) );
       
   562 
       
   563     // draw AM/PM if time format is 12-hour
       
   564     TLocale locale;
       
   565     if ( locale.TimeFormat() == ETime12 )
       
   566         {
       
   567         aGc.DiscardFont();
       
   568         aGc.UseFont( iAmPmLabel->Font() );
       
   569         width = iAmPmLabel->Font()->TextWidthInPixels( ampmPtr );
       
   570         // align right
       
   571         aGc.DrawText( ampmPtr,
       
   572             TPoint( iAmPmLabel->Rect().iBr.iX - width, iAmPmLabel->Rect().iBr.iY ) );
       
   573         }
       
   574 
       
   575     aGc.DiscardFont();
       
   576     CleanupStack::PopAndDestroy( ampm );
       
   577     CleanupStack::PopAndDestroy( ampmFormat );
       
   578     CleanupStack::PopAndDestroy( clockTime );
       
   579     CleanupStack::PopAndDestroy( format );
       
   580     }
       
   581 
       
   582 // -----------------------------------------------------------------------------
       
   583 // CMPXScreenSaverPluginContainer::DrawBackground
       
   584 // -----------------------------------------------------------------------------
       
   585 //
       
   586 void CMPXScreenSaverPluginContainer::DrawBackground(
       
   587     CBitmapContext& aGc, TInt aColorIndex )
       
   588     {
       
   589     MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawBackground" );
       
   590     aGc.BitBltMasked(
       
   591         TPoint(),
       
   592         iBackground[ aColorIndex ]->Bitmap(),
       
   593         TRect( aGc.Device()->SizeInPixels() ),
       
   594         iBackground[ aColorIndex ]->Mask(),
       
   595         EFalse );
       
   596     }
       
   597 
       
   598 // -----------------------------------------------------------------------------
       
   599 // CMPXScreenSaverPluginContainer::DrawPlaybackStatus
       
   600 // -----------------------------------------------------------------------------
       
   601 //
       
   602 void CMPXScreenSaverPluginContainer::DrawPlaybackStatusL(
       
   603     CBitmapContext& aGc, TMPXPlaybackState aPlaybackState )
       
   604     {
       
   605     MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawPlaybackStatus" );
       
   606 
       
   607     TBool showTitle = EFalse;
       
   608 
       
   609     // Draw play status icon (if any)
       
   610     CGulIcon* icon = NULL;
       
   611     switch ( aPlaybackState )
       
   612         {
       
   613         case EPbStatePlaying:
       
   614             {
       
   615             icon = iPlayIcon;
       
   616             showTitle = ETrue;
       
   617             break;
       
   618             }
       
   619         case EPbStatePaused:
       
   620             {
       
   621             icon = iPauseIcon;
       
   622             showTitle = ETrue;
       
   623             break;
       
   624             }
       
   625         default:
       
   626             {
       
   627             break;
       
   628             }
       
   629         }
       
   630     if ( icon )
       
   631         {
       
   632         aGc.BitBltMasked(
       
   633             iRectPlaybackStatus.iTl,
       
   634             icon->Bitmap(),
       
   635             TRect( iRectPlaybackStatus.Size() ),
       
   636             icon->Mask(),
       
   637             EFalse );
       
   638         }
       
   639 
       
   640     TRgb color( KMPXIndicatorColor );
       
   641     aGc.UseFont( iTitleLabel->Font() );
       
   642     aGc.SetPenColor( color );
       
   643 
       
   644     if ( iTitleLabel->Text() && showTitle )
       
   645         {
       
   646         HBufC* buf = iTitleLabel->Text()->AllocL();
       
   647         CleanupStack::PushL( buf );
       
   648         TPtr ptr( buf->Des() );
       
   649         AknBidiTextUtils::ConvertToVisualAndClipL(
       
   650             ptr,
       
   651             *iTitleLabel->Font(),
       
   652             iTitleLabel->Rect().Width(),
       
   653             iTitleLabel->Rect().Width() );
       
   654         aGc.DrawText( ptr,
       
   655             TPoint( iTitleLabel->Rect().iTl.iX, iTitleLabel->Rect().iBr.iY ) );
       
   656         CleanupStack::PopAndDestroy( buf );
       
   657         }
       
   658     else
       
   659         {
       
   660         TTime time;
       
   661         time.HomeTime();
       
   662         HBufC* format = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO );
       
   663         HBufC* clockTime = HBufC::NewLC( format->Length() + KMPXDurationDisplayResvLen );
       
   664         TPtr clockTimePtr = clockTime->Des();
       
   665         time.FormatL( clockTimePtr, *format );
       
   666         AknTextUtils::LanguageSpecificNumberConversion( clockTimePtr );
       
   667 
       
   668         aGc.DrawText( clockTimePtr,
       
   669             TPoint( iTitleLabel->Rect().iTl.iX, iTitleLabel->Rect().iBr.iY ) );
       
   670 
       
   671         CleanupStack::PopAndDestroy( clockTime );
       
   672         CleanupStack::PopAndDestroy( format );
       
   673         }
       
   674     aGc.DiscardFont();
       
   675     }
       
   676 
       
   677 // -----------------------------------------------------------------------------
       
   678 // CMPXScreenSaverPluginContainer::DrawIndicatorsL
       
   679 // -----------------------------------------------------------------------------
       
   680 //
       
   681 void CMPXScreenSaverPluginContainer::DrawIndicatorsL(
       
   682      CBitmapContext& aGc )
       
   683     {
       
   684     MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawIndicatorsL" );
       
   685 
       
   686     TSize indicatorSize = TSize( iRectIndicators.Height(),
       
   687         iRectIndicators.Height() );
       
   688     MPX_DEBUG2( "CMPXScreenSaverPluginContainer::DrawIndicatorsL indicator height %d", iRectIndicators.Height() );
       
   689     iStartX = iRectIndicators.iTl.iX;
       
   690 
       
   691     TRgb color( KMPXIndicatorColor );
       
   692     aGc.SetPenColor( color );
       
   693     aGc.UseFont( iIndicatorFont );
       
   694 
       
   695     if ( iKeyguard > 0 )
       
   696         {
       
   697         MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing keyguard %d %d", iStartX, iRectIndicators.iTl.iY );
       
   698         DoDrawIndicatorsL( aGc, -1, iKeyguardIcon, iIndicatorFont,
       
   699             iRectIndicators, indicatorSize);
       
   700         }
       
   701 
       
   702     if ( iMissedCall > 0 )
       
   703         {
       
   704         MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new miss call %d %d", iStartX, iRectIndicators.iTl.iY );
       
   705         DoDrawIndicatorsL( aGc, iMissedCall, iMissedCallIcon, iIndicatorFont,
       
   706             iRectIndicators, indicatorSize);
       
   707         }
       
   708 
       
   709     if ( iNewMessage > 0 )
       
   710         {
       
   711         MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new message %d %d", iStartX, iRectIndicators.iTl.iY );
       
   712         DoDrawIndicatorsL( aGc, iNewMessage, iMessageIcon, iIndicatorFont,
       
   713             iRectIndicators, indicatorSize);
       
   714         }
       
   715 
       
   716     if ( iNewInstantMessage > 0 )
       
   717         {
       
   718         MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new instant message %d %d", iStartX, iRectIndicators.iTl.iY );
       
   719         DoDrawIndicatorsL( aGc, 0, iNewInstantMessageIcon, iIndicatorFont,
       
   720             iRectIndicators, indicatorSize);
       
   721         }
       
   722 
       
   723     if ( iNewEmail > 0 )
       
   724         {
       
   725         MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new email %d %d", iStartX, iRectIndicators.iTl.iY );
       
   726         DoDrawIndicatorsL( aGc, 0, iNewEmailIcon, iIndicatorFont,
       
   727             iRectIndicators, indicatorSize);
       
   728         }
       
   729 
       
   730     if ( iNewVoiceMessage > 0 )
       
   731         {
       
   732         MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new voice message %d %d", iStartX, iRectIndicators.iTl.iY );
       
   733         DoDrawIndicatorsL( aGc, 0, iNewVoiceMessageIcon,
       
   734             iIndicatorFont, iRectIndicators, indicatorSize);
       
   735         }
       
   736 
       
   737     if ( ( iProfileName ) || ( iIsSilent ) )
       
   738         {
       
   739         MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing profile name %d %d", iStartX, iRectIndicators.iTl.iY );
       
   740         // clip text to fit screen
       
   741         HBufC* buf;
       
   742         if ( iProfileName )
       
   743             {
       
   744             buf = HBufC::NewLC( iProfileName->Length() +
       
   745                 KMPXDurationDisplayResvLen );
       
   746             }
       
   747         else
       
   748             {
       
   749             buf = HBufC::NewLC( KMPXDurationDisplayResvLen );
       
   750             }
       
   751         TPtr ptr( buf->Des() );
       
   752         if ( iIsSilent )
       
   753             {
       
   754             ptr.Append( KPuaCodeSilentSymbol );
       
   755             }
       
   756         if ( iProfileName )
       
   757             {
       
   758             ptr.Append( iProfileName->Des() );
       
   759             AknBidiTextUtils::ConvertToVisualAndClipL(
       
   760                 ptr,
       
   761                 *iIndicatorFont,
       
   762                 iRectIndicators.iBr.iX - iStartX,
       
   763                 iRectIndicators.iBr.iX - iStartX );
       
   764             }
       
   765         aGc.DrawText(  *buf,
       
   766             TPoint( iStartX, iRectIndicators.iTl.iY + indicatorSize.iHeight ) );
       
   767         CleanupStack::PopAndDestroy( buf );
       
   768         }
       
   769 
       
   770     aGc.DiscardFont();
       
   771     }
       
   772 
       
   773 // -----------------------------------------------------------------------------
       
   774 // CMPXScreenSaverPluginContainer::DrawIndicatorsL
       
   775 // -----------------------------------------------------------------------------
       
   776 //
       
   777 void CMPXScreenSaverPluginContainer::DoDrawIndicatorsL(
       
   778      CBitmapContext& aGc, TInt aDisplayNumber, CGulIcon* aDisplayIcon,
       
   779      CFont* aFont, TRect aRect, TSize aSize )
       
   780     {
       
   781     MPX_FUNC( "CMPXScreenSaverPluginContainer::DoDrawIndicatorsL" );
       
   782 
       
   783     if ( aDisplayNumber > 0 )
       
   784         {
       
   785         HBufC* stringBuf = HBufC::NewLC( 5 );
       
   786         stringBuf->Des().AppendNum( aDisplayNumber );
       
   787         aGc.DrawText( stringBuf->Des(),
       
   788             TPoint( iStartX, aRect.iTl.iY + aSize.iHeight ) );
       
   789         iStartX = iStartX + aFont->TextWidthInPixels( stringBuf->Des() );
       
   790         CleanupStack::PopAndDestroy( stringBuf );
       
   791         }
       
   792     aGc.BitBltMasked(
       
   793         TPoint( iStartX, aRect.iTl.iY ),
       
   794         aDisplayIcon->Bitmap(),
       
   795         TRect( aSize ),
       
   796         aDisplayIcon->Mask(),
       
   797         EFalse );
       
   798     iStartX = iStartX + aSize.iWidth;
       
   799     }
       
   800 
       
   801 // ---------------------------------------------------------------------------
       
   802 // Get layout data for an graphical indicator.
       
   803 // ---------------------------------------------------------------------------
       
   804 //
       
   805 TRect CMPXScreenSaverPluginContainer::IndicatorLayout(
       
   806     MPXScreenSaverPluginControl aControl )
       
   807     {
       
   808     MPX_FUNC( "CMPXScreenSaverPluginContainer::IndicatorLayout" );
       
   809     TInt resId = 0;
       
   810     if ( iScreenSize == TSize( 176, 208 ) )    //lowest portrait
       
   811         {
       
   812         switch ( aControl )
       
   813             {
       
   814             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   815                 {
       
   816                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_LOWRES_PORTRAIT;
       
   817                 break;
       
   818                 }
       
   819             case MPXScreenSaverPluginIndicatorOther:
       
   820                 {
       
   821                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_LOWRES_PORTRAIT;
       
   822                 break;
       
   823                 }
       
   824             default:
       
   825                 {
       
   826                 __ASSERT_ALWAYS(EFalse,
       
   827                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
   828                 break;
       
   829                 }
       
   830             }
       
   831         }
       
   832     else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait
       
   833         {
       
   834         switch (aControl)
       
   835             {
       
   836             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   837                 {
       
   838                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_DOUBLE_PORTRAIT;
       
   839                 break;
       
   840                 }
       
   841             case MPXScreenSaverPluginIndicatorOther:
       
   842                 {
       
   843                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_DOUBLE_PORTRAIT;
       
   844                 break;
       
   845                 }
       
   846             default:
       
   847                 {
       
   848                 __ASSERT_ALWAYS(EFalse,
       
   849                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
   850                 break;
       
   851                 }
       
   852             }
       
   853         }
       
   854     else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait
       
   855         {
       
   856         switch (aControl)
       
   857             {
       
   858             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   859                 {
       
   860                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QVGA_PORTRAIT;
       
   861                 break;
       
   862                 }
       
   863             case MPXScreenSaverPluginIndicatorOther:
       
   864                 {
       
   865                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QVGA_PORTRAIT;
       
   866                 break;
       
   867                 }
       
   868             default:
       
   869                 {
       
   870                 __ASSERT_ALWAYS(EFalse,
       
   871                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
   872                 break;
       
   873                 }
       
   874             }
       
   875         }
       
   876     else if ( iScreenSize == TSize( 208, 176 ) )    //lowest landscape
       
   877         {
       
   878         switch ( aControl )
       
   879             {
       
   880             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   881                 {
       
   882                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_LOWRES_LANDSCAPE;
       
   883                 break;
       
   884                 }
       
   885             case MPXScreenSaverPluginIndicatorOther:
       
   886                 {
       
   887                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_LOWRES_LANDSCAPE;
       
   888                 break;
       
   889                 }
       
   890             default:
       
   891                 {
       
   892                 __ASSERT_ALWAYS(EFalse,
       
   893                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
   894                 break;
       
   895                 }
       
   896             }
       
   897         }
       
   898     else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape
       
   899         {
       
   900         switch (aControl)
       
   901             {
       
   902             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   903                 {
       
   904                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_DOUBLE_LANDSCAPE;
       
   905                 break;
       
   906                 }
       
   907             case MPXScreenSaverPluginIndicatorOther:
       
   908                 {
       
   909                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_DOUBLE_LANDSCAPE;
       
   910                 break;
       
   911                 }
       
   912             default:
       
   913                 {
       
   914                 __ASSERT_ALWAYS(EFalse,
       
   915                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
   916                 break;
       
   917                 }
       
   918             }
       
   919         }
       
   920     else if ( iScreenSize == TSize( 320, 240 ) ) //QVGA landscape
       
   921         {
       
   922         switch (aControl)
       
   923             {
       
   924             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   925                 {
       
   926                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QVGA_LANDSCAPE;
       
   927                 break;
       
   928                 }
       
   929             case MPXScreenSaverPluginIndicatorOther:
       
   930                 {
       
   931                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QVGA_LANDSCAPE;
       
   932                 break;
       
   933                 }
       
   934             default:
       
   935                 {
       
   936                 __ASSERT_ALWAYS(EFalse,
       
   937                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
   938                 break;
       
   939                 }
       
   940             }
       
   941         }
       
   942     else if ( iScreenSize == TSize( 360, 640 ) ) // QHD portrait
       
   943         {
       
   944         switch (aControl)
       
   945             {
       
   946             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   947                 {
       
   948                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QHD_PORTRAIT;
       
   949                 break;
       
   950                 }
       
   951             case MPXScreenSaverPluginIndicatorOther:
       
   952                 {
       
   953                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QHD_PORTRAIT;
       
   954                 break;
       
   955                 }
       
   956             default:
       
   957                 {
       
   958                 __ASSERT_ALWAYS(EFalse,
       
   959                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
   960                 break;
       
   961                 }
       
   962             }
       
   963         }
       
   964     else if ( iScreenSize == TSize( 640, 360 ) ) // QHD landscape
       
   965         {
       
   966         switch (aControl)
       
   967             {
       
   968             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   969                 {
       
   970                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QHD_LANDSCAPE;
       
   971                 break;
       
   972                 }
       
   973             case MPXScreenSaverPluginIndicatorOther:
       
   974                 {
       
   975                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QHD_LANDSCAPE;
       
   976                 break;
       
   977                 }
       
   978             default:
       
   979                 {
       
   980                 __ASSERT_ALWAYS(EFalse,
       
   981                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
   982                 break;
       
   983                 }
       
   984             }
       
   985         }
       
   986     else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait
       
   987         {
       
   988         switch (aControl)
       
   989             {
       
   990             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
   991                 {
       
   992                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_VGA_PORTRAIT;
       
   993                 break;
       
   994                 }
       
   995             case MPXScreenSaverPluginIndicatorOther:
       
   996                 {
       
   997                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_VGA_PORTRAIT;
       
   998                 break;
       
   999                 }
       
  1000             default:
       
  1001                 {
       
  1002                 __ASSERT_ALWAYS(EFalse,
       
  1003                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1004                 break;
       
  1005                 }
       
  1006             }
       
  1007         }
       
  1008     else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape
       
  1009         {
       
  1010         switch (aControl)
       
  1011             {
       
  1012             case MPXScreenSaverPluginIndicatorPlaybackStatus:
       
  1013                 {
       
  1014                 resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_VGA_LANDSCAPE;
       
  1015                 break;
       
  1016                 }
       
  1017             case MPXScreenSaverPluginIndicatorOther:
       
  1018                 {
       
  1019                 resId = R_MPX_SCREENSAVER_INDI_LAYOUT_VGA_LANDSCAPE;
       
  1020                 break;
       
  1021                 }
       
  1022             default:
       
  1023                 {
       
  1024                 __ASSERT_ALWAYS(EFalse,
       
  1025                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1026                 break;
       
  1027                 }
       
  1028             }
       
  1029         }
       
  1030 	else
       
  1031         {
       
  1032         User::Panic( KMXPanicCategory, KErrNotSupported );
       
  1033         }
       
  1034     TAknLayoutRect res;
       
  1035     res.LayoutRect( TRect( TPoint( 0, 0),
       
  1036         TPoint( iOffScreenBitmap->SizeInPixels().iWidth,
       
  1037         iOffScreenBitmap->SizeInPixels().iHeight) ), resId );
       
  1038     return res.Rect();
       
  1039     }
       
  1040 
       
  1041 // ---------------------------------------------------------------------------
       
  1042 // Get layout data for an graphical indicator.
       
  1043 // ---------------------------------------------------------------------------
       
  1044 //
       
  1045 void CMPXScreenSaverPluginContainer::LabelLayoutL(
       
  1046     MPXScreenSaverPluginControl aControl )
       
  1047     {
       
  1048     MPX_FUNC( "CMPXScreenSaverPluginContainer::LabelLayoutL" );
       
  1049     TInt resId = 0;
       
  1050     CEikLabel* label = NULL;
       
  1051     if ( iScreenSize == TSize( 176, 208 ) )    //lowest portrait
       
  1052         {
       
  1053         switch ( aControl )
       
  1054             {
       
  1055             case MPXScreenSaverPluginLabelTitle:
       
  1056                 {
       
  1057                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_LOWRES_PORTRAIT;
       
  1058                 label = iTitleLabel;
       
  1059                 break;
       
  1060                 }
       
  1061             case MPXScreenSaverPluginLabelClock:
       
  1062                 {
       
  1063                 TLanguage uiLanguage = User::Language();
       
  1064                 if( uiLanguage == ELangArabic ||
       
  1065                     uiLanguage == ELangUrdu ||
       
  1066                     uiLanguage == ELangFarsi )
       
  1067                     {
       
  1068                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_PORTRAIT_ARABIC;
       
  1069                     }
       
  1070                 else
       
  1071                     {
       
  1072                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_PORTRAIT;
       
  1073                     }
       
  1074                 label = iClockLabel;
       
  1075                 break;
       
  1076                 }
       
  1077             case MPXScreenSaverPluginLabelAmPm:
       
  1078                 {
       
  1079                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_LOWRES_PORTRAIT;
       
  1080                 label = iAmPmLabel;
       
  1081                 break;
       
  1082                 }
       
  1083             default:
       
  1084                 {
       
  1085                 __ASSERT_ALWAYS(EFalse,
       
  1086                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1087                 break;
       
  1088                 }
       
  1089             }
       
  1090         }
       
  1091     else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait
       
  1092         {
       
  1093         switch (aControl)
       
  1094             {
       
  1095             case MPXScreenSaverPluginLabelTitle:
       
  1096                 {
       
  1097                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_DOUBLE_PORTRAIT;
       
  1098                 label = iTitleLabel;
       
  1099                 break;
       
  1100                 }
       
  1101             case MPXScreenSaverPluginLabelClock:
       
  1102                 {
       
  1103                 TLanguage uiLanguage = User::Language();
       
  1104                 if( uiLanguage == ELangArabic ||
       
  1105                     uiLanguage == ELangUrdu ||
       
  1106                     uiLanguage == ELangFarsi )
       
  1107                     {
       
  1108                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_PORTRAIT_ARABIC;
       
  1109                     }
       
  1110                 else
       
  1111                     {
       
  1112                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_PORTRAIT;
       
  1113                     }
       
  1114 
       
  1115                 label = iClockLabel;
       
  1116                 break;
       
  1117                 }
       
  1118             case MPXScreenSaverPluginLabelAmPm:
       
  1119                 {
       
  1120                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_DOUBLE_PORTRAIT;
       
  1121                 label = iAmPmLabel;
       
  1122                 break;
       
  1123                 }
       
  1124             default:
       
  1125                 {
       
  1126                 __ASSERT_ALWAYS(EFalse,
       
  1127                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1128                 break;
       
  1129                 }
       
  1130             }
       
  1131         }
       
  1132     else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait
       
  1133         {
       
  1134         switch (aControl)
       
  1135             {
       
  1136             case MPXScreenSaverPluginLabelTitle:
       
  1137                 {
       
  1138                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QVGA_PORTRAIT;
       
  1139                 label = iTitleLabel;
       
  1140                 break;
       
  1141                 }
       
  1142             case MPXScreenSaverPluginLabelClock:
       
  1143                 {
       
  1144                 TLanguage uiLanguage = User::Language();
       
  1145                 if( uiLanguage == ELangArabic ||
       
  1146                     uiLanguage == ELangUrdu ||
       
  1147                     uiLanguage == ELangFarsi )
       
  1148                     {
       
  1149                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_PORTRAIT_ARABIC;
       
  1150                     }
       
  1151                 else
       
  1152                     {
       
  1153                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_PORTRAIT;
       
  1154                     }
       
  1155                 label = iClockLabel;
       
  1156                 break;
       
  1157                 }
       
  1158             case MPXScreenSaverPluginLabelAmPm:
       
  1159                 {
       
  1160                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QVGA_PORTRAIT;
       
  1161                 label = iAmPmLabel;
       
  1162                 break;
       
  1163                 }
       
  1164             default:
       
  1165                 {
       
  1166                 __ASSERT_ALWAYS(EFalse,
       
  1167                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1168                 break;
       
  1169                 }
       
  1170             }
       
  1171         }
       
  1172     else if ( iScreenSize == TSize( 208, 176 ) )    //lowest landscape
       
  1173         {
       
  1174         switch ( aControl )
       
  1175             {
       
  1176             case MPXScreenSaverPluginLabelTitle:
       
  1177                 {
       
  1178                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_LOWRES_LANDSCAPE;
       
  1179                 label = iTitleLabel;
       
  1180                 break;
       
  1181                 }
       
  1182             case MPXScreenSaverPluginLabelClock:
       
  1183                 {
       
  1184                 TLanguage uiLanguage = User::Language();
       
  1185                 if( uiLanguage == ELangArabic ||
       
  1186                     uiLanguage == ELangUrdu ||
       
  1187                     uiLanguage == ELangFarsi )
       
  1188                     {
       
  1189                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_LANDSCAPE_ARABIC;
       
  1190                     }
       
  1191                 else
       
  1192                     {
       
  1193                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_LANDSCAPE;
       
  1194                     }
       
  1195 
       
  1196                 label = iClockLabel;
       
  1197                 break;
       
  1198                 }
       
  1199             case MPXScreenSaverPluginLabelAmPm:
       
  1200                 {
       
  1201                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_LOWRES_LANDSCAPE;
       
  1202                 label = iAmPmLabel;
       
  1203                 break;
       
  1204                 }
       
  1205             default:
       
  1206                 {
       
  1207                 __ASSERT_ALWAYS(EFalse,
       
  1208                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1209                 break;
       
  1210                 }
       
  1211             }
       
  1212         }
       
  1213     else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape
       
  1214         {
       
  1215         switch (aControl)
       
  1216             {
       
  1217             case MPXScreenSaverPluginLabelTitle:
       
  1218                 {
       
  1219                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_DOUBLE_LANDSCAPE;
       
  1220                 label = iTitleLabel;
       
  1221                 break;
       
  1222                 }
       
  1223             case MPXScreenSaverPluginLabelClock:
       
  1224                 {
       
  1225                 TLanguage uiLanguage = User::Language();
       
  1226                 if( uiLanguage == ELangArabic ||
       
  1227                     uiLanguage == ELangUrdu ||
       
  1228                     uiLanguage == ELangFarsi )
       
  1229                     {
       
  1230                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_LANDSCAPE_ARABIC;
       
  1231                     }
       
  1232                 else
       
  1233                     {
       
  1234                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_LANDSCAPE;
       
  1235                     }
       
  1236                 label = iClockLabel;
       
  1237                 break;
       
  1238                 }
       
  1239             case MPXScreenSaverPluginLabelAmPm:
       
  1240                 {
       
  1241                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_DOUBLE_LANDSCAPE;
       
  1242                 label = iAmPmLabel;
       
  1243                 break;
       
  1244                 }
       
  1245             default:
       
  1246                 {
       
  1247                 __ASSERT_ALWAYS(EFalse,
       
  1248                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1249                 break;
       
  1250                 }
       
  1251             }
       
  1252         }
       
  1253     else if ( iScreenSize == TSize( 320, 240 ) ) //QVGA landscape
       
  1254         {
       
  1255         switch (aControl)
       
  1256             {
       
  1257             case MPXScreenSaverPluginLabelTitle:
       
  1258                 {
       
  1259                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QVGA_LANDSCAPE;
       
  1260                 label = iTitleLabel;
       
  1261                 break;
       
  1262                 }
       
  1263             case MPXScreenSaverPluginLabelClock:
       
  1264                 {
       
  1265                 TLanguage uiLanguage = User::Language();
       
  1266                 if( uiLanguage == ELangArabic ||
       
  1267                     uiLanguage == ELangUrdu ||
       
  1268                     uiLanguage == ELangFarsi )
       
  1269                     {
       
  1270                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_LANDSCAPE_ARABIC;
       
  1271                     }
       
  1272                 else
       
  1273                     {
       
  1274                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_LANDSCAPE;
       
  1275                     }
       
  1276 
       
  1277                 label = iClockLabel;
       
  1278                 break;
       
  1279                 }
       
  1280             case MPXScreenSaverPluginLabelAmPm:
       
  1281                 {
       
  1282                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QVGA_LANDSCAPE;
       
  1283                 label = iAmPmLabel;
       
  1284                 break;
       
  1285                 }
       
  1286             default:
       
  1287                 {
       
  1288                 __ASSERT_ALWAYS(EFalse,
       
  1289                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1290                 break;
       
  1291                 }
       
  1292             }
       
  1293         }
       
  1294     else if ( iScreenSize == TSize( 360, 640 ) ) // QHD portrait
       
  1295         {
       
  1296         switch (aControl)
       
  1297             {
       
  1298             case MPXScreenSaverPluginLabelTitle:
       
  1299                 {
       
  1300                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QHD_PORTRAIT;
       
  1301                 label = iTitleLabel;
       
  1302                 break;
       
  1303                 }
       
  1304             case MPXScreenSaverPluginLabelClock:
       
  1305                 {
       
  1306                 TLanguage uiLanguage = User::Language();
       
  1307                 if( uiLanguage == ELangArabic ||
       
  1308                     uiLanguage == ELangUrdu ||
       
  1309                     uiLanguage == ELangFarsi )
       
  1310                     {
       
  1311                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_PORTRAIT_ARABIC;
       
  1312                     }
       
  1313                 else
       
  1314                     {
       
  1315                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_PORTRAIT;
       
  1316                     }
       
  1317 
       
  1318                 label = iClockLabel;
       
  1319                 break;
       
  1320                 }
       
  1321             case MPXScreenSaverPluginLabelAmPm:
       
  1322                 {
       
  1323                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QHD_PORTRAIT;
       
  1324                 label = iAmPmLabel;
       
  1325                 break;
       
  1326                 }
       
  1327             default:
       
  1328                 {
       
  1329                 __ASSERT_ALWAYS(EFalse,
       
  1330                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1331                 break;
       
  1332                 }
       
  1333             }
       
  1334         }
       
  1335     else if ( iScreenSize == TSize( 640, 360 ) ) // QHD landscape
       
  1336         {
       
  1337         switch (aControl)
       
  1338             {
       
  1339             case MPXScreenSaverPluginLabelTitle:
       
  1340                 {
       
  1341                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QHD_LANDSCAPE;
       
  1342                 label = iTitleLabel;
       
  1343                 break;
       
  1344                 }
       
  1345             case MPXScreenSaverPluginLabelClock:
       
  1346                 {
       
  1347                 TLanguage uiLanguage = User::Language();
       
  1348                 if( uiLanguage == ELangArabic ||
       
  1349                     uiLanguage == ELangUrdu ||
       
  1350                     uiLanguage == ELangFarsi )
       
  1351                     {
       
  1352                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_LANDSCAPE_ARABIC;
       
  1353                     }
       
  1354                 else
       
  1355                     {
       
  1356                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_LANDSCAPE;
       
  1357                     }
       
  1358 
       
  1359                 label = iClockLabel;
       
  1360                 break;
       
  1361                 }
       
  1362             case MPXScreenSaverPluginLabelAmPm:
       
  1363                 {
       
  1364                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QHD_LANDSCAPE;
       
  1365                 label = iAmPmLabel;
       
  1366                 break;
       
  1367                 }
       
  1368             default:
       
  1369                 {
       
  1370                 __ASSERT_ALWAYS(EFalse,
       
  1371                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1372                 break;
       
  1373                 }
       
  1374             }
       
  1375         }
       
  1376     else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait
       
  1377         {
       
  1378         switch (aControl)
       
  1379             {
       
  1380             case MPXScreenSaverPluginLabelTitle:
       
  1381                 {
       
  1382                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_VGA_PORTRAIT;
       
  1383                 label = iTitleLabel;
       
  1384                 break;
       
  1385                 }
       
  1386             case MPXScreenSaverPluginLabelClock:
       
  1387                 {
       
  1388                 TLanguage uiLanguage = User::Language();
       
  1389                 if( uiLanguage == ELangArabic ||
       
  1390                     uiLanguage == ELangUrdu ||
       
  1391                     uiLanguage == ELangFarsi )
       
  1392                     {
       
  1393                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_PORTRAIT_ARABIC;
       
  1394                     }
       
  1395                 else
       
  1396                     {
       
  1397                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_PORTRAIT;
       
  1398                     }
       
  1399 
       
  1400                 label = iClockLabel;
       
  1401                 break;
       
  1402                 }
       
  1403             case MPXScreenSaverPluginLabelAmPm:
       
  1404                 {
       
  1405                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_VGA_PORTRAIT;
       
  1406                 label = iAmPmLabel;
       
  1407                 break;
       
  1408                 }
       
  1409             default:
       
  1410                 {
       
  1411                 __ASSERT_ALWAYS(EFalse,
       
  1412                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1413                 break;
       
  1414                 }
       
  1415             }
       
  1416         }
       
  1417     else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape
       
  1418         {
       
  1419         switch (aControl)
       
  1420             {
       
  1421             case MPXScreenSaverPluginLabelTitle:
       
  1422                 {
       
  1423                 resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_VGA_LANDSCAPE;
       
  1424                 label = iTitleLabel;
       
  1425                 break;
       
  1426                 }
       
  1427             case MPXScreenSaverPluginLabelClock:
       
  1428                 {
       
  1429                 TLanguage uiLanguage = User::Language();
       
  1430                 if( uiLanguage == ELangArabic ||
       
  1431                     uiLanguage == ELangUrdu ||
       
  1432                     uiLanguage == ELangFarsi )
       
  1433                     {
       
  1434                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_LANDSCAPE_ARABIC;
       
  1435                     }
       
  1436                 else
       
  1437                     {
       
  1438                     resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_LANDSCAPE;
       
  1439                     }
       
  1440 
       
  1441                 label = iClockLabel;
       
  1442                 break;
       
  1443                 }
       
  1444             case MPXScreenSaverPluginLabelAmPm:
       
  1445                 {
       
  1446                 resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_VGA_LANDSCAPE;
       
  1447                 label = iAmPmLabel;
       
  1448                 break;
       
  1449                 }
       
  1450             default:
       
  1451                 {
       
  1452                 __ASSERT_ALWAYS(EFalse,
       
  1453                     User::Panic( KMXPanicCategory, KErrArgument ) );
       
  1454                 break;
       
  1455                 }
       
  1456             }
       
  1457         }
       
  1458 	else
       
  1459         {
       
  1460         User::Panic( KMXPanicCategory, KErrNotSupported );
       
  1461         }
       
  1462     TResourceReader reader;
       
  1463     CCoeEnv::Static()->CreateResourceReaderLC( reader, resId );
       
  1464 
       
  1465     // Read the layout from resource file
       
  1466     TAknTextComponentLayout textLayout;
       
  1467     textLayout.SetFont( reader.ReadInt16() );
       
  1468     textLayout.SetC( reader.ReadInt16() );
       
  1469     textLayout.Setl( reader.ReadInt16() );
       
  1470     textLayout.Setr( reader.ReadInt16() );
       
  1471     textLayout.Setb( reader.ReadInt16() );
       
  1472     textLayout.SetW( reader.ReadInt16() );
       
  1473     textLayout.SetJ( reader.ReadInt16() );
       
  1474     CleanupStack::PopAndDestroy();  // reader
       
  1475 
       
  1476     AknLayoutUtils::LayoutLabel(
       
  1477         label, TRect( TPoint( 0, 0),
       
  1478         TPoint( iOffScreenBitmap->SizeInPixels().iWidth,
       
  1479         iOffScreenBitmap->SizeInPixels().iHeight) ),
       
  1480         textLayout.LayoutLine() );
       
  1481     }
       
  1482 
       
  1483 // ---------------------------------------------------------------------------
       
  1484 // Get drawable background height.
       
  1485 // ---------------------------------------------------------------------------
       
  1486 //
       
  1487 TInt CMPXScreenSaverPluginContainer::BackgroundHeightL()
       
  1488     {
       
  1489     MPX_FUNC( "CMPXScreenSaverPluginContainer::BackgroundHeightL" );
       
  1490     TInt resId = 0;
       
  1491     if ( iScreenSize == TSize( 176, 208 ) )    //lowest portrait
       
  1492         {
       
  1493         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_LOWRES_PORTRAIT;
       
  1494         }
       
  1495     else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait
       
  1496         {
       
  1497         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_DOUBLE_PORTRAIT;
       
  1498         }
       
  1499     else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait
       
  1500         {
       
  1501         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QVGA_PORTRAIT;
       
  1502         }
       
  1503     else if ( iScreenSize == TSize( 208, 176 ) )    //lowest landscape
       
  1504         {
       
  1505         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_LOWRES_LANDSCAPE;
       
  1506         }
       
  1507     else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape
       
  1508         {
       
  1509         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_DOUBLE_LANDSCAPE;
       
  1510         }
       
  1511     else if ( iScreenSize == TSize( 320,240 ) ) // QVGA landscape
       
  1512         {
       
  1513         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QVGA_LANDSCAPE;
       
  1514         }
       
  1515     else if ( iScreenSize == TSize( 360, 640 ) ) // QHD
       
  1516         {
       
  1517         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_PORTRAIT;
       
  1518         }
       
  1519     else if ( iScreenSize == TSize( 640, 360 ) ) // QHD
       
  1520         {
       
  1521         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_LANDSCAPE;
       
  1522         }
       
  1523     else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait
       
  1524         {
       
  1525         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_PORTRAIT;
       
  1526         }
       
  1527     else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape
       
  1528         {
       
  1529         resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_LANDSCAPE;
       
  1530         }
       
  1531 	else
       
  1532         {
       
  1533         User::Panic( KMXPanicCategory, KErrNotSupported );
       
  1534         }
       
  1535     TResourceReader reader;
       
  1536     CCoeEnv::Static()->CreateResourceReaderLC( reader, resId );
       
  1537     TInt res = reader.ReadInt16();
       
  1538     MPX_DEBUG2( "CMPXScreenSaverPluginContainer::BackgroundHeightL %d", res );
       
  1539     CleanupStack::PopAndDestroy();  // reader
       
  1540     return res;
       
  1541     }
       
  1542 
       
  1543 // ---------------------------------------------------------------------------
       
  1544 // Get draw position and background color index, draw position is stored
       
  1545 // in member variable iStartY
       
  1546 // ---------------------------------------------------------------------------
       
  1547 //
       
  1548 TInt CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL()
       
  1549     {
       
  1550     MPX_FUNC( "CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL" );
       
  1551     TTime time;
       
  1552     time.HomeTime();
       
  1553 
       
  1554     TInt colorIndex = 0;
       
  1555     TInt64 currentTime = time.Int64();
       
  1556     colorIndex = currentTime / 10000000; // not a typo, to get it to the closest 10 seconds
       
  1557     colorIndex = colorIndex % KMPXNumBackgrounds;
       
  1558 
       
  1559     TReal yReal = Math::FRand( currentTime );
       
  1560     TInt randomRangeY = iScreenSize.iHeight - BackgroundHeightL();
       
  1561     iStartY = ( TInt( yReal * randomRangeY ) );
       
  1562 
       
  1563     MPX_DEBUG3( "CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL index = %d, height = %d", colorIndex, iStartY );
       
  1564 
       
  1565     return colorIndex;
       
  1566     }
       
  1567 
       
  1568 // ---------------------------------------------------------------------------
       
  1569 // Resizes all the icons and rects to match current screen size
       
  1570 // ---------------------------------------------------------------------------
       
  1571 //
       
  1572 void CMPXScreenSaverPluginContainer::UpdateLayoutL()
       
  1573     {
       
  1574     MPX_FUNC( "CMPXScreenSaverPluginContainer::UpdateLayoutL" );
       
  1575 
       
  1576     iRectIndicators = IndicatorLayout( MPXScreenSaverPluginIndicatorOther );
       
  1577     AknIconUtils::SetSize( iKeyguardIcon->Bitmap(),
       
  1578         TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
       
  1579         EAspectRatioNotPreserved );
       
  1580     AknIconUtils::SetSize( iMissedCallIcon->Bitmap(),
       
  1581         TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
       
  1582         EAspectRatioNotPreserved );
       
  1583     AknIconUtils::SetSize( iMessageIcon->Bitmap(),
       
  1584         TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
       
  1585         EAspectRatioNotPreserved );
       
  1586     AknIconUtils::SetSize( iNewInstantMessageIcon->Bitmap(),
       
  1587         TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
       
  1588         EAspectRatioNotPreserved );
       
  1589     AknIconUtils::SetSize( iNewVoiceMessageIcon->Bitmap(),
       
  1590         TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
       
  1591         EAspectRatioNotPreserved );
       
  1592     AknIconUtils::SetSize( iNewEmailIcon->Bitmap(),
       
  1593         TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
       
  1594         EAspectRatioNotPreserved );
       
  1595 
       
  1596     iRectPlaybackStatus =
       
  1597         IndicatorLayout( MPXScreenSaverPluginIndicatorPlaybackStatus );
       
  1598     AknIconUtils::SetSize( iPlayIcon->Bitmap(), iRectPlaybackStatus.Size(),
       
  1599         EAspectRatioNotPreserved );
       
  1600     AknIconUtils::SetSize( iPauseIcon->Bitmap(), iRectPlaybackStatus.Size(),
       
  1601         EAspectRatioNotPreserved );
       
  1602 
       
  1603     LabelLayoutL( MPXScreenSaverPluginLabelTitle );
       
  1604     LabelLayoutL( MPXScreenSaverPluginLabelClock );
       
  1605     LabelLayoutL( MPXScreenSaverPluginLabelAmPm );
       
  1606     }
       
  1607 
       
  1608 
       
  1609 // End Of file.
       
  1610