|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <AknUtils.h> |
|
19 #include <uiacceltk/HuiStatic.h> |
|
20 |
|
21 #include "huiskinbackroundlayout.h" |
|
22 |
|
23 static inline void GetScalableViaPane( TRect& aRect, const TRect& aParentRect, |
|
24 const TAknWindowComponentLayout& aIntermediateLayout, |
|
25 const TAknWindowComponentLayout& aFinalLayout ) |
|
26 { |
|
27 TAknLayoutRect layout; |
|
28 layout.LayoutRect( aParentRect, |
|
29 TAknWindowComponentLayout::Compose( |
|
30 aIntermediateLayout, aFinalLayout).LayoutLine() ); |
|
31 aRect = layout.Rect(); |
|
32 } |
|
33 |
|
34 |
|
35 TAknsItemID GetParent( const TAknsItemID& aIID ) |
|
36 { |
|
37 if( aIID.iMajor == EAknsMajorSkin ) |
|
38 { |
|
39 switch( aIID.iMinor ) |
|
40 { |
|
41 case EAknsMinorQsnBgScreen: |
|
42 return KAknsIIDNone; |
|
43 |
|
44 case EAknsMinorQsnBgScreenIdle: |
|
45 case EAknsMinorQsnBgScreenMp: |
|
46 return KAknsIIDQsnBgScreen; |
|
47 case EAknsMinorQsnBgAreaMain: |
|
48 case EAknsMinorQsnBgAreaMainAppsGrid: |
|
49 case EAknsMinorQsnBgAreaMainListGene: |
|
50 case EAknsMinorQsnBgAreaMainListSet: |
|
51 case EAknsMinorQsnBgAreaMainMessage: |
|
52 return KAknsIIDQsnBgScreen; |
|
53 |
|
54 case EAknsMinorQsnBgAreaMainHigh: |
|
55 case EAknsMinorQsnBgAreaMainCalc: |
|
56 case EAknsMinorQsnBgAreaMainPinb: |
|
57 case EAknsMinorQsnBgAreaMainQdial: |
|
58 return KAknsIIDQsnBgScreen; |
|
59 |
|
60 case EAknsMinorQsnBgAreaMainMp: |
|
61 return KAknsIIDQsnBgScreenMp; |
|
62 |
|
63 case EAknsMinorQsnBgAreaMainFlat: |
|
64 case EAknsMinorQsnBgAreaMainSmall: |
|
65 return KAknsIIDQsnBgScreen; |
|
66 #ifdef RD_FULLSCREEN_WALLPAPER |
|
67 case EAknsMinorWallpaper: |
|
68 return KAknsIIDQsnBgScreenIdle; |
|
69 #else |
|
70 case EAknsMinorWallpaper: |
|
71 return KAknsIIDQsnBgAreaMainIdle; |
|
72 #endif //RD_FULLSCREEN_WALLPAPER |
|
73 |
|
74 case EAknsMinorQsnBgAreaMainIdle: |
|
75 case EAknsMinorQsnBgAreaMainIdleDimmed: |
|
76 #ifdef RD_FULLSCREEN_WALLPAPER |
|
77 return KAknsIIDWallpaper; |
|
78 #else |
|
79 return KAknsIIDQsnBgScreenIdle; |
|
80 #endif // RD_FULLSCREEN_WALLPAPER |
|
81 |
|
82 case EAknsMinorQsnBgAreaStatus: |
|
83 return KAknsIIDQsnBgScreen; |
|
84 |
|
85 case EAknsMinorQsnBgAreaStatusIdle: |
|
86 return KAknsIIDQsnBgScreenIdle; |
|
87 |
|
88 case EAknsMinorQsnBgAreaStaconRt: |
|
89 case EAknsMinorQsnBgAreaStaconLt: |
|
90 case EAknsMinorQsnBgAreaStaconRb: |
|
91 case EAknsMinorQsnBgAreaStaconLb: |
|
92 return KAknsIIDQsnBgScreen; |
|
93 |
|
94 case EAknsMinorQsnBgAreaStaconRtIdle: |
|
95 case EAknsMinorQsnBgAreaStaconLtIdle: |
|
96 case EAknsMinorQsnBgAreaStaconRbIdle: |
|
97 case EAknsMinorQsnBgAreaStaconLbIdle: |
|
98 return KAknsIIDQsnBgScreenIdle; |
|
99 |
|
100 case EAknsMinorQsnBgAreaControl: |
|
101 case EAknsMinorQsnBgAreaControlPopup: |
|
102 return KAknsIIDQsnBgScreen; |
|
103 |
|
104 case EAknsMinorQsnBgAreaControlMp: |
|
105 return KAknsIIDQsnBgScreenMp; |
|
106 |
|
107 case EAknsMinorQsnBgAreaControlIdle: |
|
108 return KAknsIIDQsnBgScreenIdle; |
|
109 |
|
110 case EAknsMinorQsnBgColumn0: |
|
111 case EAknsMinorQsnBgColumnA: |
|
112 case EAknsMinorQsnBgColumnAB: |
|
113 case EAknsMinorQsnBgColumnC0: |
|
114 case EAknsMinorQsnBgColumnCA: |
|
115 case EAknsMinorQsnBgColumnCAB: |
|
116 return KAknsIIDQsnBgAreaMainListGene; |
|
117 |
|
118 case EAknsMinorQsnBgSliceList0: |
|
119 case EAknsMinorQsnBgSliceListA: |
|
120 case EAknsMinorQsnBgSliceListAB: |
|
121 return KAknsIIDQsnBgAreaMainListGene; |
|
122 |
|
123 // INSERTION POINT for layout parent relations |
|
124 } |
|
125 } |
|
126 else if( aIID.iMajor == EAknsMajorAvkon ) |
|
127 { |
|
128 switch( aIID.iMinor ) |
|
129 { |
|
130 case EAknsMinorQsnBgNavipaneSolid: |
|
131 case EAknsMinorQsnBgNavipaneWipe: |
|
132 return KAknsIIDQsnBgAreaStatus; |
|
133 |
|
134 case EAknsMinorQsnBgNavipaneSolidIdle: |
|
135 case EAknsMinorQsnBgNavipaneWipeIdle: |
|
136 return KAknsIIDQsnBgAreaStatusIdle; |
|
137 } |
|
138 } |
|
139 |
|
140 return KAknsIIDDefault; |
|
141 } |
|
142 |
|
143 TBool GetItemLayout( const TAknsItemID& aIID, |
|
144 const TRect& aParentRect, TRect& aRect ) |
|
145 { |
|
146 if (!CCoeEnv::Static()) |
|
147 { //ToDO |
|
148 aRect = aParentRect; |
|
149 return ETrue; |
|
150 } |
|
151 //--------------------------------------- |
|
152 const AknLayoutScalable_Avkon::CInstance& iAknLayoutScalable_Avkon = AknLayoutScalable_Avkon::CustomisationInstance(); |
|
153 TAknWindowLineLayout screenLayout = AknLayout::screen(); |
|
154 TRect iScreenRect = screenLayout.Rect(); |
|
155 //--------------------------------------- |
|
156 TRect normParentRect( TPoint(0,0), aParentRect.Size() ); |
|
157 |
|
158 |
|
159 TAknLayoutRect layRect; |
|
160 |
|
161 if( aIID.iMajor == EAknsMajorSkin ) { |
|
162 switch( aIID.iMinor ) |
|
163 { |
|
164 case EAknsMinorQsnBgScreen: |
|
165 #ifdef RD_FULLSCREEN_WALLPAPER |
|
166 case EAknsMinorWallpaper: |
|
167 #endif //RD_FULLSCREEN_WALLPAPER |
|
168 { |
|
169 aRect = iScreenRect; |
|
170 return ETrue; |
|
171 } |
|
172 case EAknsMinorQsnBgScreenIdle: |
|
173 case EAknsMinorQsnBgScreenMp: |
|
174 { |
|
175 aRect = normParentRect; |
|
176 return ETrue; |
|
177 } |
|
178 |
|
179 case EAknsMinorQsnBgAreaMainAppsGrid: |
|
180 { |
|
181 /* if (iGridMode == -1) |
|
182 { |
|
183 // if gridmode is -1, it has not beed read |
|
184 // so read it here |
|
185 TRAP_IGNORE( iGridMode = GetGridModeL() ); |
|
186 } |
|
187 if (!Layout_Meta_Data::IsLandscapeOrientation() && iGridMode == 1) //3x4 mode |
|
188 { |
|
189 layRect.LayoutRect( normParentRect, |
|
190 iAknLayoutScalable_Avkon.main_pane(7)); |
|
191 aRect = layRect.Rect(); |
|
192 return ETrue; |
|
193 } |
|
194 else // normal 3x3 mode |
|
195 { |
|
196 return AknLayoutUtils::LayoutMetricsRect( |
|
197 AknLayoutUtils::EMainPane, aRect ); |
|
198 }*/ |
|
199 } |
|
200 |
|
201 case EAknsMinorQsnBgAreaMain: |
|
202 case EAknsMinorQsnBgAreaMainListGene: |
|
203 case EAknsMinorQsnBgAreaMainListSet: |
|
204 case EAknsMinorQsnBgAreaMainMessage: |
|
205 layRect.LayoutRect( normParentRect, |
|
206 AknLayout::main_pane( normParentRect, 0, 1, 1 ) ); |
|
207 aRect = layRect.Rect(); |
|
208 return ETrue; |
|
209 |
|
210 case EAknsMinorQsnBgAreaMainFlat: |
|
211 { |
|
212 layRect.LayoutRect( normParentRect, |
|
213 iAknLayoutScalable_Avkon.main_pane(7)); |
|
214 aRect = layRect.Rect(); |
|
215 return ETrue; |
|
216 } |
|
217 case EAknsMinorQsnBgAreaMainSmall: |
|
218 { |
|
219 layRect.LayoutRect( normParentRect, |
|
220 iAknLayoutScalable_Avkon.main_pane(6)); |
|
221 aRect = layRect.Rect(); |
|
222 return ETrue; |
|
223 } |
|
224 |
|
225 case EAknsMinorQsnBgAreaMainHigh: |
|
226 case EAknsMinorQsnBgAreaMainCalc: |
|
227 case EAknsMinorQsnBgAreaMainPinb: |
|
228 case EAknsMinorQsnBgAreaMainQdial: |
|
229 case EAknsMinorQsnBgAreaMainMp: |
|
230 { |
|
231 layRect.LayoutRect( normParentRect, |
|
232 AknLayout::main_pane( normParentRect, 0, 0, 1 ) ); |
|
233 aRect = layRect.Rect(); |
|
234 return ETrue; |
|
235 } |
|
236 |
|
237 case EAknsMinorQsnBgAreaMainIdle: |
|
238 case EAknsMinorQsnBgAreaMainIdleDimmed: |
|
239 { |
|
240 layRect.LayoutRect( normParentRect, |
|
241 AknLayout::main_pane( normParentRect, 0, 1, 1 ) ); |
|
242 aRect = layRect.Rect(); |
|
243 return ETrue; |
|
244 } |
|
245 |
|
246 case EAknsMinorQsnBgAreaStatus: |
|
247 { |
|
248 GetScalableViaPane( aRect, normParentRect, |
|
249 iAknLayoutScalable_Avkon.area_top_pane(0), |
|
250 iAknLayoutScalable_Avkon.status_pane(0) ); |
|
251 |
|
252 return ETrue; |
|
253 } |
|
254 |
|
255 case EAknsMinorQsnBgAreaStatusIdle: |
|
256 { |
|
257 GetScalableViaPane( aRect, normParentRect, |
|
258 iAknLayoutScalable_Avkon.area_top_pane(0), |
|
259 iAknLayoutScalable_Avkon.status_pane(0) ); |
|
260 |
|
261 return ETrue; |
|
262 } |
|
263 |
|
264 case EAknsMinorQsnBgAreaStaconRt: |
|
265 case EAknsMinorQsnBgAreaStaconLt: |
|
266 case EAknsMinorQsnBgAreaStaconRtIdle: |
|
267 case EAknsMinorQsnBgAreaStaconLtIdle: |
|
268 { |
|
269 GetScalableViaPane( aRect, normParentRect, |
|
270 iAknLayoutScalable_Avkon.area_top_pane(2), |
|
271 iAknLayoutScalable_Avkon.stacon_top_pane() ); |
|
272 return ETrue; |
|
273 } |
|
274 |
|
275 case EAknsMinorQsnBgAreaStaconRb: |
|
276 case EAknsMinorQsnBgAreaStaconLb: |
|
277 case EAknsMinorQsnBgAreaStaconRbIdle: |
|
278 case EAknsMinorQsnBgAreaStaconLbIdle: |
|
279 { |
|
280 GetScalableViaPane( aRect, normParentRect, |
|
281 iAknLayoutScalable_Avkon.area_bottom_pane(2), |
|
282 iAknLayoutScalable_Avkon.stacon_bottom_pane() ); |
|
283 return ETrue; |
|
284 } |
|
285 |
|
286 case EAknsMinorQsnBgAreaControl: |
|
287 case EAknsMinorQsnBgAreaControlPopup: |
|
288 case EAknsMinorQsnBgAreaControlIdle: |
|
289 case EAknsMinorQsnBgAreaControlMp: |
|
290 { |
|
291 layRect.LayoutRect( normParentRect, |
|
292 AknLayout::control_pane( normParentRect) ); |
|
293 aRect = layRect.Rect(); |
|
294 return ETrue; |
|
295 } |
|
296 |
|
297 case EAknsMinorQsnBgColumn0: |
|
298 { |
|
299 layRect.LayoutRect( normParentRect, |
|
300 SkinLayout::Column_background_and_list_slice_skin_placing_Line_1() ); |
|
301 aRect = layRect.Rect(); |
|
302 return ETrue; |
|
303 } |
|
304 |
|
305 case EAknsMinorQsnBgColumnA: |
|
306 { |
|
307 layRect.LayoutRect( normParentRect, |
|
308 SkinLayout::Column_background_and_list_slice_skin_placing_Line_2() ); |
|
309 aRect = layRect.Rect(); |
|
310 return ETrue; |
|
311 } |
|
312 |
|
313 case EAknsMinorQsnBgColumnAB: |
|
314 { |
|
315 layRect.LayoutRect( normParentRect, |
|
316 SkinLayout::Column_background_and_list_slice_skin_placing_Line_3() ); |
|
317 aRect = layRect.Rect(); |
|
318 return ETrue; |
|
319 } |
|
320 |
|
321 case EAknsMinorQsnBgColumnC0: |
|
322 { |
|
323 layRect.LayoutRect( normParentRect, |
|
324 SkinLayout::Column_background_and_list_slice_skin_placing_Line_4() ); |
|
325 aRect = layRect.Rect(); |
|
326 return ETrue; |
|
327 } |
|
328 |
|
329 case EAknsMinorQsnBgColumnCA: |
|
330 { |
|
331 layRect.LayoutRect( normParentRect, |
|
332 SkinLayout::Column_background_and_list_slice_skin_placing_Line_5() ); |
|
333 aRect = layRect.Rect(); |
|
334 return ETrue; |
|
335 } |
|
336 |
|
337 case EAknsMinorQsnBgColumnCAB: |
|
338 { |
|
339 layRect.LayoutRect( normParentRect, |
|
340 SkinLayout::Column_background_and_list_slice_skin_placing_Line_6() ); |
|
341 aRect = layRect.Rect(); |
|
342 return ETrue; |
|
343 } |
|
344 |
|
345 case EAknsMinorQsnBgSliceList0: |
|
346 case EAknsMinorQsnBgSliceListA: |
|
347 case EAknsMinorQsnBgSliceListAB: |
|
348 { |
|
349 layRect.LayoutRect( normParentRect, |
|
350 SkinLayout::Column_background_and_list_slice_skin_placing_Line_7() ); |
|
351 aRect = layRect.Rect(); |
|
352 return ETrue; |
|
353 } |
|
354 #ifndef RD_FULLSCREEN_WALLPAPER |
|
355 case EAknsMinorWallpaper: |
|
356 { |
|
357 aRect = normParentRect; |
|
358 return ETrue; |
|
359 } |
|
360 #endif //RD_FULLSCREEN_WALLPAPER |
|
361 |
|
362 // INSERTION POINT for layout information retrieval |
|
363 } |
|
364 } |
|
365 else if( aIID.iMajor == EAknsMajorAvkon ) |
|
366 { |
|
367 switch( aIID.iMinor ) |
|
368 { |
|
369 case EAknsMinorQsnBgNavipaneSolid: |
|
370 { |
|
371 layRect.LayoutRect( normParentRect, |
|
372 iAknLayoutScalable_Avkon.status_pane_g1(0) ); |
|
373 aRect = layRect.Rect(); |
|
374 // Artificial correction |
|
375 aRect.iTl.iX = 0; |
|
376 aRect.SetWidth( aParentRect.Width() ); |
|
377 return ETrue; |
|
378 } |
|
379 |
|
380 case EAknsMinorQsnBgNavipaneWipe: |
|
381 { |
|
382 layRect.LayoutRect( normParentRect, |
|
383 iAknLayoutScalable_Avkon.status_pane_g1(0) ); |
|
384 aRect = layRect.Rect(); |
|
385 // Artificial correction |
|
386 aRect.iTl.iX = 0; |
|
387 aRect.SetWidth( aParentRect.Width() ); |
|
388 return ETrue; |
|
389 } |
|
390 |
|
391 case EAknsMinorQsnBgNavipaneSolidIdle: |
|
392 { |
|
393 layRect.LayoutRect( normParentRect, |
|
394 iAknLayoutScalable_Avkon.status_pane_g1(0) ); |
|
395 aRect = layRect.Rect(); |
|
396 // Artificial correction |
|
397 aRect.iTl.iX = 0; |
|
398 aRect.SetWidth( aParentRect.Width() ); |
|
399 return ETrue; |
|
400 } |
|
401 |
|
402 case EAknsMinorQsnBgNavipaneWipeIdle: |
|
403 { |
|
404 layRect.LayoutRect( normParentRect, |
|
405 iAknLayoutScalable_Avkon.status_pane_g1(0) ); |
|
406 aRect = layRect.Rect(); |
|
407 // Artificial correction |
|
408 aRect.iTl.iX = 0; |
|
409 aRect.SetWidth( aParentRect.Width() ); |
|
410 return ETrue; |
|
411 } |
|
412 } |
|
413 } |
|
414 |
|
415 return EFalse; |
|
416 } |
|
417 |
|
418 EXPORT_C void GetRectForItem(const TAknsItemID& aID, TRect& aParentRect, TRect& aOutRect) |
|
419 { |
|
420 TAknsItemID parent = GetParent(aID); |
|
421 TRect parentRect; |
|
422 TRect itemRect; |
|
423 |
|
424 if (parent != KAknsIIDDefault)//KAknsIIDNone) // go recursively down to the root element |
|
425 { |
|
426 GetRectForItem(parent, aParentRect, aOutRect); |
|
427 } |
|
428 else // root element |
|
429 { |
|
430 CHuiStatic::LayoutMetricsRect(AknLayoutUtils::EScreen, aParentRect); |
|
431 } |
|
432 GetItemLayout( aID,aParentRect, aOutRect ); |
|
433 aParentRect = aOutRect; |
|
434 } |