photosgallery/viewframework/layouts/src/glxrotationlayout.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:    Temporary rotation layout
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "glxrotationlayout.h" 
       
    22 
       
    23 #include <alf/alfvisual.h>
       
    24 #include <alf/alftimedvalue.h>
       
    25 #include <alf/alftransformation.h>
       
    26 // -----------------------------------------------------------------------------
       
    27 // Constructor
       
    28 // -----------------------------------------------------------------------------
       
    29 EXPORT_C TGlxRotationLayout::TGlxRotationLayout()
       
    30     : iRotation( KGlxRotationNone )
       
    31     {
       
    32     }
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // Destructor
       
    36 // -----------------------------------------------------------------------------
       
    37 EXPORT_C TGlxRotationLayout::~TGlxRotationLayout() 
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // SetVisualListL
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C void TGlxRotationLayout::SetRotation(TReal32 aRotation,
       
    46                                                 TInt aTransitionTime)
       
    47     {
       
    48     // just remember the values
       
    49     iRotation = aRotation;
       
    50     iTransitionTime = aTransitionTime;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // DoSetLayoutValues
       
    55 // -----------------------------------------------------------------------------
       
    56 void TGlxRotationLayout::DoSetLayoutValues(TGlxLayoutInfo& aInfo)
       
    57     {
       
    58     // get the visual
       
    59     CAlfVisual& visual = aInfo.Visual();
       
    60     TAlfTimedValue value( iRotation, iTransitionTime );
       
    61     
       
    62 	// Update the transformation for the rotation
       
    63     CAlfTransformation& tranformation = visual.Transformation();
       
    64     tranformation.LoadIdentity();
       
    65     // rotate the visual
       
    66     tranformation.Rotate( value );
       
    67     }