author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 02 Feb 2010 00:43:10 +0200 | |
changeset 3 | 41300fa6a67c |
parent 0 | 1918ee327afb |
child 4 | 3b1da2848fc7 |
child 7 | f7bc934e204c |
child 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
** All rights reserved. |
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the utility applications of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "pixel_metrics.h" |
|
43 |
||
44 |
#include <AknLayout2ScalableDef.h> |
|
45 |
#include <AknLayoutScalable_Avkon.cdl.h> |
|
46 |
#include <AknLayoutScalable_Apps.cdl.h> |
|
47 |
#include <AknUtils.h> |
|
48 |
||
49 |
// Version number for dynamic calculations. These are to be exported to static data, |
|
50 |
// so that we can keep dynamic and static values inline. |
|
51 |
// Please adjust version data if correcting dynamic PM calculations. |
|
52 |
const TInt KPMMajorVersion = 1; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
53 |
const TInt KPMMinorVersion = 15; |
0 | 54 |
|
55 |
TPixelMetricsVersion PixelMetrics::Version() |
|
56 |
{ |
|
57 |
TPixelMetricsVersion version; |
|
58 |
version.majorVersion = KPMMajorVersion; |
|
59 |
version.minorVersion = KPMMinorVersion; |
|
60 |
return version; |
|
61 |
} |
|
62 |
||
63 |
TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) |
|
64 |
{ |
|
65 |
TInt value = -909; |
|
66 |
// Main pane |
|
67 |
TRect mainPaneRect; |
|
68 |
AknLayoutUtils::LayoutMetricsRect( |
|
69 |
AknLayoutUtils::EMainPane, |
|
70 |
mainPaneRect ); |
|
71 |
// Screen |
|
72 |
TRect screenRect; |
|
73 |
AknLayoutUtils::LayoutMetricsRect( |
|
74 |
AknLayoutUtils::EApplicationWindow, |
|
75 |
screenRect ); |
|
76 |
// Navi pane |
|
77 |
TRect naviPaneRect; |
|
78 |
AknLayoutUtils::LayoutMetricsRect( |
|
79 |
AknLayoutUtils::ENaviPane, |
|
80 |
naviPaneRect ); |
|
81 |
||
82 |
TAknLayoutRect appWindow; |
|
83 |
appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); |
|
84 |
||
85 |
TInt variety = 0; |
|
86 |
TBool landscape = EFalse; |
|
87 |
if ( screenRect.iBr.iX > screenRect.iBr.iY ) |
|
88 |
{ |
|
89 |
// in landscape another variety is used |
|
90 |
landscape = ETrue; |
|
91 |
} |
|
92 |
switch (metric) |
|
93 |
{ |
|
94 |
case QStyle::PM_DockWidgetHandleExtent: |
|
95 |
// what's this??? Not in S60 |
|
96 |
break; |
|
97 |
case QStyle::PM_CheckListControllerSize: |
|
98 |
case QStyle::PM_CheckListButtonSize: |
|
99 |
{ |
|
100 |
// hierarchical menu - checkbox / radiobutton |
|
101 |
// Area (width/height) of the checkbox/radio button in a Q3CheckListItem. |
|
102 |
TAknLayoutRect listScrollPane; |
|
103 |
listScrollPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0)); |
|
104 |
TAknLayoutRect listGenPane; |
|
105 |
listGenPane.LayoutRect( listScrollPane.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0)); |
|
106 |
TAknLayoutRect listHierarchyPane; |
|
107 |
listHierarchyPane.LayoutRect( listGenPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane(0)); |
|
108 |
||
109 |
TAknLayoutRect listHierarchyControllerPane; |
|
110 |
listHierarchyPane.LayoutRect( listHierarchyPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane_g3(0)); |
|
111 |
TAknLayoutRect listHierarchyPropertyPane; |
|
112 |
listHierarchyPropertyPane.LayoutRect( listHierarchyPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane_g2(0)); |
|
113 |
||
114 |
if (metric==QStyle::PM_CheckListControllerSize)value = Max( listHierarchyPane.Rect().Width(), listHierarchyPane.Rect().Width()); |
|
115 |
else value = Max( listHierarchyPropertyPane.Rect().Width(), listHierarchyPropertyPane.Rect().Width()); |
|
116 |
} |
|
117 |
break; |
|
118 |
case QStyle::PM_DialogButtonsSeparator: //Distance between buttons in a dialog buttons widget. |
|
119 |
case QStyle::PM_DialogButtonsButtonWidth: // Minimum width of a button in a dialog buttons widget. |
|
120 |
case QStyle::PM_DialogButtonsButtonHeight:// Minimum height of a button in a dialog buttons widget. |
|
121 |
{ |
|
122 |
TAknLayoutRect appWindow; |
|
123 |
appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); |
|
124 |
variety = 0; |
|
125 |
if ( landscape ) |
|
126 |
{ |
|
127 |
variety = 2; |
|
128 |
} |
|
129 |
TAknLayoutRect areaBottomRect; |
|
130 |
areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); |
|
131 |
||
132 |
TAknLayoutRect controlPaneRect; |
|
133 |
controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); |
|
134 |
TAknLayoutText controlPaneLSKText; |
|
135 |
TAknLayoutText controlPaneRSKText; |
|
136 |
TAknLayoutText controlPaneMSKText; |
|
137 |
variety = 0; |
|
138 |
if (AknLayoutUtils::MSKEnabled()) |
|
139 |
{ |
|
140 |
variety = 3; |
|
141 |
controlPaneMSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t3(variety)); //MSK text area |
|
142 |
} |
|
143 |
controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area |
|
144 |
controlPaneRSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t2(variety)); //RSK text area |
|
145 |
||
146 |
/* |
|
147 |
* |
|
148 |
================================================================================== |
|
149 |
| A | LSK_rect | B | MSK_rect | C | RSK_rect | D | |
|
150 |
================================================================================== |
|
151 |
where A is left padding (between control pane and LSK rect) |
|
152 |
B is mid-left padding (between LSK and MSK rects) |
|
153 |
C is mid-right padding (between MSK and RSK rects) |
|
154 |
D is right padding (between RSK and control pane) |
|
155 |
||
156 |
==> Since all these can be separate, lets take Max of {A..D} for PM value |
|
157 |
*/ |
|
158 |
||
159 |
TInt itemSpacingA = 0; |
|
160 |
TInt itemSpacingB = 0; |
|
161 |
TInt itemSpacingC = 0; |
|
162 |
TInt itemSpacingMax = 0; |
|
163 |
if ( !AknLayoutUtils::MSKEnabled() ) |
|
164 |
{ |
|
165 |
itemSpacingA = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; |
|
166 |
itemSpacingB = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; |
|
167 |
if (!landscape) |
|
168 |
{ |
|
169 |
// use mid-gap only in portrait |
|
170 |
itemSpacingC = controlPaneRSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; |
|
171 |
} |
|
172 |
itemSpacingMax = Max(itemSpacingA, Max( itemSpacingB, itemSpacingC)); |
|
173 |
// no itemspacing4 if no MSK |
|
174 |
} |
|
175 |
else |
|
176 |
{ |
|
177 |
TInt itemSpacingD = 0; |
|
178 |
itemSpacingA = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; |
|
179 |
itemSpacingB = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; |
|
180 |
if ( !(AknLayoutUtils::PenEnabled() || landscape) ) // no MSK in touch, nor in landscape |
|
181 |
{ |
|
182 |
itemSpacingC = controlPaneRSKText.TextRect().iTl.iX - controlPaneMSKText.TextRect().iBr.iX; |
|
183 |
itemSpacingD = controlPaneMSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; |
|
184 |
} |
|
185 |
itemSpacingMax = Max(itemSpacingA, Max( itemSpacingB, Max( itemSpacingC, itemSpacingD ))); |
|
186 |
} |
|
187 |
if (metric==QStyle::PM_DialogButtonsSeparator) value = itemSpacingMax; |
|
188 |
else if (metric==QStyle::PM_DialogButtonsButtonWidth) |
|
189 |
{ |
|
190 |
value = Max( controlPaneLSKText.TextRect().Width(), controlPaneRSKText.TextRect().Width()); |
|
191 |
if (AknLayoutUtils::MSKEnabled()) |
|
192 |
{ |
|
193 |
value = Max(value, controlPaneMSKText.TextRect().Width()); |
|
194 |
} |
|
195 |
} |
|
196 |
else if (metric==QStyle::PM_DialogButtonsButtonHeight) |
|
197 |
{ |
|
198 |
value = Max( controlPaneLSKText.TextRect().Height(), controlPaneRSKText.TextRect().Height()); |
|
199 |
if (AknLayoutUtils::MSKEnabled()) |
|
200 |
{ |
|
201 |
value = Max(value, controlPaneMSKText.TextRect().Height()); |
|
202 |
} |
|
203 |
} |
|
204 |
} |
|
205 |
break; |
|
206 |
case QStyle::PM_DockWidgetTitleMargin: // not in S60, lets use the same margin as in button |
|
207 |
case QStyle::PM_DockWidgetTitleBarButtonMargin: // not in S60, lets use the same margin as in button |
|
208 |
case QStyle::PM_ButtonMargin: |
|
209 |
{ |
|
210 |
TRect myRect(TSize( 80, 20)); // this arbitrary size - user can set it - button border does not seem to have any scalability in it |
|
211 |
TAknLayoutRect buttonRect; |
|
212 |
TAknLayoutRect buttonBordersRect; |
|
213 |
TAknLayoutText buttonText; |
|
214 |
||
215 |
buttonRect.LayoutRect( myRect, AknLayoutScalable_Avkon::eswt_ctrl_button_pane()); |
|
216 |
buttonBordersRect.LayoutRect( buttonRect.Rect(), AknLayoutScalable_Avkon::common_borders_pane_copy2(0)); //with text |
|
217 |
buttonText.LayoutText( buttonRect.Rect(), AknLayoutScalable_Avkon::control_button_pane_t1() ); |
|
218 |
||
219 |
// Its better to use left-right margins, since font deployment can create funny top / bottom margins |
|
220 |
TInt leftMargin = buttonText.TextRect().iTl.iX - buttonBordersRect.Rect().iTl.iX; |
|
221 |
TInt rightMargin = buttonBordersRect.Rect().iBr.iX - buttonText.TextRect().iBr.iX; |
|
222 |
value = (TInt) ((leftMargin+rightMargin)/2); |
|
223 |
} |
|
224 |
break; |
|
225 |
case QStyle::PM_ButtonDefaultIndicator: |
|
226 |
{ |
|
227 |
// no default button indicators in S60 |
|
228 |
value = 0; |
|
229 |
} |
|
230 |
break; |
|
231 |
case QStyle::PM_MdiSubWindowFrameWidth: |
|
232 |
case QStyle::PM_ComboBoxFrameWidth: |
|
233 |
case QStyle::PM_SpinBoxFrameWidth: |
|
234 |
value = 0; |
|
235 |
break; |
|
236 |
case QStyle::PM_ToolBarFrameWidth: |
|
237 |
case QStyle::PM_DefaultFrameWidth: |
|
238 |
{ |
|
239 |
TAknLayoutRect highLightPaneRect; |
|
240 |
TAknLayoutRect centerPaneRect; |
|
241 |
TRect rectParent( mainPaneRect ); |
|
242 |
highLightPaneRect.LayoutRect( rectParent, AknLayoutScalable_Avkon::toolbar_button_pane(0).LayoutLine()); |
|
243 |
centerPaneRect.LayoutRect(rectParent, AknLayoutScalable_Avkon::toolbar_button_pane_g1().LayoutLine()); |
|
244 |
||
245 |
value = highLightPaneRect.Rect().iBr.iX - centerPaneRect.Rect().iBr.iX; |
|
246 |
} |
|
247 |
break; |
|
248 |
case QStyle::PM_RadioButtonLabelSpacing: |
|
249 |
{ |
|
250 |
/* |
|
251 |
* |
|
252 |
=================================================================================== |
|
253 |
| A | iconLayoutRect |B| itemText | C | |
|
254 |
=================================================================================== |
|
255 |
mirrored: |
|
256 |
=================================================================================== |
|
257 |
| C | itemText |B| iconLayoutRect | A | |
|
258 |
=================================================================================== |
|
259 |
where A is left padding |
|
260 |
B is gap between icon and text |
|
261 |
C is right padding |
|
262 |
*/ |
|
263 |
||
264 |
TRect rectParent( mainPaneRect ); |
|
265 |
TAknLayoutRect layoutRect; |
|
266 |
layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar |
|
267 |
TAknLayoutText itemText; |
|
268 |
itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) ); |
|
269 |
TAknLayoutRect iconLayoutRect; |
|
270 |
iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() ); |
|
271 |
||
272 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
273 |
{ |
|
274 |
value = itemText.TextRect().iTl.iX - iconLayoutRect.Rect().iBr.iX; |
|
275 |
} |
|
276 |
else |
|
277 |
{ |
|
278 |
value = iconLayoutRect.Rect().iTl.iX - itemText.TextRect().iBr.iX; |
|
279 |
} |
|
280 |
} |
|
281 |
||
282 |
break; |
|
283 |
case QStyle::PM_CheckBoxLabelSpacing: |
|
284 |
{ |
|
285 |
/* |
|
286 |
* |
|
287 |
=================================================================================== |
|
288 |
| A | iconLayoutRect |B| itemText | C | |
|
289 |
=================================================================================== |
|
290 |
mirrored: |
|
291 |
=================================================================================== |
|
292 |
| C | itemText |B| iconLayoutRect | A | |
|
293 |
=================================================================================== |
|
294 |
where A is left padding |
|
295 |
B is gap between icon and text |
|
296 |
C is right padding |
|
297 |
*/ |
|
298 |
||
299 |
TRect rectParent( mainPaneRect ); |
|
300 |
TAknLayoutRect layoutRect; |
|
301 |
layoutRect.LayoutRect( rectParent, AknLayoutScalable_Avkon::listscroll_gen_pane(0).LayoutLine() ); |
|
302 |
||
303 |
TAknLayoutRect layoutRect2; |
|
304 |
layoutRect2.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0).LayoutLine() ); |
|
305 |
TAknLayoutRect layoutRect3; |
|
306 |
layoutRect3.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane(0).LayoutLine() ); |
|
307 |
||
308 |
TAknLayoutText itemText; |
|
309 |
itemText.LayoutText( layoutRect3.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane_t1(0) ); |
|
310 |
TAknLayoutRect iconLayoutRect; |
|
311 |
iconLayoutRect.LayoutRect( layoutRect3.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane_g1(0).LayoutLine() ); |
|
312 |
||
313 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
314 |
{ |
|
315 |
value = itemText.TextRect().iTl.iX - iconLayoutRect.Rect().iBr.iX; |
|
316 |
} |
|
317 |
else |
|
318 |
{ |
|
319 |
value = iconLayoutRect.Rect().iTl.iX - itemText.TextRect().iBr.iX; |
|
320 |
} |
|
321 |
} |
|
322 |
break; |
|
323 |
case QStyle::PM_ToolTipLabelFrameWidth: |
|
324 |
{ |
|
325 |
/* |
|
326 |
* |
|
327 |
|===================================================================================| |
|
328 |
| info popup note B | |
|
329 |
| ============================================================================== | |
|
330 |
| A | hintText | D| |
|
331 |
| ============================================================================== | |
|
332 |
| C | |
|
333 |
|===================================================================================| |
|
334 |
where A is left padding |
|
335 |
B is top padding |
|
336 |
C is bottom padding |
|
337 |
D is right padding |
|
338 |
we'll provide the average of top and bottom padding as PM_ToolTipLabelFrameWidth |
|
339 |
*/ |
|
340 |
||
341 |
// Set pop-up to contain only one line of text |
|
342 |
TInt index = 0; |
|
343 |
if ( landscape ) |
|
344 |
{ |
|
345 |
// in landscape another variety is used |
|
346 |
index += 5; |
|
347 |
} |
|
348 |
// Get parameter and table limits for popup preview text window |
|
349 |
TAknLayoutScalableParameterLimits limits = |
|
350 |
AknLayoutScalable_Avkon::popup_preview_text_window_ParamLimits(); |
|
351 |
||
352 |
TAknLayoutScalableTableLimits tableLimits = |
|
353 |
AknLayoutScalable_Avkon::popup_preview_text_window_t_Limits(); |
|
354 |
||
355 |
TInt windowVariety = Min( Max( index, limits.FirstVariety() ), limits.LastVariety() ); |
|
356 |
||
357 |
TAknLayoutScalableParameterLimits tParamLimits = |
|
358 |
AknLayoutScalable_Avkon:: popup_preview_text_window_t_ParamLimits( |
|
359 |
tableLimits.FirstIndex() ); |
|
360 |
||
361 |
TInt lineVariety = Min( Max( index, tParamLimits.FirstVariety() ), tParamLimits.LastVariety() ); |
|
362 |
||
363 |
TAknWindowLineLayout lineLayout = AknLayoutScalable_Avkon::popup_preview_text_window(windowVariety).LayoutLine(); |
|
364 |
||
365 |
// rect for the whole info popup |
|
366 |
TAknLayoutRect layoutRect; |
|
367 |
layoutRect.LayoutRect(screenRect, lineLayout); |
|
368 |
TRect rectPopupWindow = layoutRect.Rect(); |
|
369 |
||
370 |
TAknTextComponentLayout popupTextLayout = |
|
371 |
AknLayoutScalable_Avkon::popup_preview_text_window_t( |
|
372 |
tableLimits.FirstIndex(), lineVariety ); |
|
373 |
||
374 |
// rect for the whole the text inside the popup |
|
375 |
TAknLayoutText layoutText; |
|
376 |
layoutText.LayoutText( rectPopupWindow, popupTextLayout ); |
|
377 |
||
378 |
// Each margin has different value in S60 - let's take average of top & bottom |
|
379 |
TInt topMargin = layoutText.TextRect().iTl.iY - layoutRect.Rect().iTl.iY; |
|
380 |
TInt bottomMargin = layoutRect.Rect().iBr.iY - layoutText.TextRect().iBr.iY; |
|
381 |
TInt averageMargin = (TInt)(topMargin+bottomMargin)/2; |
|
382 |
value = averageMargin; |
|
383 |
} |
|
384 |
break; |
|
385 |
case QStyle::PM_ListViewIconSize: |
|
386 |
{ |
|
387 |
// todo: there are lots and lots of views with different sized icons - which one to use? |
|
388 |
// todo: this is probably not a good default icon size, as this fetches A column icon size |
|
389 |
// todo: preferably use settings item with graphic instead |
|
390 |
TAknLayoutRect iconRect; |
|
391 |
iconRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::list_double_graphic_pane_g1_cp2(0).LayoutLine()); |
|
392 |
//icon areas are usually squares - lets take bigger of two dimensions |
|
393 |
value = Max( iconRect.Rect().Width(), iconRect.Rect().Height() ); |
|
394 |
} |
|
395 |
break; |
|
396 |
||
397 |
case QStyle::PM_LargeIconSize: // lets use AS icon as a base for large icon |
|
398 |
case QStyle::PM_IconViewIconSize: |
|
399 |
{ |
|
400 |
// Lets assume that we'd take these from grid (3x4) layout |
|
401 |
TAknLayoutRect appPaneRect; |
|
402 |
TAknLayoutRect gridAppRect; |
|
403 |
TAknLayoutRect cellAppRect; |
|
404 |
TInt varietyGrid = 2; //Let's use the 3x4 grid as a base. |
|
405 |
TInt varietyCell = 1; //Let's use the 3x4 grid as a base. |
|
406 |
if ( landscape ) |
|
407 |
{ |
|
408 |
varietyGrid = 3; |
|
409 |
varietyCell = 2; |
|
410 |
} |
|
411 |
appPaneRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_app_pane(1).LayoutLine()); //3x4 grid |
|
412 |
gridAppRect.LayoutRect( appPaneRect.Rect(), AknLayoutScalable_Avkon::grid_app_pane(varietyGrid).LayoutLine()); |
|
413 |
cellAppRect.LayoutRect( gridAppRect.Rect(), AknLayoutScalable_Avkon::cell_app_pane(varietyCell, 0, 0).LayoutLine()); |
|
414 |
TAknLayoutRect cellGraphRect; |
|
415 |
TAknWindowComponentLayout appIcon = AknLayoutScalable_Avkon::cell_app_pane_g1(0); // no mark, no highlight |
|
416 |
cellGraphRect.LayoutRect( gridAppRect.Rect(), appIcon); |
|
417 |
//icon areas are usually squares - if not, lets take larger |
|
418 |
value = Max( cellGraphRect.Rect().Width(), cellGraphRect.Rect().Height()); |
|
419 |
} |
|
420 |
break; |
|
421 |
case QStyle::PM_TabBarIconSize: |
|
422 |
{ |
|
423 |
TAknLayoutRect naviNaviRect; |
|
424 |
naviNaviRect.LayoutRect( naviPaneRect, AknLayoutScalable_Avkon::navi_navi_tabs_pane().LayoutLine()); // two tabs |
|
425 |
TAknLayoutRect tabRect; |
|
426 |
tabRect.LayoutRect( naviNaviRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane().LayoutLine()); //active tab on left |
|
427 |
TAknLayoutRect activeTabRect; |
|
428 |
activeTabRect.LayoutRect( tabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0).LayoutLine()); //active tab |
|
429 |
TAknLayoutRect activeTabGraphicRect; |
|
430 |
||
431 |
activeTabGraphicRect.LayoutRect( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_g1().LayoutLine()); //active tab graphic |
|
432 |
value = Min(activeTabGraphicRect.Rect().Width(), activeTabGraphicRect.Rect().Height()); |
|
433 |
} |
|
434 |
break; |
|
435 |
case QStyle::PM_MessageBoxIconSize: |
|
436 |
{ |
|
437 |
TAknLayoutRect noteRect; |
|
438 |
noteRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_image_window(0).LayoutLine()); //note with image |
|
439 |
TAknLayoutRect noteImageRect; |
|
440 |
noteImageRect.LayoutRect( noteRect.Rect(), AknLayoutScalable_Avkon::popup_note_image_window_g2(2).LayoutLine()); //note with image |
|
441 |
value = noteImageRect.Rect().Width(); |
|
442 |
} |
|
443 |
break; |
|
444 |
case QStyle::PM_TextCursorWidth: |
|
445 |
{ |
|
446 |
TAknLayoutRect miscGraphicsRect; |
|
447 |
miscGraphicsRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::misc_graphics()); |
|
448 |
miscGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::misc_graphics()); |
|
449 |
TAknLayoutRect textsGraphicsRect; |
|
450 |
textsGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::texts_graphics()); |
|
451 |
TAknLayoutRect cursorGraphicsRect; |
|
452 |
cursorGraphicsRect.LayoutRect( textsGraphicsRect.Rect(), AknLayoutScalable_Avkon::cursor_graphics_pane()); |
|
453 |
TAknLayoutRect cursorPrimaryRect; |
|
454 |
cursorPrimaryRect.LayoutRect( cursorGraphicsRect.Rect(), AknLayoutScalable_Avkon::cursor_primary_pane()); |
|
455 |
TAknLayoutRect cursorRect; |
|
456 |
cursorRect.LayoutRect( cursorPrimaryRect.Rect(), AknLayoutScalable_Avkon::cursor_digital_pane_g1()); |
|
457 |
value = cursorRect.Rect().Width(); |
|
458 |
} |
|
459 |
break; |
|
460 |
case QStyle::PM_SliderLength: |
|
461 |
{ |
|
462 |
TAknLayoutRect settingRect; |
|
463 |
settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); |
|
464 |
TAknLayoutRect settingContentRect; |
|
465 |
settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); |
|
466 |
TAknLayoutRect sliderRect; |
|
467 |
sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); |
|
468 |
TAknLayoutRect sliderSettingRect; |
|
469 |
sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); |
|
470 |
TAknLayoutRect sliderGraph2Rect; |
|
471 |
sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); |
|
472 |
value = sliderGraph2Rect.Rect().Width(); |
|
473 |
} |
|
474 |
break; |
|
475 |
case QStyle::PM_SliderThickness: |
|
476 |
{ |
|
477 |
TAknLayoutRect settingRect; |
|
478 |
settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); |
|
479 |
TAknLayoutRect settingContentRect; |
|
480 |
settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); |
|
481 |
TAknLayoutRect sliderRect; |
|
482 |
sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); |
|
483 |
TAknLayoutRect sliderSettingRect; |
|
484 |
sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); |
|
485 |
TAknLayoutRect sliderGraph2Rect; |
|
486 |
sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); |
|
487 |
value = (TInt)(sliderGraph2Rect.Rect().Height()*1.5); // add assumed tickmark height |
|
488 |
} |
|
489 |
break; |
|
490 |
case QStyle::PM_SliderTickmarkOffset: |
|
491 |
{ |
|
492 |
TAknLayoutRect settingRect; |
|
493 |
settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); |
|
494 |
TAknLayoutRect settingContentRect; |
|
495 |
settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); |
|
496 |
TAknLayoutRect sliderRect; |
|
497 |
sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); |
|
498 |
TAknLayoutRect sliderSettingRect; |
|
499 |
sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); |
|
500 |
TAknLayoutRect sliderGraph2Rect; |
|
501 |
sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); |
|
502 |
value = (TInt)(sliderGraph2Rect.Rect().Height()*0.5); // no tickmarks in S60, lets assume they are half the size of slider indicator |
|
503 |
} |
|
504 |
break; |
|
505 |
case QStyle::PM_SliderControlThickness: |
|
506 |
{ |
|
507 |
TAknLayoutRect settingRect; |
|
508 |
settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); |
|
509 |
TAknLayoutRect settingContentRect; |
|
510 |
settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); |
|
511 |
TAknLayoutRect sliderRect; |
|
512 |
sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); |
|
513 |
TAknLayoutRect sliderSettingRect; |
|
514 |
sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); |
|
515 |
TAknLayoutRect sliderGraph2Rect; |
|
516 |
sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); |
|
517 |
value = sliderGraph2Rect.Rect().Height(); |
|
518 |
} |
|
519 |
break; |
|
520 |
case QStyle::PM_SliderSpaceAvailable: |
|
521 |
{ |
|
522 |
TAknLayoutRect settingRect; |
|
523 |
settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); |
|
524 |
TAknLayoutRect settingContentRect; |
|
525 |
settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); |
|
526 |
TAknLayoutRect sliderRect; |
|
527 |
sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); |
|
528 |
TAknLayoutRect sliderSettingRect; |
|
529 |
sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); |
|
530 |
value = sliderSettingRect.Rect().Width(); |
|
531 |
} |
|
532 |
break; |
|
533 |
case QStyle::PM_MenuBarItemSpacing: |
|
534 |
{ |
|
535 |
TAknLayoutRect appWindow; |
|
536 |
appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); |
|
537 |
||
538 |
variety = 0; |
|
539 |
if ( landscape ) |
|
540 |
{ |
|
541 |
variety = 2; |
|
542 |
} |
|
543 |
TAknLayoutRect areaBottomRect; |
|
544 |
areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); |
|
545 |
||
546 |
TAknLayoutRect controlPaneRect; |
|
547 |
controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); |
|
548 |
TAknLayoutText controlPaneLSKText; |
|
549 |
TAknLayoutText controlPaneRSKText; |
|
550 |
TAknLayoutText controlPaneMSKText; |
|
551 |
variety = 0; |
|
552 |
if (AknLayoutUtils::MSKEnabled()) |
|
553 |
{ |
|
554 |
variety = 3; |
|
555 |
controlPaneMSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t3(variety)); //MSK text area |
|
556 |
} |
|
557 |
controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area |
|
558 |
controlPaneRSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t2(variety)); //RSK text area |
|
559 |
||
560 |
/* |
|
561 |
* |
|
562 |
================================================================================== |
|
563 |
| A | LSK_rect | B | MSK_rect | C | RSK_rect | D | |
|
564 |
================================================================================== |
|
565 |
where A is left padding (between control pane and LSK rect) |
|
566 |
B is mid-left padding (between LSK and MSK rects) |
|
567 |
C is mid-right padding (between MSK and RSK rects) |
|
568 |
D is right padding (between RSK and control pane) |
|
569 |
||
570 |
==> Since all these can be separate, lets take Max of {A..D} for PM value |
|
571 |
*/ |
|
572 |
||
573 |
TInt itemSpacing1 = 0; |
|
574 |
TInt itemSpacing2 = 0; |
|
575 |
TInt itemSpacing3 = 0; |
|
576 |
TInt itemSpacing4 = 0; |
|
577 |
TInt itemSpacingMax = 0; |
|
578 |
if ( !AknLayoutUtils::MSKEnabled() ) |
|
579 |
{ |
|
580 |
itemSpacing1 = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; |
|
581 |
itemSpacing2 = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; |
|
582 |
if ( !landscape ) |
|
583 |
{ |
|
584 |
// use mid gap only in portrait |
|
585 |
itemSpacing3 = controlPaneRSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; |
|
586 |
} |
|
587 |
itemSpacingMax = Max(itemSpacing1, Max( itemSpacing2, itemSpacing3)); |
|
588 |
// no itemspacing4 if no MSK |
|
589 |
} |
|
590 |
else |
|
591 |
{ |
|
592 |
itemSpacing1 = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; |
|
593 |
itemSpacing2 = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; |
|
594 |
if ( !(AknLayoutUtils::PenEnabled() || landscape) ) // no MSK in touch, nor in landscape |
|
595 |
{ |
|
596 |
itemSpacing3 = controlPaneRSKText.TextRect().iTl.iX - controlPaneMSKText.TextRect().iBr.iX; |
|
597 |
itemSpacing4 = controlPaneMSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; |
|
598 |
} |
|
599 |
itemSpacingMax = Max(itemSpacing1, Max( itemSpacing2, Max( itemSpacing3, itemSpacing4 ))); |
|
600 |
} |
|
601 |
value = itemSpacingMax; |
|
602 |
} |
|
603 |
break; |
|
604 |
case QStyle::PM_MenuBarHMargin: |
|
605 |
{ |
|
606 |
TAknLayoutRect appWindow; |
|
607 |
appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); |
|
608 |
||
609 |
variety = 0; |
|
610 |
if ( landscape ) |
|
611 |
{ |
|
612 |
variety = 6; |
|
613 |
} |
|
614 |
TAknLayoutRect areaBottomRect; |
|
615 |
areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); |
|
616 |
||
617 |
// variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) |
|
618 |
TAknLayoutRect controlPaneRect; |
|
619 |
controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); |
|
620 |
value = areaBottomRect.Rect().Height() - controlPaneRect.Rect().Height(); |
|
621 |
} |
|
622 |
break; |
|
623 |
case QStyle::PM_MenuBarVMargin: |
|
624 |
{ |
|
625 |
TAknLayoutRect appWindow; |
|
626 |
appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); |
|
627 |
||
628 |
variety = 0; |
|
629 |
if ( landscape ) |
|
630 |
{ |
|
631 |
variety = 6; |
|
632 |
} |
|
633 |
TAknLayoutText controlPaneLSKText; |
|
634 |
TAknLayoutRect areaBottomRect; |
|
635 |
areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); |
|
636 |
// variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) |
|
637 |
TAknLayoutRect controlPaneRect; |
|
638 |
controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); |
|
639 |
||
640 |
variety = 0; |
|
641 |
if (AknLayoutUtils::MSKEnabled()) |
|
642 |
{ |
|
643 |
variety = 3; |
|
644 |
} |
|
645 |
controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area |
|
646 |
||
647 |
value = controlPaneRect.Rect().Height() - controlPaneLSKText.TextRect().Height(); |
|
648 |
} |
|
649 |
break; |
|
650 |
case QStyle::PM_ToolBarItemSpacing: |
|
651 |
{ |
|
652 |
TAknLayoutRect popupToolBarWindow; |
|
653 |
variety = 4; |
|
654 |
popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); |
|
655 |
TAknLayoutRect gridToolBarRect; |
|
656 |
gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); |
|
657 |
TAknLayoutRect cellToolBarRect1; |
|
658 |
TAknLayoutRect cellToolBarRect2; |
|
659 |
cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item |
|
660 |
cellToolBarRect2.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(1).LayoutLine() ); //second item |
|
661 |
value = cellToolBarRect1.Rect().iBr.iX - cellToolBarRect2.Rect().iTl.iX; |
|
662 |
} |
|
663 |
break; |
|
664 |
case QStyle::PM_ToolBarItemMargin: |
|
665 |
{ |
|
666 |
variety = 4; |
|
667 |
TAknLayoutRect popupToolBarWindow; |
|
668 |
popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); |
|
669 |
TAknLayoutRect gridToolBarRect; |
|
670 |
gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); |
|
671 |
TAknLayoutRect cellToolBarRect1; |
|
672 |
cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item |
|
673 |
value = gridToolBarRect.Rect().iTl.iX - cellToolBarRect1.Rect().iTl.iX; |
|
674 |
} |
|
675 |
break; |
|
676 |
case QStyle::PM_LayoutLeftMargin: // there really isn't a default layoutting on s60, but lets use AppShell icon deployment as base |
|
677 |
case QStyle::PM_LayoutRightMargin: |
|
678 |
case QStyle::PM_LayoutTopMargin: |
|
679 |
case QStyle::PM_LayoutBottomMargin: |
|
680 |
case QStyle::PM_LayoutHorizontalSpacing: |
|
681 |
case QStyle::PM_LayoutVerticalSpacing: |
|
682 |
{ |
|
683 |
//since spacing and margins should be globally same, lets use same easy component as base - such as find popup |
|
684 |
TAknLayoutRect popup_find_windowRect; |
|
685 |
TAknLayoutRect bg_popup_window_pane_cp12Rect; |
|
686 |
TAknLayoutRect find_popup_paneRect; |
|
687 |
popup_find_windowRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_find_window(0).LayoutLine()); |
|
688 |
bg_popup_window_pane_cp12Rect.LayoutRect( popup_find_windowRect.Rect(), AknLayoutScalable_Avkon::bg_popup_window_pane_cp12().LayoutLine()); |
|
689 |
find_popup_paneRect.LayoutRect( bg_popup_window_pane_cp12Rect.Rect(), AknLayoutScalable_Avkon::find_popup_pane().LayoutLine()); |
|
690 |
||
691 |
const TBool mirrored = AknLayoutUtils::LayoutMirrored(); |
|
692 |
if ((metric==QStyle::PM_LayoutVerticalSpacing && !mirrored) || metric==QStyle::PM_LayoutLeftMargin) |
|
693 |
{ |
|
694 |
if (mirrored) |
|
695 |
{ |
|
696 |
value = find_popup_paneRect.Rect().iTl.iX - bg_popup_window_pane_cp12Rect.Rect().iTl.iX; |
|
697 |
} |
|
698 |
else |
|
699 |
{ |
|
700 |
value = find_popup_paneRect.Rect().iTl.iX - bg_popup_window_pane_cp12Rect.Rect().iTl.iX; |
|
701 |
} |
|
702 |
} |
|
703 |
else if (metric==QStyle::PM_LayoutRightMargin || (metric==QStyle::PM_LayoutVerticalSpacing && mirrored)) |
|
704 |
{ |
|
705 |
if (mirrored) |
|
706 |
{ |
|
707 |
value = bg_popup_window_pane_cp12Rect.Rect().iBr.iX - find_popup_paneRect.Rect().iBr.iX; |
|
708 |
} |
|
709 |
else |
|
710 |
{ |
|
711 |
value = bg_popup_window_pane_cp12Rect.Rect().iBr.iX - find_popup_paneRect.Rect().iBr.iX; |
|
712 |
} |
|
713 |
} |
|
714 |
else if (metric==QStyle::PM_LayoutTopMargin || metric==QStyle::PM_LayoutHorizontalSpacing) |
|
715 |
{ |
|
716 |
value = find_popup_paneRect.Rect().iTl.iY - bg_popup_window_pane_cp12Rect.Rect().iTl.iY; |
|
717 |
} |
|
718 |
else if (metric==QStyle::PM_LayoutBottomMargin) |
|
719 |
{ |
|
720 |
value = bg_popup_window_pane_cp12Rect.Rect().iBr.iY - find_popup_paneRect.Rect().iBr.iY; |
|
721 |
} |
|
722 |
} |
|
723 |
break; |
|
724 |
case QStyle::PM_MaximumDragDistance: |
|
725 |
{ |
|
726 |
value = -1; //disable - not in S60 |
|
727 |
} |
|
728 |
break; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
729 |
case QStyle::PM_SplitterWidth: |
0 | 730 |
case QStyle::PM_ScrollBarExtent: |
731 |
{ |
|
732 |
TAknLayoutRect miscGraphicsRect; |
|
733 |
miscGraphicsRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::misc_graphics()); |
|
734 |
miscGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::misc_graphics()); |
|
735 |
TAknLayoutRect textsGraphicsRect; |
|
736 |
textsGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::texts_graphics()); |
|
737 |
TAknLayoutRect editorScrollRect; |
|
738 |
editorScrollRect.LayoutRect( textsGraphicsRect.Rect(), AknLayoutScalable_Avkon::editor_scroll_pane()); |
|
739 |
TAknLayoutRect scrollPaneRect; |
|
740 |
scrollPaneRect.LayoutRect( editorScrollRect.Rect(), AknLayoutScalable_Avkon::scroll_pane_cp13()); |
|
741 |
value = scrollPaneRect.Rect().Width(); // width of editor's scroll bar |
|
742 |
} |
|
743 |
break; |
|
744 |
case QStyle::PM_ScrollBarSliderMin: |
|
745 |
{ |
|
746 |
TAknLayoutRect listScrollPane; |
|
747 |
listScrollPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0)); |
|
748 |
TAknLayoutRect scrollPane; |
|
749 |
scrollPane.LayoutRect( listScrollPane.Rect(), AknLayoutScalable_Avkon::scroll_pane()); |
|
750 |
TAknLayoutRect scrollHandlePane; |
|
751 |
scrollHandlePane.LayoutRect( scrollPane.Rect(), AknLayoutScalable_Avkon::scroll_handle_pane()); |
|
752 |
TAknLayoutRect aidMinSizePane; |
|
753 |
aidMinSizePane.LayoutRect( scrollHandlePane.Rect(), AknLayoutScalable_Avkon::aid_size_min_handle()); // this gives min width size for horizontal scroll bar - same can be used for vertical height minimum |
|
754 |
value = aidMinSizePane.Rect().Height(); |
|
755 |
} |
|
756 |
break; |
|
757 |
case QStyle::PM_MenuBarPanelWidth: |
|
758 |
{ |
|
759 |
TAknLayoutRect appWindow; |
|
760 |
appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); |
|
761 |
||
762 |
variety = 0; |
|
763 |
if ( landscape ) |
|
764 |
{ |
|
765 |
variety = 2; |
|
766 |
} |
|
767 |
TAknLayoutRect areaBottomRect; |
|
768 |
areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); |
|
769 |
||
770 |
// todo: prt: variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) |
|
771 |
// todo: lsc: variety 6 if thin status pane |
|
772 |
// todo: should stacon be considered? |
|
773 |
TAknLayoutRect controlPaneRect; |
|
774 |
controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); |
|
775 |
value = areaBottomRect.Rect().Height() - controlPaneRect.Rect().Height(); //usually zero |
|
776 |
} |
|
777 |
break; |
|
778 |
case QStyle::PM_ProgressBarChunkWidth: |
|
779 |
{ |
|
780 |
// This is either deduced or skinned (for Java) in S60 |
|
781 |
// Layout data does not know it. It would require parameters from the |
|
782 |
// actual progress dialog to be able to calc this (max. value and increment) |
|
783 |
// So we need to set up some values - lets take one tenth of progress dialog area: |
|
784 |
TAknLayoutRect appWindow; |
|
785 |
appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(variety) ); |
|
786 |
if (landscape) |
|
787 |
{ |
|
788 |
variety = 6; |
|
789 |
} |
|
790 |
TAknLayoutRect popupWaitWindowRect; |
|
791 |
popupWaitWindowRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_wait_window(variety) ); |
|
792 |
TAknLayoutRect waitbarPaneRect; |
|
793 |
waitbarPaneRect.LayoutRect( popupWaitWindowRect.Rect(), AknLayoutScalable_Avkon::wait_bar_pane(0) ); |
|
794 |
TAknLayoutRect waitAnimRect; |
|
795 |
waitAnimRect.LayoutRect( waitbarPaneRect.Rect(), AknLayoutScalable_Avkon::wait_anim_pane() ); |
|
796 |
value = (TInt) (waitAnimRect.Rect().Width() / 10); |
|
797 |
} |
|
798 |
break; |
|
799 |
case QStyle::PM_TabBarTabOverlap: |
|
800 |
case QStyle::PM_TabBarTabHSpace: |
|
801 |
case QStyle::PM_TabBarTabVSpace: |
|
802 |
case QStyle::PM_TabBarBaseHeight: |
|
803 |
case QStyle::PM_TabBarBaseOverlap: |
|
804 |
case QStyle::PM_TabBarScrollButtonWidth: |
|
805 |
case QStyle::PM_TabBarTabShiftHorizontal: |
|
806 |
case QStyle::PM_TabBarTabShiftVertical: |
|
807 |
value = PixelMetricTabValue(metric, appWindow.Rect(), landscape); |
|
808 |
break; |
|
809 |
case QStyle::PM_MenuPanelWidth: |
|
810 |
case QStyle::PM_MenuHMargin: |
|
811 |
case QStyle::PM_MenuVMargin: |
|
812 |
value = PixelMetricMenuValue(metric, mainPaneRect); |
|
813 |
break; |
|
814 |
case QStyle::PM_ButtonIconSize: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
815 |
{ |
0 | 816 |
//lets use voice recorder icons as a base |
817 |
//Unfortunately S60 graphics don't separate button bevel graphics from the actual icon. |
|
818 |
//Se we have no means to query the margin from bevel border to "central icon" border. |
|
819 |
//So, we need to make a estimate... |
|
820 |
||
821 |
TAknLayoutRect vRMainRect; |
|
822 |
vRMainRect.LayoutRect( mainPaneRect, AknLayoutScalable_Apps::main_vorec_pane() ); |
|
823 |
||
824 |
TAknLayoutRect vRButtonGridRect; |
|
825 |
vRButtonGridRect.LayoutRect( vRMainRect.Rect(), AknLayoutScalable_Apps::grid_vorec_pane() ); |
|
826 |
||
827 |
TAknLayoutRect vRButtonCellRect; |
|
828 |
vRButtonCellRect.LayoutRect( vRButtonGridRect.Rect(), AknLayoutScalable_Apps::cell_vorec_pane(0) ); |
|
829 |
||
830 |
TAknLayoutRect vRButtonCellGraphicsRect; |
|
831 |
vRButtonCellGraphicsRect.LayoutRect( vRButtonCellRect.Rect(), AknLayoutScalable_Apps::cell_vorec_pane_g1() ); |
|
832 |
||
833 |
// 0.32 is the estimate how much the icon occupies of the button bevel area |
|
834 |
value = vRButtonCellGraphicsRect.Rect().Width() * 0.32; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
835 |
} |
0 | 836 |
break; |
837 |
case QStyle::PM_SmallIconSize: |
|
838 |
{ |
|
839 |
// lets use AI2 icon as a base |
|
840 |
TAknLayoutRect idlePaneRect; |
|
841 |
idlePaneRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::main_idle_act2_pane() ); |
|
842 |
TAknLayoutRect idleDataRect; |
|
843 |
idleDataRect.LayoutRect( idlePaneRect.Rect(), AknLayoutScalable_Avkon::popup_ai2_data_window(1) ); |
|
844 |
TAknLayoutRect ai2GridRect; |
|
845 |
ai2GridRect.LayoutRect( idleDataRect.Rect(), AknLayoutScalable_Avkon::grid_ai2_button_pane() ); |
|
846 |
TAknLayoutRect ai2MpRect; |
|
847 |
ai2MpRect.LayoutRect( ai2GridRect.Rect(), AknLayoutScalable_Avkon::ai2_mp_button_pane() ); |
|
848 |
TAknLayoutRect ai2CellPaneRect; |
|
849 |
ai2CellPaneRect.LayoutRect( ai2MpRect.Rect(), AknLayoutScalable_Avkon::cell_ai2_button_pane(1).LayoutLine() ); |
|
850 |
TAknLayoutRect ai2CellButtonRect; |
|
851 |
ai2CellButtonRect.LayoutRect( ai2CellPaneRect.Rect(), AknLayoutScalable_Avkon::cell_ai2_button_pane_g1()); |
|
852 |
value = Min( ai2CellButtonRect.Rect().Width(), ai2CellButtonRect.Rect().Height()); |
|
853 |
} |
|
854 |
break; |
|
855 |
case QStyle::PM_FocusFrameHMargin: |
|
856 |
case QStyle::PM_FocusFrameVMargin: |
|
857 |
{ |
|
858 |
TAknLayoutRect gridRect; |
|
859 |
gridRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::grid_highlight_pane(0)); |
|
860 |
TAknLayoutRect gridRectCenter; |
|
861 |
gridRectCenter.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::cell_highlight_pane_g1()); |
|
862 |
||
863 |
// The difference of center piece from border tell the frame width. |
|
864 |
if ( value == QStyle::PM_FocusFrameHMargin) |
|
865 |
{ |
|
866 |
value = gridRect.Rect().iBr.iX - gridRectCenter.Rect().iBr.iX; |
|
867 |
} |
|
868 |
else |
|
869 |
{ |
|
870 |
value = gridRect.Rect().iBr.iY - gridRectCenter.Rect().iBr.iY; |
|
871 |
} |
|
872 |
} |
|
873 |
break; |
|
874 |
case QStyle::PM_ToolBarIconSize: |
|
875 |
{ |
|
876 |
TAknLayoutRect popupToolBarWindow; |
|
877 |
variety = 4; |
|
878 |
popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); |
|
879 |
TAknLayoutRect gridToolBarRect; |
|
880 |
gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); |
|
881 |
TAknLayoutRect cellToolBarRect1; |
|
882 |
TAknLayoutRect cellToolBarRect2; |
|
883 |
cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item |
|
884 |
value = Min( cellToolBarRect1.Rect().Height(), cellToolBarRect1.Rect().Width() ); |
|
885 |
} |
|
886 |
break; |
|
887 |
||
888 |
case QStyle::PM_TitleBarHeight: // use titlepane height |
|
889 |
{ |
|
890 |
TAknLayoutRect statusPaneRect; |
|
891 |
TAknLayoutRect titlePane; |
|
892 |
TAknLayoutRect areaTopRect; |
|
893 |
if (landscape) |
|
894 |
{ |
|
895 |
if ( AknLayoutUtils::PenEnabled() ) |
|
896 |
{ |
|
897 |
// Top area - 0 is for classic landscape (used in touch landscape as well) |
|
898 |
areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(2) ); |
|
899 |
// Status pane - 0 softkeys on right |
|
900 |
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() ); |
|
901 |
} |
|
902 |
else |
|
903 |
{ |
|
904 |
// Top area - 2 is for classic landscape. |
|
905 |
areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(2) ); |
|
906 |
// Stacon top pane (default ok) |
|
907 |
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() ); |
|
908 |
} |
|
909 |
titlePane.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::title_pane_stacon(0) ); //softkeys on right |
|
910 |
} |
|
911 |
else |
|
912 |
{ |
|
913 |
// Top area - 0 is for classic portrait |
|
914 |
areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(0) ); |
|
915 |
// Status pane - 0 is for classic portrait |
|
916 |
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) ); |
|
917 |
titlePane.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::title_pane(0) ); |
|
918 |
} |
|
919 |
value = titlePane.Rect().Height(); |
|
920 |
} |
|
921 |
break; |
|
922 |
case QStyle::PM_IndicatorWidth: |
|
923 |
case QStyle::PM_IndicatorHeight: |
|
924 |
{ |
|
925 |
TRect rectParent( mainPaneRect ); |
|
926 |
||
927 |
TAknLayoutRect layoutRect; |
|
928 |
layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::set_content_pane().LayoutLine() ); |
|
929 |
TAknLayoutRect layoutRect2; |
|
930 |
layoutRect2.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Avkon::list_set_graphic_pane(0).LayoutLine() ); |
|
931 |
||
932 |
TAknLayoutRect iconLayoutRect; |
|
933 |
iconLayoutRect.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_g1(0).LayoutLine() ); |
|
934 |
if (metric==QStyle::PM_IndicatorWidth) |
|
935 |
{ |
|
936 |
value = iconLayoutRect.Rect().Width(); |
|
937 |
} |
|
938 |
else |
|
939 |
{ |
|
940 |
value = iconLayoutRect.Rect().Height(); |
|
941 |
} |
|
942 |
} |
|
943 |
break; |
|
944 |
case QStyle::PM_ExclusiveIndicatorHeight: |
|
945 |
case QStyle::PM_ExclusiveIndicatorWidth: |
|
946 |
{ |
|
947 |
TRect rectParent( mainPaneRect ); |
|
948 |
TAknLayoutRect layoutRect; |
|
949 |
layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar |
|
950 |
TAknLayoutText itemText; |
|
951 |
itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) ); |
|
952 |
TAknLayoutRect iconLayoutRect; |
|
953 |
iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() ); |
|
954 |
||
955 |
if (metric==QStyle::PM_ExclusiveIndicatorHeight) |
|
956 |
{ |
|
957 |
value = iconLayoutRect.Rect().Height(); |
|
958 |
} |
|
959 |
else |
|
960 |
{ |
|
961 |
value = iconLayoutRect.Rect().Width(); |
|
962 |
} |
|
963 |
} |
|
964 |
break; |
|
965 |
||
966 |
// These are obsolete. |
|
967 |
case QStyle::PM_DefaultTopLevelMargin: |
|
968 |
case QStyle::PM_DefaultChildMargin: |
|
969 |
case QStyle::PM_DefaultLayoutSpacing: |
|
970 |
break; |
|
971 |
||
972 |
case QStyle::PM_Custom_FrameCornerWidth: |
|
973 |
{ |
|
974 |
TAknLayoutRect inputFocusRect; |
|
975 |
inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0)); |
|
976 |
TAknLayoutRect inputFocusInnerRect; |
|
977 |
inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1()); |
|
978 |
||
979 |
value = inputFocusRect.Rect().iBr.iX - inputFocusInnerRect.Rect().iBr.iX; |
|
980 |
value+= 2; //visually better value for generic cases |
|
981 |
} |
|
982 |
break; |
|
983 |
case QStyle::PM_Custom_FrameCornerHeight: |
|
984 |
{ |
|
985 |
TAknLayoutRect inputFocusRect; |
|
986 |
inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0)); |
|
987 |
TAknLayoutRect inputFocusInnerRect; |
|
988 |
inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1()); |
|
989 |
value = inputFocusRect.Rect().iBr.iY - inputFocusInnerRect.Rect().iBr.iY; |
|
990 |
value+= 2; //visually better value for generic cases |
|
991 |
} |
|
992 |
break; |
|
993 |
case QStyle::PM_Custom_BoldLineWidth: |
|
994 |
value = 3; |
|
995 |
break; |
|
996 |
case QStyle::PM_Custom_ThinLineWidth: |
|
997 |
value = 1; |
|
998 |
break; |
|
999 |
case QStyle::PM_ButtonShiftHorizontal: |
|
1000 |
case QStyle::PM_ButtonShiftVertical: |
|
1001 |
value = 0; |
|
1002 |
break; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1003 |
|
0 | 1004 |
case QStyle::PM_ToolBarExtensionExtent: |
1005 |
value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape); |
|
1006 |
break; |
|
1007 |
||
1008 |
// todo: re-check if these really are not available in s60 |
|
1009 |
case QStyle::PM_MenuDesktopFrameWidth: // not needed in S60 - dislocates Menu both horizontally and vertically |
|
1010 |
case QStyle::PM_HeaderMarkSize: // The size of the sort indicator in a header. Not in S60 |
|
1011 |
case QStyle::PM_SpinBoxSliderHeight: // The height of the optional spin box slider. Not in S60 |
|
1012 |
case QStyle::PM_HeaderMargin: // not in S60 |
|
1013 |
case QStyle::PM_MenuScrollerHeight: // not in S60 |
|
1014 |
case QStyle::PM_MenuTearoffHeight: // not in S60 |
|
1015 |
case QStyle::PM_DockWidgetFrameWidth: // not in S60 |
|
1016 |
case QStyle::PM_DockWidgetSeparatorExtent: // not in S60 |
|
1017 |
case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60 |
|
1018 |
case QStyle::PM_HeaderGripMargin: // not in S60 |
|
1019 |
case QStyle::PM_ToolBarSeparatorExtent: // not in S60 |
|
1020 |
case QStyle::PM_ToolBarHandleExtent: // not in s60 |
|
1021 |
case QStyle::PM_MenuButtonIndicator: // none??? |
|
1022 |
case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together |
|
1023 |
case QStyle::PM_SizeGripSize: // use default |
|
1024 |
case QStyle::PM_TabCloseIndicatorWidth: |
|
1025 |
case QStyle::PM_TabCloseIndicatorHeight: |
|
1026 |
case QStyle::PM_ScrollView_ScrollBarSpacing: |
|
1027 |
case QStyle::PM_SubMenuOverlap: |
|
1028 |
default: |
|
1029 |
break; |
|
1030 |
} |
|
1031 |
return value; |
|
1032 |
} |
|
1033 |
||
1034 |
TInt PixelMetrics::PixelMetricTabValue(QStyle::PixelMetric tabMetric, TRect appWindow, TBool landscape) |
|
1035 |
{ |
|
1036 |
TInt tabValue = 0; |
|
1037 |
// common ones |
|
1038 |
TAknLayoutRect mainAreaRect; |
|
1039 |
TAknLayoutRect rightIndicationRect; |
|
1040 |
TAknLayoutRect leftIndicationRect; |
|
1041 |
TAknLayoutRect activeTabRect; |
|
1042 |
TAknLayoutText activeTabTextRect; |
|
1043 |
TAknLayoutRect passiveTabRect; |
|
1044 |
TAknLayoutText passiveTabTextRect; |
|
1045 |
TAknLayoutRect tabsPaneRect; |
|
1046 |
if ( landscape ) |
|
1047 |
{ |
|
1048 |
TAknLayoutRect statusPaneRect; |
|
1049 |
TAknLayoutRect areaTopRect; |
|
1050 |
if ( AknLayoutUtils::PenEnabled() ) |
|
1051 |
{ |
|
1052 |
// Top area - 0 is for classic landscape (used in touch landscape as well) |
|
1053 |
areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(2) ); |
|
1054 |
// Status pane - 0 softkeys on right |
|
1055 |
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() ); |
|
1056 |
} |
|
1057 |
else |
|
1058 |
{ |
|
1059 |
// Top area - 2 is for classic landscape. |
|
1060 |
areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_bottom_pane(2) ); |
|
1061 |
// Stacon top pane (default ok) |
|
1062 |
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() ); |
|
1063 |
} |
|
1064 |
// main pane for landscape |
|
1065 |
mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(4) ); |
|
1066 |
||
1067 |
// navi pane |
|
1068 |
TAknLayoutRect naviPaneRect; |
|
1069 |
naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane_stacon(0) ); // softkeys on right |
|
1070 |
// navi-navi pane |
|
1071 |
tabsPaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_stacon(0) ); // softkeys on right |
|
1072 |
// Passive tab item - lets use layout where active is on left side of passive |
|
1073 |
passiveTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) ); |
|
1074 |
// Active tab item |
|
1075 |
activeTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) ); |
|
1076 |
// Left indication |
|
1077 |
leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) ); |
|
1078 |
// Right indication |
|
1079 |
rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) ); |
|
1080 |
// active tab text rect |
|
1081 |
activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(1) ); |
|
1082 |
// passive tab text rect |
|
1083 |
passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(1) ); |
|
1084 |
} |
|
1085 |
else |
|
1086 |
{ |
|
1087 |
// main pane for portait |
|
1088 |
mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(3) ); |
|
1089 |
// Top area - 0 is for classic portrait |
|
1090 |
TAknLayoutRect areaTopRect; |
|
1091 |
areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(0) ); |
|
1092 |
// Status pane - 0 is for classic portrait |
|
1093 |
TAknLayoutRect statusPaneRect; |
|
1094 |
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) ); |
|
1095 |
||
1096 |
// Navi pane |
|
1097 |
TAknLayoutRect naviPaneRect; |
|
1098 |
naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane(0) ); |
|
1099 |
// Navi-navi pane for tabs (0) |
|
1100 |
TAknLayoutRect navi2PaneRect; |
|
1101 |
navi2PaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane() ); |
|
1102 |
// Short tab pane |
|
1103 |
tabsPaneRect.LayoutRect( navi2PaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_tabs_pane() ); |
|
1104 |
// Tab pane for 2 items |
|
1105 |
TAknLayoutRect tab2PaneRect; |
|
1106 |
tab2PaneRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane() ); |
|
1107 |
// Passive tab item - lets use layout where active is on left side of passive |
|
1108 |
passiveTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) ); |
|
1109 |
// Active tab item |
|
1110 |
activeTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) ); |
|
1111 |
// Left indication |
|
1112 |
leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) ); |
|
1113 |
// Right indication |
|
1114 |
rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) ); |
|
1115 |
// active tab text rect |
|
1116 |
activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(0) ); |
|
1117 |
// passive tab text rect |
|
1118 |
passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(0) ); |
|
1119 |
} |
|
1120 |
||
1121 |
// active tab on left, passive on rightside |
|
1122 |
TInt tabOverlap = activeTabRect.Rect().iBr.iX - passiveTabRect.Rect().iTl.iX; |
|
1123 |
TInt tabHSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iX - activeTabRect.Rect().iTl.iX + activeTabRect.Rect().iBr.iX - activeTabTextRect.TextRect().iBr.iX)/2); |
|
1124 |
TInt tabVSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iY - activeTabRect.Rect().iTl.iY + activeTabRect.Rect().iBr.iY - activeTabTextRect.TextRect().iBr.iY)/2); |
|
1125 |
TInt tabBaseHeight = 0; |
|
1126 |
if ( landscape && !AknLayoutUtils::PenEnabled()) |
|
1127 |
{ |
|
1128 |
// In landscape tab is below mainpane |
|
1129 |
tabBaseHeight = mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY; |
|
1130 |
} |
|
1131 |
else |
|
1132 |
{ |
|
1133 |
// In portrait (and in landscape touch) tab is above mainpane |
|
1134 |
tabBaseHeight = tabsPaneRect.Rect().iBr.iY - mainAreaRect.Rect().iTl.iY; |
|
1135 |
} |
|
1136 |
TInt tabBaseOverlap = 0; |
|
1137 |
if ( landscape && !AknLayoutUtils::PenEnabled()) |
|
1138 |
{ |
|
1139 |
// In landscape tab is below mainpane |
|
1140 |
tabBaseOverlap = Max( 0, mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY); |
|
1141 |
} |
|
1142 |
else |
|
1143 |
{ |
|
1144 |
// In portrait tab is above mainpane |
|
1145 |
tabBaseOverlap = Max( 0, mainAreaRect.Rect().iTl.iY - tabsPaneRect.Rect().iBr.iY); |
|
1146 |
} |
|
1147 |
TInt tabButtonWidth = Max(leftIndicationRect.Rect().Width(), rightIndicationRect.Rect().Width()); |
|
1148 |
TInt tabVShift = Max( Abs(activeTabTextRect.TextRect().iBr.iY - passiveTabTextRect.TextRect().iBr.iY), Abs(activeTabTextRect.TextRect().iTl.iY - passiveTabTextRect.TextRect().iTl.iY) ); |
|
1149 |
TInt tabHShift = Max( Abs(activeTabTextRect.TextRect().iBr.iX - passiveTabTextRect.TextRect().iBr.iX), Abs(activeTabTextRect.TextRect().iTl.iX - passiveTabTextRect.TextRect().iTl.iX) ); |
|
1150 |
tabHShift -= (passiveTabRect.Rect().Width() - tabOverlap); // remove tab change and add overlapping area |
|
1151 |
||
1152 |
switch( tabMetric ) |
|
1153 |
{ |
|
1154 |
case QStyle::PM_TabBarTabOverlap: |
|
1155 |
tabValue = tabOverlap; |
|
1156 |
break; |
|
1157 |
case QStyle::PM_TabBarTabHSpace: |
|
1158 |
tabValue = tabHSpace; |
|
1159 |
break; |
|
1160 |
case QStyle::PM_TabBarTabVSpace: |
|
1161 |
tabValue = tabVSpace; |
|
1162 |
break; |
|
1163 |
case QStyle::PM_TabBarBaseHeight: |
|
1164 |
tabValue = tabBaseHeight; |
|
1165 |
break; |
|
1166 |
case QStyle::PM_TabBarBaseOverlap: |
|
1167 |
tabValue = tabBaseOverlap; |
|
1168 |
break; |
|
1169 |
case QStyle::PM_TabBarScrollButtonWidth: |
|
1170 |
// Since in Qt the scroll indicator is shown within a button, we need to add button margins to this value |
|
1171 |
{ |
|
1172 |
tabValue = tabButtonWidth + 2*PixelMetricValue(QStyle::PM_ButtonMargin); |
|
1173 |
} |
|
1174 |
break; |
|
1175 |
case QStyle::PM_TabBarTabShiftHorizontal: |
|
1176 |
tabValue = tabHShift; |
|
1177 |
break; |
|
1178 |
case QStyle::PM_TabBarTabShiftVertical: |
|
1179 |
tabValue = tabVShift; |
|
1180 |
break; |
|
1181 |
default: |
|
1182 |
break; |
|
1183 |
} |
|
1184 |
return tabValue; |
|
1185 |
} |
|
1186 |
||
1187 |
TInt PixelMetrics::PixelMetricMenuValue(QStyle::PixelMetric tabMetric, TRect mainPaneRect ) |
|
1188 |
{ |
|
1189 |
TInt menuValue = 0; |
|
1190 |
TAknLayoutRect popupMenuRect; |
|
1191 |
popupMenuRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_menu_window(0) ); |
|
1192 |
TAknLayoutRect listScrollPaneRect; |
|
1193 |
listScrollPaneRect.LayoutRect( popupMenuRect.Rect(), AknLayoutScalable_Avkon::listscroll_menu_pane(0) ); |
|
1194 |
TAknLayoutRect listMenuPaneRect; |
|
1195 |
listMenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_menu_pane(0) ); |
|
1196 |
TAknLayoutRect listMenuRow1Rect; |
|
1197 |
listMenuRow1Rect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_single_pane_cp2(0)); |
|
1198 |
||
1199 |
switch (tabMetric) |
|
1200 |
{ |
|
1201 |
case QStyle::PM_MenuPanelWidth: |
|
1202 |
menuValue = listMenuPaneRect.Rect().iTl.iX - listScrollPaneRect.Rect().iTl.iX; |
|
1203 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
1204 |
{ |
|
1205 |
menuValue = listScrollPaneRect.Rect().iBr.iX - listMenuPaneRect.Rect().iBr.iX; |
|
1206 |
} |
|
1207 |
break; |
|
1208 |
case QStyle::PM_MenuHMargin: |
|
1209 |
menuValue = listMenuRow1Rect.Rect().iTl.iX - popupMenuRect.Rect().iTl.iX; |
|
1210 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
1211 |
{ |
|
1212 |
menuValue = popupMenuRect.Rect().iBr.iX - listMenuRow1Rect.Rect().iBr.iX; |
|
1213 |
} |
|
1214 |
break; |
|
1215 |
case QStyle::PM_MenuVMargin: |
|
1216 |
menuValue = listMenuRow1Rect.Rect().iTl.iY - popupMenuRect.Rect().iTl.iY; |
|
1217 |
break; |
|
1218 |
default: |
|
1219 |
break; |
|
1220 |
} |
|
1221 |
return menuValue; |
|
1222 |
} |