idlehomescreen/xmluirendering/uiengine/src/xnwallpapercontainer.cpp
changeset 0 f72a12da539e
child 16 9674c1a575e9
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Wallpaper view's container.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "xnwallpapercontainer.h"
       
    22 
       
    23 // SYSTEM INCLUDE FILES
       
    24 #include <aknappui.h>
       
    25 #include <AknsSkinInstance.h>
       
    26 #include <AknUtils.h>
       
    27 #include <AknsUtils.h>
       
    28 #include <AknsDrawUtils.h>
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // C++ default constructor.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CXnWallpaperContainer::CXnWallpaperContainer()
       
    37     {
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // Two-phased constructor.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CXnWallpaperContainer* CXnWallpaperContainer::NewL()
       
    45     {
       
    46     CXnWallpaperContainer* self = new (ELeave) CXnWallpaperContainer();
       
    47     CleanupStack::PushL( self );
       
    48     self->ConstructL();
       
    49     CleanupStack::Pop( self );
       
    50     return self;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // Symbian 2nd phase constructor.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 void CXnWallpaperContainer::ConstructL()
       
    58     {
       
    59     CreateWindowL();
       
    60     TRect rect = iAvkonAppUi->ClientRect();
       
    61     iBgContext = CAknsBasicBackgroundControlContext::NewL(
       
    62             KAknsIIDQsnBgScreen, rect, EFalse );
       
    63     SetRect( rect );
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // Destructor.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CXnWallpaperContainer::~CXnWallpaperContainer()
       
    71     {
       
    72     if ( iBgContext )
       
    73         {
       
    74         delete iBgContext;
       
    75         iBgContext = NULL;
       
    76         }
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CXnWallpaperContainer::Draw
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CXnWallpaperContainer::Draw( const TRect& aRect ) const
       
    84     {
       
    85     CWindowGc& gc = SystemGc();
       
    86      
       
    87     // draw background skin.
       
    88     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
    89     AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect );
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CXnWallpaperContainer::SizeChanged
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CXnWallpaperContainer::SizeChanged()
       
    97     {
       
    98     if ( iBgContext )
       
    99         {
       
   100         iBgContext->SetRect(Rect());
       
   101         TRect rect = Rect();
       
   102         }
       
   103     }
       
   104  
       
   105 // -----------------------------------------------------------------------------
       
   106 // CXnWallpaperContainer::HandleResourceChange
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 void CXnWallpaperContainer::HandleResourceChange(TInt aType)
       
   110     {
       
   111     TRect rect;
       
   112     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   113         {
       
   114         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
       
   115         SetRect(rect);
       
   116         }
       
   117     CCoeControl::HandleResourceChange(aType);
       
   118     }
       
   119 
       
   120 //  End of File