photosgallery/viewframework/uiutilities/src/glxuiutilityCoeControl.cpp
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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 the CGlxUiUtilityCoeControl class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "glxuiutilitycoecontrol.h"  // Class definition
       
    22 
       
    23 #include <uiacceltk/huidisplay.h>
       
    24 #include <uiacceltk/huievent.h>
       
    25 #include <uiacceltk/huiskin.h>
       
    26 
       
    27 //-----------------------------------------------------------------------------
       
    28 // NewL
       
    29 //-----------------------------------------------------------------------------
       
    30 CGlxUiUtilityCoeControl* CGlxUiUtilityCoeControl::NewL(
       
    31 	CHuiEnv& aEnv, AknLayoutUtils::TAknLayoutMetrics aArea, TInt aFlags )
       
    32     {
       
    33     CGlxUiUtilityCoeControl* self = 
       
    34     	new (ELeave) CGlxUiUtilityCoeControl( aEnv );
       
    35     CleanupStack::PushL( self );
       
    36     // 2nd phase
       
    37     self->ConstructL( aArea, aFlags );
       
    38     CleanupStack::Pop( self );
       
    39     return self;
       
    40     }
       
    41 
       
    42 //-----------------------------------------------------------------------------
       
    43 // Destructor
       
    44 //-----------------------------------------------------------------------------
       
    45 CGlxUiUtilityCoeControl::~CGlxUiUtilityCoeControl()
       
    46     {
       
    47     }
       
    48 
       
    49 //-----------------------------------------------------------------------------
       
    50 // SetArea
       
    51 //-----------------------------------------------------------------------------
       
    52 TRect CGlxUiUtilityCoeControl::SetArea( 
       
    53 	AknLayoutUtils::TAknLayoutMetrics aArea )
       
    54 	{
       
    55 	TRect rect;
       
    56     // remember the area name for the orientation changes
       
    57     iArea = aArea;
       
    58     // ask for the rect of the named area now
       
    59     AknLayoutUtils::LayoutMetricsRect( iArea, rect ); 
       
    60 	// set the new rect
       
    61     SetRect( rect ); 
       
    62     // return the rect
       
    63     return rect;
       
    64 	}
       
    65 
       
    66 //-----------------------------------------------------------------------------
       
    67 // C++ Constructor
       
    68 //-----------------------------------------------------------------------------
       
    69 CGlxUiUtilityCoeControl::CGlxUiUtilityCoeControl( CHuiEnv& aEnv )
       
    70 	: CHuiDisplayCoeControl( aEnv )
       
    71     {
       
    72     }
       
    73 
       
    74 //-----------------------------------------------------------------------------
       
    75 // ConstructL
       
    76 //-----------------------------------------------------------------------------
       
    77 void CGlxUiUtilityCoeControl::ConstructL(
       
    78 	AknLayoutUtils::TAknLayoutMetrics aArea, TInt aFlags )
       
    79     {
       
    80     // set the area, as a side product we get the rect
       
    81     TRect rect = SetArea( aArea );
       
    82 	// and construct the display with rect and flags
       
    83     CHuiDisplayCoeControl::ConstructL( rect, aFlags );
       
    84     iAppUi = CCoeEnv::Static()->AppUi();
       
    85     }
       
    86 
       
    87 //-----------------------------------------------------------------------------
       
    88 // HandleResourceChange
       
    89 //-----------------------------------------------------------------------------
       
    90 void CGlxUiUtilityCoeControl::HandleResourceChange( TInt aType )
       
    91     {
       
    92     // Call base class method
       
    93     CCoeControl::HandleResourceChange(aType);
       
    94     
       
    95 	// Was it orientation change
       
    96    	if( KEikDynamicLayoutVariantSwitch == aType )
       
    97         {
       
    98         // re-set the area, it sets the rect
       
    99         SetArea( iArea );
       
   100 		// Notify skin to change size
       
   101 		TRAP_IGNORE( Env().Skin().NotifyDisplaySizeChangedL() ); 
       
   102         }
       
   103     }