|
1 /* |
|
2 * Copyright (c) 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 which uses a curve path for the child positions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "alf/alfcurvepathlayout.h" |
|
21 #include "alf/alfcontrol.h" |
|
22 #include "alf/alfcurvepath.h" |
|
23 #include "alf/alfgencomponent.h" |
|
24 #include "alflogger.h" |
|
25 #include "alf/alfconstants.h" |
|
26 |
|
27 #include <uiacceltk/HuiUtil.h> |
|
28 |
|
29 struct CAlfCurvePathLayout::TCurvePathLayoutPrivateData |
|
30 { |
|
31 CAlfCurvePath* iCurvePath; // Own |
|
32 }; |
|
33 |
|
34 // ======== MEMBER FUNCTIONS ======== |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // ?description_if_needed |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 EXPORT_C CAlfCurvePathLayout::CAlfCurvePathLayout() |
|
41 : CAlfLayout() |
|
42 { |
|
43 } |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // ?description_if_needed |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C void CAlfCurvePathLayout::ConstructL(CAlfControl& aOwner) |
|
51 { |
|
52 CAlfLayout::ConstructL(aOwner); |
|
53 |
|
54 iCurvePathLayoutData = new (ELeave) TCurvePathLayoutPrivateData; |
|
55 iCurvePathLayoutData->iCurvePath = NULL; |
|
56 } |
|
57 |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // ?description_if_needed |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C CAlfCurvePathLayout* CAlfCurvePathLayout::AddNewL( |
|
64 CAlfControl& aOwnerControl, |
|
65 CAlfLayout* aParentLayout ) |
|
66 { |
|
67 CAlfCurvePathLayout* layout = STATIC_CAST(CAlfCurvePathLayout*, |
|
68 aOwnerControl.AppendLayoutL(EAlfLayoutTypeCurvePath, aParentLayout)); |
|
69 return layout; |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // ?description_if_needed |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C CAlfCurvePathLayout::~CAlfCurvePathLayout() |
|
78 { |
|
79 if ( iCurvePathLayoutData ) |
|
80 { |
|
81 delete iCurvePathLayoutData->iCurvePath; |
|
82 iCurvePathLayoutData->iCurvePath = NULL; |
|
83 } |
|
84 delete iCurvePathLayoutData; |
|
85 iCurvePathLayoutData = NULL; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // ?description_if_needed |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 EXPORT_C CAlfCurvePath& CAlfCurvePathLayout::CurvePath() |
|
93 { |
|
94 // The curve path cannot be contructed in the ConstructL() because |
|
95 // the comms is not allocated yet. |
|
96 if ( !iCurvePathLayoutData->iCurvePath ) |
|
97 { |
|
98 // Create curve path. The curve path uses this subsesison for its |
|
99 // communication with the server side instance. |
|
100 TRAPD( err, iCurvePathLayoutData->iCurvePath = CAlfCurvePath::NewL( Env(), Identifier() ) ); |
|
101 if ( err ) |
|
102 { |
|
103 __ALFLOGSTRING1( "CAlfCurvePathLayout::CurvePath panic error %d", err ) |
|
104 USER_INVARIANT(); |
|
105 } |
|
106 } |
|
107 |
|
108 return *iCurvePathLayoutData->iCurvePath; |
|
109 } |
|
110 |
|
111 EXPORT_C TInt CAlfCurvePathLayout::MappingFunctionIdentifier() const |
|
112 { |
|
113 return Comms()->Identifier(); |
|
114 } |
|
115 |
|
116 EXPORT_C TReal32 CAlfCurvePathLayout::MapValue(TReal32 aValue, TInt aMode) const __SOFTFP |
|
117 { |
|
118 TIntTReal mapValues( aMode, aValue ); |
|
119 TPckgC<TIntTReal> mapValuesPckg( mapValues ); |
|
120 |
|
121 TReal32 returnValue = aValue; |
|
122 TPckg<TReal32> returnBuf(returnValue); |
|
123 |
|
124 TInt err = Comms()->DoSynchronousCmd( |
|
125 EAlfCurvePathLayoutMapValue, |
|
126 mapValuesPckg, |
|
127 returnBuf ); |
|
128 |
|
129 if ( err ) |
|
130 { |
|
131 __ALFLOGSTRING1( "CAlfCurvePathLayout::MapValue panic error %d", err ) |
|
132 USER_INVARIANT(); |
|
133 } |
|
134 |
|
135 return returnValue; |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // Place holder from CAlfVisual |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 EXPORT_C void CAlfCurvePathLayout::RemoveAndDestroyAllD() |
|
143 { |
|
144 CAlfLayout::RemoveAndDestroyAllD(); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // Place holder from CAlfVisual |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 EXPORT_C void CAlfCurvePathLayout::UpdateChildrenLayout(TInt aTransitionTime ) |
|
152 { |
|
153 CAlfLayout::UpdateChildrenLayout( aTransitionTime ); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // Place holder from CAlfVisual |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C CAlfVisual* CAlfCurvePathLayout::FindTag(const TDesC8& aTag) |
|
161 { |
|
162 return CAlfLayout::FindTag( aTag ); |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // Place holder from CAlfVisual |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 EXPORT_C void CAlfCurvePathLayout::DoRemoveAndDestroyAllD() |
|
170 { |
|
171 CAlfLayout::DoRemoveAndDestroyAllD(); |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // Place holder from CAlfLayout |
|
176 // --------------------------------------------------------------------------- |
|
177 // |
|
178 EXPORT_C TAlfXYMetric CAlfCurvePathLayout::BaseUnit() const |
|
179 { |
|
180 return CAlfLayout::BaseUnit(); |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // future proofing |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 EXPORT_C void CAlfCurvePathLayout::PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams) |
|
188 { |
|
189 CAlfLayout::PropertyOwnerExtension(aExtensionUid,aExtensionParams); |
|
190 } |
|
191 |