|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "aknlayout2hierarchydef.h" |
|
20 #include "aknlayout2hierarchy.h" |
|
21 |
|
22 #include <aknlayoutscalable_avkon.cdl.h> |
|
23 #include <aknlayoutscalable_apps.cdl.h> |
|
24 #include <layoutmetadata.cdl.h> |
|
25 |
|
26 #include <CdlEngine.h> |
|
27 |
|
28 |
|
29 #define AKNLAYOUT_DEFINE_BYTECODE(name,byte) const TUint8 name = byte; |
|
30 #include "AknLayoutByteCodes.h" |
|
31 |
|
32 |
|
33 #ifndef EKA2 |
|
34 GLDEF_C TInt E32Dll(TDllReason) |
|
35 { |
|
36 return KErrNone; |
|
37 } |
|
38 #endif |
|
39 |
|
40 |
|
41 // |
|
42 // class TAknLayoutHierarchyComponentHandle |
|
43 // |
|
44 |
|
45 TAknLayoutHierarchyComponentHandle::TPrivateData_AknLayout2::TPrivateData_AknLayout2( |
|
46 TInt aApiId, |
|
47 TInt aComponentId, |
|
48 TInt aOptionIndex, |
|
49 TInt aDrawingOrderIndex, |
|
50 TInt aVarietyIndex, |
|
51 TInt aColumn, |
|
52 TInt aRow) |
|
53 : |
|
54 iApiId(aApiId), |
|
55 iComponentId(aComponentId), |
|
56 iOptionIndex(aOptionIndex), |
|
57 iDrawingOrderIndex(aDrawingOrderIndex), |
|
58 iVarietyIndex(aVarietyIndex), |
|
59 iColumn(aColumn), |
|
60 iRow(aRow) |
|
61 { |
|
62 } |
|
63 |
|
64 |
|
65 EXPORT_C TAknLayoutHierarchyComponentHandle::TAknLayoutHierarchyComponentHandle() |
|
66 : |
|
67 iLayoutSystemId(0), |
|
68 iData(0, 0, 0, 0, 0, 0, 0) |
|
69 { |
|
70 } |
|
71 |
|
72 EXPORT_C TAknLayoutHierarchyComponentHandle::TAknLayoutHierarchyComponentHandle(TInt aLayoutSystemId, TInt aApiId, TInt aComponentId) |
|
73 : |
|
74 iLayoutSystemId(aLayoutSystemId), |
|
75 iData(aApiId, aComponentId, 0, 0, 0, 0, 0) |
|
76 { |
|
77 } |
|
78 |
|
79 EXPORT_C TInt TAknLayoutHierarchyComponentHandle::LayoutSystemId() const |
|
80 { |
|
81 return iLayoutSystemId; |
|
82 } |
|
83 |
|
84 EXPORT_C TInt TAknLayoutHierarchyComponentHandle::ApiId() const |
|
85 { |
|
86 return iData.iApiId; |
|
87 } |
|
88 |
|
89 EXPORT_C TInt TAknLayoutHierarchyComponentHandle::ComponentId() const |
|
90 { |
|
91 return iData.iComponentId; |
|
92 } |
|
93 |
|
94 EXPORT_C TInt TAknLayoutHierarchyComponentHandle::OptionIndex() const |
|
95 { |
|
96 return iData.iOptionIndex; |
|
97 } |
|
98 |
|
99 EXPORT_C TInt TAknLayoutHierarchyComponentHandle::VarietyIndex() const |
|
100 { |
|
101 return iData.iVarietyIndex; |
|
102 } |
|
103 |
|
104 EXPORT_C TInt TAknLayoutHierarchyComponentHandle::Column() const |
|
105 { |
|
106 return iData.iColumn; |
|
107 } |
|
108 |
|
109 EXPORT_C TInt TAknLayoutHierarchyComponentHandle::Row() const |
|
110 { |
|
111 return iData.iRow; |
|
112 } |
|
113 |
|
114 EXPORT_C void TAknLayoutHierarchyComponentHandle::SetLayoutSystemId(TInt aLayoutSystemId) |
|
115 { |
|
116 iLayoutSystemId = aLayoutSystemId; |
|
117 } |
|
118 |
|
119 EXPORT_C void TAknLayoutHierarchyComponentHandle::SetApiId(TInt aApiId) |
|
120 { |
|
121 iData.iApiId = aApiId; |
|
122 } |
|
123 |
|
124 EXPORT_C void TAknLayoutHierarchyComponentHandle::SetComponentId(TInt aComponentId) |
|
125 { |
|
126 iData.iComponentId = aComponentId; |
|
127 } |
|
128 |
|
129 EXPORT_C void TAknLayoutHierarchyComponentHandle::SetOptionIndex(TInt aOptionIndex) |
|
130 { |
|
131 iData.iOptionIndex = aOptionIndex; |
|
132 } |
|
133 |
|
134 EXPORT_C void TAknLayoutHierarchyComponentHandle::SetVarietyIndex(TInt aVarietyIndex) |
|
135 { |
|
136 iData.iVarietyIndex = aVarietyIndex; |
|
137 } |
|
138 |
|
139 EXPORT_C void TAknLayoutHierarchyComponentHandle::SetColumn(TInt aColumn) |
|
140 { |
|
141 iData.iColumn = aColumn; |
|
142 } |
|
143 |
|
144 EXPORT_C void TAknLayoutHierarchyComponentHandle::SetRow(TInt aRow) |
|
145 { |
|
146 iData.iRow = aRow; |
|
147 } |
|
148 |
|
149 // |
|
150 // class AknLayout2Hierarchy |
|
151 // |
|
152 |
|
153 EXPORT_C TAknLayoutScalableComponentType AknLayout2Hierarchy::GetComponentType(const TAknLayoutHierarchyComponentHandle& aComponentHandle) |
|
154 { |
|
155 TAknLayoutScalableComponentType type(EAknLayoutScalableComponentTypeUnknown); |
|
156 |
|
157 TInt apiId = aComponentHandle.ApiId(); |
|
158 TInt compId = aComponentHandle.ComponentId(); |
|
159 |
|
160 TInt specialCompId(-1); |
|
161 switch(apiId) |
|
162 { |
|
163 case AknLayoutScalable_Avkon::KCdlInterfaceUidValue: |
|
164 { |
|
165 specialCompId = AknLayoutScalable_Avkon::EApiId_GetComponentTypeById; |
|
166 break; |
|
167 } |
|
168 case AknLayoutScalable_Apps::KCdlInterfaceUidValue: |
|
169 { |
|
170 specialCompId = AknLayoutScalable_Apps::EApiId_GetComponentTypeById; |
|
171 break; |
|
172 } |
|
173 default: |
|
174 { |
|
175 // and we know it's at ordinal 0 because that's what the layout compiler now does for all new layout interfaces. |
|
176 specialCompId = 0; |
|
177 break; |
|
178 } |
|
179 } |
|
180 |
|
181 // first of all we find the instance that implements the desired api |
|
182 const CCdlInstance* implementor = CdlEngine::Implementor(TUid::Uid(apiId), compId); |
|
183 |
|
184 // then we call the special function belonging to that instance |
|
185 // the cast is a cheat by using the apps namespace, as we know that the sig will be the same for all other layout interfaces |
|
186 type = (*(AknLayoutScalable_Apps::TGetComponentTypeById_sig*)(implementor->GetFunction(specialCompId)))(compId); |
|
187 |
|
188 return type; |
|
189 } |
|
190 |
|
191 EXPORT_C TAknLayoutScalableParameterLimits AknLayout2Hierarchy::GetParamLimits(const TAknLayoutHierarchyComponentHandle& aComponentHandle) |
|
192 { |
|
193 TAknLayoutScalableParameterLimits limits; |
|
194 |
|
195 TInt apiId = aComponentHandle.ApiId(); |
|
196 TInt compId = aComponentHandle.ComponentId(); |
|
197 TInt varietyId = aComponentHandle.VarietyIndex(); |
|
198 |
|
199 TInt specialCompId(-1); |
|
200 switch(apiId) |
|
201 { |
|
202 case AknLayoutScalable_Avkon::KCdlInterfaceUidValue: |
|
203 { |
|
204 specialCompId = AknLayoutScalable_Avkon::EApiId_GetParamLimitsById; |
|
205 break; |
|
206 } |
|
207 case AknLayoutScalable_Apps::KCdlInterfaceUidValue: |
|
208 { |
|
209 specialCompId = AknLayoutScalable_Apps::EApiId_GetParamLimitsById; |
|
210 break; |
|
211 } |
|
212 default: |
|
213 { |
|
214 // and we know it's at ordinal 1 because that's what the layout compiler now does for all new layout interfaces. |
|
215 specialCompId = 1; |
|
216 break; |
|
217 } |
|
218 } |
|
219 |
|
220 // first of all we find the instance that implements the desired api |
|
221 const CCdlInstance* implementor = CdlEngine::Implementor(TUid::Uid(apiId), compId); |
|
222 |
|
223 // then we call the special function belonging to that instance |
|
224 // the cast is a cheat by using the apps namespace, as we know that the sig will be the same for all other layout interfaces |
|
225 limits = (*(AknLayoutScalable_Apps::TGetParamLimitsById_sig*)(implementor->GetFunction(specialCompId)))(compId, varietyId); |
|
226 |
|
227 return limits; |
|
228 } |
|
229 |
|
230 EXPORT_C TAknWindowComponentLayout AknLayout2Hierarchy::GetWindowComponentLayout(const TAknLayoutHierarchyComponentHandle& aComponentHandle) |
|
231 { |
|
232 TAknWindowComponentLayout layoutW; |
|
233 |
|
234 TInt apiId = aComponentHandle.ApiId(); |
|
235 TInt compId = aComponentHandle.ComponentId(); |
|
236 TInt varietyId = aComponentHandle.VarietyIndex(); |
|
237 TInt column = aComponentHandle.Column(); |
|
238 TInt row = aComponentHandle.Row(); |
|
239 |
|
240 TInt specialCompId(-1); |
|
241 switch(apiId) |
|
242 { |
|
243 case AknLayoutScalable_Avkon::KCdlInterfaceUidValue: |
|
244 { |
|
245 specialCompId = AknLayoutScalable_Avkon::EApiId_GetWindowComponentById; |
|
246 break; |
|
247 } |
|
248 case AknLayoutScalable_Apps::KCdlInterfaceUidValue: |
|
249 { |
|
250 specialCompId = AknLayoutScalable_Apps::EApiId_GetWindowComponentById; |
|
251 break; |
|
252 } |
|
253 default: |
|
254 { |
|
255 // and we know it's at ordinal 2 because that's what the layout compiler now does for all new layout interfaces. |
|
256 specialCompId = 2; |
|
257 break; |
|
258 } |
|
259 } |
|
260 |
|
261 // first of all we find the instance that implements the desired api |
|
262 const CCdlInstance* implementor = CdlEngine::Implementor(TUid::Uid(apiId), compId); |
|
263 |
|
264 // then we call the special function belonging to that instance |
|
265 // the cast is a cheat by using the apps namespace, as we know that the sig will be the same for all other layout interfaces |
|
266 layoutW = (*(AknLayoutScalable_Apps::TGetWindowComponentById_sig*)(implementor->GetFunction(specialCompId)))(compId, varietyId, column, row); |
|
267 |
|
268 return layoutW; |
|
269 } |
|
270 |
|
271 EXPORT_C TAknTextComponentLayout AknLayout2Hierarchy::GetTextComponentLayout(const TAknLayoutHierarchyComponentHandle& aComponentHandle) |
|
272 { |
|
273 TAknTextComponentLayout layoutT; |
|
274 |
|
275 TInt apiId = aComponentHandle.ApiId(); |
|
276 TInt compId = aComponentHandle.ComponentId(); |
|
277 TInt varietyId = aComponentHandle.VarietyIndex(); |
|
278 TInt column = aComponentHandle.Column(); |
|
279 TInt row = aComponentHandle.Row(); |
|
280 |
|
281 TInt specialCompId(-1); |
|
282 switch(apiId) |
|
283 { |
|
284 case AknLayoutScalable_Avkon::KCdlInterfaceUidValue: |
|
285 { |
|
286 specialCompId = AknLayoutScalable_Avkon::EApiId_GetTextComponentById; |
|
287 break; |
|
288 } |
|
289 case AknLayoutScalable_Apps::KCdlInterfaceUidValue: |
|
290 { |
|
291 specialCompId = AknLayoutScalable_Apps::EApiId_GetTextComponentById; |
|
292 break; |
|
293 } |
|
294 default: |
|
295 { |
|
296 // cheat by using the apps namespace, as we know that the sig is the same, |
|
297 // and we know it's at ordinal 3 because that's what the layout compiler now does for all new layout interfaces. |
|
298 specialCompId = 3; |
|
299 break; |
|
300 } |
|
301 } |
|
302 |
|
303 // first of all we find the instance that implements the desired api |
|
304 const CCdlInstance* implementor = CdlEngine::Implementor(TUid::Uid(apiId), compId); |
|
305 |
|
306 // then we call the special function belonging to that instance |
|
307 // the cast is a cheat by using the apps namespace, as we know that the sig will be the same for all other layout interfaces |
|
308 layoutT = (*(AknLayoutScalable_Apps::TGetTextComponentById_sig*)(implementor->GetFunction(specialCompId)))(compId, varietyId, column, row); |
|
309 |
|
310 return layoutT; |
|
311 } |
|
312 |
|
313 // end of file |