uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCurvePathLayout.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:   Definition for CHuiCurvePathLayout. Combines a layout visual 
       
    15 *                and a curve path. The path is rescaled as the layout's size changes.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __HUICURVEPATHLAYOUT_H__
       
    22 #define __HUICURVEPATHLAYOUT_H__
       
    23 
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <uiacceltk/HuiCurvePath.h>
       
    27 #include <uiacceltk/HuiLayout.h>
       
    28 #include <uiacceltk/HuiTimedValue.h>
       
    29 
       
    30 
       
    31 /* Forward declarations */
       
    32 class CHuiEnv;
       
    33 class CHuiLayout;
       
    34 
       
    35 
       
    36 /**
       
    37  * CHuiCurvePathLayout combines a layout visual and a curve path instance. 
       
    38  * Using a curve path layout it is easy to create a curve path that scales
       
    39  * to the size of the layout.
       
    40  *
       
    41  * The curve path layout itself can be used as a mapping function, because it 
       
    42  * implements the MHuiMappingFunction interface. 
       
    43  
       
    44  * To support legacy applications, if the metrics unit type is EHuiUnitPixel, 
       
    45  * the curve path owned by the layout is scaled to the size of the layout visual.
       
    46  * The path itself should be defined using relative coordinates in the range 0...1000.
       
    47  *
       
    48  * For example, to make the positions of child visuals (or any other visuals)
       
    49  * follow the layout's curve path, call the THuiTimedValue::SetFunction() method
       
    50  * for the position of the visual(s):
       
    51  *
       
    52  * <pre>iChild->Pos().SetFunction(iCurvePathLayout);</pre>
       
    53  */
       
    54 NONSHARABLE_CLASS(CHuiCurvePathLayout): public CHuiLayout, public MHuiMappingFunction
       
    55     {
       
    56 public:
       
    57 
       
    58     /* Constructors and destructor. */
       
    59 
       
    60     /**
       
    61      * Construct a new curve path layout and give its ownership to a control.
       
    62      *
       
    63      * @param aOwnerControl  Owner control.
       
    64      * @param aParentLayout  Parent layout for the new curve path layout.
       
    65      */
       
    66     IMPORT_C static CHuiCurvePathLayout* AddNewL(CHuiControl& aOwnerControl, 
       
    67                                                  CHuiLayout* aParentLayout = 0);
       
    68 
       
    69     /**
       
    70      * Constructor.
       
    71      *
       
    72      * @param aOwner  Owner control.
       
    73      */
       
    74     CHuiCurvePathLayout(MHuiVisualOwner& aOwner);
       
    75 
       
    76     /**
       
    77      * Second-phase constructor.
       
    78      */
       
    79     void ConstructL();
       
    80 
       
    81     /**
       
    82      * Destructor.
       
    83      */
       
    84     ~CHuiCurvePathLayout();
       
    85 
       
    86 
       
    87     /* Methods. */
       
    88 
       
    89     /**
       
    90      * Returns the curve path instance of the layout.
       
    91      *
       
    92      * @return Curve path.
       
    93      */
       
    94     IMPORT_C CHuiCurvePath& CurvePath();
       
    95     
       
    96     /**
       
    97      * Overridden version of size changing updates the layout of child visuals.
       
    98      *
       
    99      * @param aSize  New size for the layout.
       
   100      * @param aTransitionTime  Time for the transition to new size to take 
       
   101      *               place.
       
   102      */
       
   103     void SetSize(const THuiRealSize& aSize, TInt aTransitionTime=0);
       
   104     
       
   105     TBool ChildSize(TInt aOrdinal, TSize& aSize);
       
   106     
       
   107     TBool ChildPos(TInt aOrdinal, TPoint& aPos);
       
   108 
       
   109     TInt ChildRect(TInt aOrdinal, THuiRealRect& aRect);
       
   110     
       
   111     void GetClassName(TDes& aName) const
       
   112         {
       
   113         aName = _L("CHuiCurvePathLayout");
       
   114         }
       
   115     
       
   116     
       
   117     /* Mapping function impl. */
       
   118     
       
   119     TReal32 MapValue(TReal32 aValue, TInt aMode) const __SOFTFP;
       
   120     
       
   121     TBool MappingFunctionChanged() const;
       
   122     
       
   123     void MappingFunctionClearChanged();
       
   124     
       
   125 private:    
       
   126 
       
   127     /* Private types. */
       
   128     
       
   129 
       
   130 private:
       
   131 
       
   132     CHuiCurvePath* iPath;
       
   133     
       
   134     };
       
   135 
       
   136 
       
   137 #endif  // __HUICURVEPATHLAYOUT_H__