|
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: Curve path layout definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_ALFCURVEPATHLAYOUT_H |
|
21 #define C_ALFCURVEPATHLAYOUT_H |
|
22 |
|
23 #include <alf/alflayout.h> |
|
24 #include <alf/alfmappingfunctions.h> |
|
25 |
|
26 class CAlfCurvePath; |
|
27 |
|
28 /** |
|
29 * Curve path layout can be used to control size and position properties of |
|
30 * a visual using a curve path object. |
|
31 * @see CAlfCurvePath |
|
32 * |
|
33 * When using a curve path layout the user has to specify which properties of |
|
34 * a visual should be controlled by the layout. By default the curve path layout |
|
35 * does not affect any properties of its child visuals. Mapping function identifier |
|
36 * retrieved through CAlfCurvePathLayout::MappingFunctionIdentifier() - method |
|
37 * can be used to bind the curve path layout to properties of a visual. |
|
38 * |
|
39 * The curve path layout contains a curve path instance that can be used to |
|
40 * customize the path that is used to layout the properties of a visual. Reference |
|
41 * to the curve path can be acquired through the CAlfCurvePathLayout::CurvePath() - method. |
|
42 * |
|
43 * The following code example creates a curve path layout, sets its base unit to normalized (0.0 - 1.0) |
|
44 * units, defines a curve path, binds the curve path layouting to image visual's position |
|
45 * property and animates the position of the image visual on the curve path from start point of the curve path (0.0) |
|
46 * to end point of the curve path (2.0) within 3 seconds. Notice that the curve path layout does not |
|
47 * adjust the size of the image visual and because of that the image visual size is explicitly set to (0.25, 0.25). |
|
48 * The size of the image visual is defined in base units of it's parent layout. |
|
49 * |
|
50 * @code |
|
51 * // Create a curve path layout |
|
52 * CAlfCurvePathLayout* layout = CAlfCurvePathLayout::AddNewL(*this); |
|
53 * layout->SetBaseUnit(TAlfMetric(1.0, EAlfUnitNormalized)); |
|
54 * |
|
55 * // Define a curve path |
|
56 * CAlfCurvePath& curvePath = layout->CurvePath(); |
|
57 * curvePath.AppendArcL(TAlfRealPoint(0.5, 0.5), TAlfRealSize(0.5, 0.5), 180.0, 360.0, 2.0); |
|
58 * |
|
59 * // Create an image visual |
|
60 * CAlfImageVisual* imageVisual = CAlfImageVisual::AddNewL(*this, layout); |
|
61 * imageVisual->SetSize(TAlfRealSize(0.25, 0.25)); |
|
62 * CAlfTextureManager& defaultTexture = aEnv.TextureManager( ); |
|
63 * CAlfTexture& texture = defaultTexture.LoadTextureL(_L("album4.jpg"),EAlfTextureFlagDefault,KAlfAutoGeneratedTextureId); |
|
64 * imageVisual->SetImage(TAlfImage(texture)); |
|
65 * |
|
66 * // Control the position of the image visual with the curve path |
|
67 * TAlfTimedPoint pos; |
|
68 * pos.SetMappingFunctionIdentifier(layout->MappingFunctionIdentifier()); |
|
69 * pos.SetTarget(2.0, 3000); |
|
70 * imageVisual->SetPos(pos); |
|
71 * @endcode |
|
72 * |
|
73 * @lib alfclient.lib |
|
74 * @since S60 v3.2 |
|
75 */ |
|
76 class CAlfCurvePathLayout : public CAlfLayout, public MAlfMappingFunction |
|
77 { |
|
78 |
|
79 public: |
|
80 |
|
81 IMPORT_C static CAlfCurvePathLayout* AddNewL( |
|
82 CAlfControl& aOwnerControl, |
|
83 CAlfLayout* aParentLayout = 0); |
|
84 |
|
85 /** |
|
86 * Constructor. |
|
87 * |
|
88 * @param aOwner Owner control. |
|
89 */ |
|
90 IMPORT_C CAlfCurvePathLayout(); |
|
91 |
|
92 /** |
|
93 * From CAlfLayout. Second-phase constructor. |
|
94 */ |
|
95 IMPORT_C void ConstructL(CAlfControl& aOwner); |
|
96 |
|
97 /** |
|
98 * Virtual destructor. |
|
99 */ |
|
100 IMPORT_C ~CAlfCurvePathLayout(); |
|
101 |
|
102 /** |
|
103 * Returns the curve path instance of the layout. The returned instance |
|
104 * can be used to modify the curve path that is used to control the properties |
|
105 * of a layed out visual. The curve path instance is defined in the base units |
|
106 * used by this layout. |
|
107 * @see CAlfCurvePathLayout::BaseUnit() |
|
108 * @see CAlfCurvePathLayout::SetBaseUnit() |
|
109 * |
|
110 * @return Curve path. This instance cannot be passed |
|
111 * as general mapping function to other instances. |
|
112 */ |
|
113 IMPORT_C CAlfCurvePath& CurvePath(); |
|
114 |
|
115 /** |
|
116 * From CAlfVisual |
|
117 * @see CAlfVisual |
|
118 */ |
|
119 IMPORT_C void RemoveAndDestroyAllD(); |
|
120 IMPORT_C void UpdateChildrenLayout(TInt aTransitionTime = 0); |
|
121 IMPORT_C CAlfVisual* FindTag(const TDesC8& aTag); |
|
122 |
|
123 /** |
|
124 * From CAlfLayout |
|
125 * @see CAlfLayout |
|
126 */ |
|
127 IMPORT_C TAlfXYMetric BaseUnit() const; |
|
128 |
|
129 /** |
|
130 * From MAlfMappingFunction |
|
131 * @see MAlfMappingFunction |
|
132 */ |
|
133 IMPORT_C TInt MappingFunctionIdentifier() const; |
|
134 IMPORT_C TReal32 MapValue(TReal32 aValue, TInt aMode) const __SOFTFP; |
|
135 |
|
136 |
|
137 protected: |
|
138 /** |
|
139 * From CAlfVisual |
|
140 * @see CAlfVisual |
|
141 */ |
|
142 IMPORT_C void DoRemoveAndDestroyAllD(); |
|
143 IMPORT_C void PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
144 |
|
145 |
|
146 private: // data |
|
147 |
|
148 struct TCurvePathLayoutPrivateData; |
|
149 TCurvePathLayoutPrivateData* iCurvePathLayoutData; |
|
150 |
|
151 }; |
|
152 |
|
153 |
|
154 #endif // C_ALFCURVEPATHLAYOUT_H |