photosgallery/viewframework/layouts/src/glxlayouthelper.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:    Layout to mapping function adapter class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "glxlayouthelper.h"
       
    22 
       
    23 #include <alf/alfvisual.h>  // CAlfVisual
       
    24 #include <glxlayout.h> // MGlxLayout
       
    25 #include <glxpanic.h> // Panic codes
       
    26 #include <alf/alftimedvalue.h> // for TAlfRealPoint
       
    27 // -----------------------------------------------------------------------------
       
    28 // Constructor
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 EXPORT_C TGlxLayoutHelper::TGlxLayoutHelper( CAlfVisual& aVisual )
       
    32 	: iLayoutInfo( &aVisual ),
       
    33 	iVisual( aVisual ),
       
    34 	iLayout( NULL )
       
    35 	{
       
    36 	// drawing origo is in top left corner of the image
       
    37 	// Alf screen origo is in top left corner so this enables us to use 0,0
       
    38 	// to get a full screen image onto the center of the screen
       
    39 	iVisual.SetOrigin( EAlfVisualHOriginCenter, EAlfVisualVOriginCenter );
       
    40 	}
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // Destructor
       
    44 // -----------------------------------------------------------------------------
       
    45 EXPORT_C TGlxLayoutHelper::~TGlxLayoutHelper()
       
    46     {
       
    47     // nothing to do
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // LayoutVisual
       
    52 // -----------------------------------------------------------------------------
       
    53 EXPORT_C void TGlxLayoutHelper::LayoutVisual( TInt aIndex, TSize aScreenSize )
       
    54 	{
       
    55 	// assert that we have a layout before we do laying out of visual
       
    56 	if( iLayout )
       
    57 		{
       
    58 		// reset the layout info
       
    59 		iLayoutInfo.Reset( aIndex );
       
    60 		iLayoutInfo.SetScreenSize( aScreenSize );
       
    61 		// ask for the layout to update new values
       
    62 		iLayout->SetLayoutValues( iLayoutInfo );
       
    63 		}
       
    64 	}
       
    65 // -----------------------------------------------------------------------------
       
    66 // LayoutVisual
       
    67 // -----------------------------------------------------------------------------
       
    68 EXPORT_C void TGlxLayoutHelper::LayoutPanVisual( TInt aIndex, TSize aScreenSize )
       
    69     {
       
    70     // assert that we have a layout before we do laying out of visual
       
    71     if( iLayout )
       
    72         {
       
    73         // reset the layout info
       
    74         iLayoutInfo.Reset( aIndex );
       
    75         iLayoutInfo.SetScreenSize( aScreenSize );
       
    76         }
       
    77     }
       
    78 // -----------------------------------------------------------------------------
       
    79 // SetLayout
       
    80 // -----------------------------------------------------------------------------
       
    81 EXPORT_C void TGlxLayoutHelper::SetLayout( MGlxLayout* aLayout )
       
    82 	{
       
    83 	iLayout = aLayout;
       
    84 	}
       
    85 // -----------------------------------------------------------------------------
       
    86 // GetUpdatedVisualSize
       
    87 // -----------------------------------------------------------------------------
       
    88 EXPORT_C TSize TGlxLayoutHelper::GetUpdatedVisualSize(  )
       
    89 	{
       
    90 	return iLayoutInfo.iVisualSize ;
       
    91 	}
       
    92 
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // GetUpdatedRectSize
       
    96 // -----------------------------------------------------------------------------
       
    97 EXPORT_C TGlxLayoutInfo& TGlxLayoutHelper::GetUpdatedLayoutInfo(  )
       
    98     {
       
    99     return iLayoutInfo;
       
   100     }
       
   101 //End of File