0
+ − 1
/****************************************************************************
+ − 2
**
18
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 3
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
0
+ − 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;
19
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 53
const TInt KPMMinorVersion = 17;
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
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
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
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
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
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
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
{
18
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 858
TAknLayoutRect listScrollPane;
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 859
listScrollPane.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0));
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 860
TAknLayoutRect listGenPane;
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 861
listGenPane.LayoutRect(listScrollPane.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0));
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 862
TAknLayoutRect listSinglePane;
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 863
listSinglePane.LayoutRect(listGenPane.Rect(), AknLayoutScalable_Avkon::list_single_pane(0));
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 864
TAknLayoutText listSinglePaneText;
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 865
listSinglePaneText.LayoutText(listSinglePane.Rect(), AknLayoutScalable_Avkon::list_single_pane_t1(0));
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 866
TAknLayoutRect highlightRect;
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 867
highlightRect.LayoutRect(listSinglePane.Rect(), AknLayoutScalable_Avkon::list_highlight_pane_cp1().LayoutLine());
0
+ − 868
+ − 869
// The difference of center piece from border tell the frame width.
+ − 870
if ( value == QStyle::PM_FocusFrameHMargin)
+ − 871
{
19
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 872
//use topleft for horizontal as S60 uses different values for right and left borders
18
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 873
value = listSinglePaneText.TextRect().iTl.iX - highlightRect.Rect().iTl.iX;
0
+ − 874
}
+ − 875
else
+ − 876
{
18
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 877
value = highlightRect.Rect().iBr.iY - listSinglePaneText.TextRect().iBr.iY;
0
+ − 878
}
+ − 879
}
+ − 880
break;
+ − 881
case QStyle::PM_ToolBarIconSize:
+ − 882
{
+ − 883
TAknLayoutRect popupToolBarWindow;
+ − 884
variety = 4;
+ − 885
popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) );
+ − 886
TAknLayoutRect gridToolBarRect;
+ − 887
gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() );
+ − 888
TAknLayoutRect cellToolBarRect1;
+ − 889
TAknLayoutRect cellToolBarRect2;
+ − 890
cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item
+ − 891
value = Min( cellToolBarRect1.Rect().Height(), cellToolBarRect1.Rect().Width() );
+ − 892
}
+ − 893
break;
+ − 894
+ − 895
case QStyle::PM_TitleBarHeight: // use titlepane height
+ − 896
{
+ − 897
TAknLayoutRect statusPaneRect;
+ − 898
TAknLayoutRect titlePane;
+ − 899
TAknLayoutRect areaTopRect;
+ − 900
if (landscape)
+ − 901
{
+ − 902
if ( AknLayoutUtils::PenEnabled() )
+ − 903
{
+ − 904
// Top area - 0 is for classic landscape (used in touch landscape as well)
+ − 905
areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(2) );
+ − 906
// Status pane - 0 softkeys on right
+ − 907
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() );
+ − 908
}
+ − 909
else
+ − 910
{
+ − 911
// Top area - 2 is for classic landscape.
+ − 912
areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(2) );
+ − 913
// Stacon top pane (default ok)
+ − 914
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() );
+ − 915
}
+ − 916
titlePane.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::title_pane_stacon(0) ); //softkeys on right
+ − 917
}
+ − 918
else
+ − 919
{
+ − 920
// Top area - 0 is for classic portrait
+ − 921
areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(0) );
+ − 922
// Status pane - 0 is for classic portrait
+ − 923
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) );
+ − 924
titlePane.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::title_pane(0) );
+ − 925
}
+ − 926
value = titlePane.Rect().Height();
+ − 927
}
+ − 928
break;
+ − 929
case QStyle::PM_IndicatorWidth:
+ − 930
case QStyle::PM_IndicatorHeight:
+ − 931
{
+ − 932
TRect rectParent( mainPaneRect );
+ − 933
+ − 934
TAknLayoutRect layoutRect;
+ − 935
layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::set_content_pane().LayoutLine() );
+ − 936
TAknLayoutRect layoutRect2;
+ − 937
layoutRect2.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Avkon::list_set_graphic_pane(0).LayoutLine() );
+ − 938
+ − 939
TAknLayoutRect iconLayoutRect;
+ − 940
iconLayoutRect.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_g1(0).LayoutLine() );
+ − 941
if (metric==QStyle::PM_IndicatorWidth)
+ − 942
{
+ − 943
value = iconLayoutRect.Rect().Width();
+ − 944
}
+ − 945
else
+ − 946
{
+ − 947
value = iconLayoutRect.Rect().Height();
+ − 948
}
+ − 949
}
+ − 950
break;
+ − 951
case QStyle::PM_ExclusiveIndicatorHeight:
+ − 952
case QStyle::PM_ExclusiveIndicatorWidth:
+ − 953
{
+ − 954
TRect rectParent( mainPaneRect );
+ − 955
TAknLayoutRect layoutRect;
+ − 956
layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar
+ − 957
TAknLayoutText itemText;
+ − 958
itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) );
+ − 959
TAknLayoutRect iconLayoutRect;
+ − 960
iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() );
+ − 961
+ − 962
if (metric==QStyle::PM_ExclusiveIndicatorHeight)
+ − 963
{
+ − 964
value = iconLayoutRect.Rect().Height();
+ − 965
}
+ − 966
else
+ − 967
{
+ − 968
value = iconLayoutRect.Rect().Width();
+ − 969
}
+ − 970
}
+ − 971
break;
+ − 972
+ − 973
// These are obsolete.
+ − 974
case QStyle::PM_DefaultTopLevelMargin:
+ − 975
case QStyle::PM_DefaultChildMargin:
+ − 976
case QStyle::PM_DefaultLayoutSpacing:
+ − 977
break;
+ − 978
+ − 979
case QStyle::PM_Custom_FrameCornerWidth:
+ − 980
{
+ − 981
TAknLayoutRect inputFocusRect;
+ − 982
inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0));
+ − 983
TAknLayoutRect inputFocusInnerRect;
+ − 984
inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1());
+ − 985
+ − 986
value = inputFocusRect.Rect().iBr.iX - inputFocusInnerRect.Rect().iBr.iX;
+ − 987
value+= 2; //visually better value for generic cases
+ − 988
}
+ − 989
break;
+ − 990
case QStyle::PM_Custom_FrameCornerHeight:
+ − 991
{
+ − 992
TAknLayoutRect inputFocusRect;
+ − 993
inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0));
+ − 994
TAknLayoutRect inputFocusInnerRect;
+ − 995
inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1());
+ − 996
value = inputFocusRect.Rect().iBr.iY - inputFocusInnerRect.Rect().iBr.iY;
+ − 997
value+= 2; //visually better value for generic cases
+ − 998
}
+ − 999
break;
+ − 1000
case QStyle::PM_Custom_BoldLineWidth:
+ − 1001
value = 3;
+ − 1002
break;
+ − 1003
case QStyle::PM_Custom_ThinLineWidth:
+ − 1004
value = 1;
+ − 1005
break;
19
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1006
case QStyle::PM_Custom_MessageBoxHeight:
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1007
{
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1008
TAknLayoutRect popupRect;
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1009
popupRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::popup_window_general(0));
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1010
value = popupRect.Rect().Height();
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1011
}
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1012
break;
0
+ − 1013
case QStyle::PM_ButtonShiftHorizontal:
+ − 1014
case QStyle::PM_ButtonShiftVertical:
+ − 1015
value = 0;
+ − 1016
break;
3
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1017
0
+ − 1018
case QStyle::PM_ToolBarExtensionExtent:
+ − 1019
value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape);
+ − 1020
break;
+ − 1021
19
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1022
case QStyle::PM_MenuScrollerHeight:
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1023
value = 0;
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1024
break;
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
diff
changeset
+ − 1025
0
+ − 1026
// todo: re-check if these really are not available in s60
+ − 1027
case QStyle::PM_MenuDesktopFrameWidth: // not needed in S60 - dislocates Menu both horizontally and vertically
+ − 1028
case QStyle::PM_HeaderMarkSize: // The size of the sort indicator in a header. Not in S60
+ − 1029
case QStyle::PM_SpinBoxSliderHeight: // The height of the optional spin box slider. Not in S60
+ − 1030
case QStyle::PM_HeaderMargin: // not in S60
+ − 1031
case QStyle::PM_MenuTearoffHeight: // not in S60
+ − 1032
case QStyle::PM_DockWidgetFrameWidth: // not in S60
+ − 1033
case QStyle::PM_DockWidgetSeparatorExtent: // not in S60
+ − 1034
case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60
+ − 1035
case QStyle::PM_HeaderGripMargin: // not in S60
+ − 1036
case QStyle::PM_ToolBarSeparatorExtent: // not in S60
+ − 1037
case QStyle::PM_ToolBarHandleExtent: // not in s60
+ − 1038
case QStyle::PM_MenuButtonIndicator: // none???
+ − 1039
case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together
+ − 1040
case QStyle::PM_SizeGripSize: // use default
+ − 1041
case QStyle::PM_TabCloseIndicatorWidth:
+ − 1042
case QStyle::PM_TabCloseIndicatorHeight:
+ − 1043
case QStyle::PM_ScrollView_ScrollBarSpacing:
+ − 1044
case QStyle::PM_SubMenuOverlap:
+ − 1045
default:
+ − 1046
break;
+ − 1047
}
+ − 1048
return value;
+ − 1049
}
+ − 1050
+ − 1051
TInt PixelMetrics::PixelMetricTabValue(QStyle::PixelMetric tabMetric, TRect appWindow, TBool landscape)
+ − 1052
{
+ − 1053
TInt tabValue = 0;
+ − 1054
// common ones
+ − 1055
TAknLayoutRect mainAreaRect;
+ − 1056
TAknLayoutRect rightIndicationRect;
+ − 1057
TAknLayoutRect leftIndicationRect;
+ − 1058
TAknLayoutRect activeTabRect;
+ − 1059
TAknLayoutText activeTabTextRect;
+ − 1060
TAknLayoutRect passiveTabRect;
+ − 1061
TAknLayoutText passiveTabTextRect;
+ − 1062
TAknLayoutRect tabsPaneRect;
+ − 1063
if ( landscape )
+ − 1064
{
+ − 1065
TAknLayoutRect statusPaneRect;
+ − 1066
TAknLayoutRect areaTopRect;
+ − 1067
if ( AknLayoutUtils::PenEnabled() )
+ − 1068
{
+ − 1069
// Top area - 0 is for classic landscape (used in touch landscape as well)
+ − 1070
areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(2) );
+ − 1071
// Status pane - 0 softkeys on right
+ − 1072
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() );
+ − 1073
}
+ − 1074
else
+ − 1075
{
+ − 1076
// Top area - 2 is for classic landscape.
+ − 1077
areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_bottom_pane(2) );
+ − 1078
// Stacon top pane (default ok)
+ − 1079
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() );
+ − 1080
}
+ − 1081
// main pane for landscape
+ − 1082
mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(4) );
+ − 1083
+ − 1084
// navi pane
+ − 1085
TAknLayoutRect naviPaneRect;
+ − 1086
naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane_stacon(0) ); // softkeys on right
+ − 1087
// navi-navi pane
+ − 1088
tabsPaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_stacon(0) ); // softkeys on right
+ − 1089
// Passive tab item - lets use layout where active is on left side of passive
+ − 1090
passiveTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) );
+ − 1091
// Active tab item
+ − 1092
activeTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) );
+ − 1093
// Left indication
+ − 1094
leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) );
+ − 1095
// Right indication
+ − 1096
rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) );
+ − 1097
// active tab text rect
+ − 1098
activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(1) );
+ − 1099
// passive tab text rect
+ − 1100
passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(1) );
+ − 1101
}
+ − 1102
else
+ − 1103
{
+ − 1104
// main pane for portait
+ − 1105
mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(3) );
+ − 1106
// Top area - 0 is for classic portrait
+ − 1107
TAknLayoutRect areaTopRect;
+ − 1108
areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(0) );
+ − 1109
// Status pane - 0 is for classic portrait
+ − 1110
TAknLayoutRect statusPaneRect;
+ − 1111
statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) );
+ − 1112
+ − 1113
// Navi pane
+ − 1114
TAknLayoutRect naviPaneRect;
+ − 1115
naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane(0) );
+ − 1116
// Navi-navi pane for tabs (0)
+ − 1117
TAknLayoutRect navi2PaneRect;
+ − 1118
navi2PaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane() );
+ − 1119
// Short tab pane
+ − 1120
tabsPaneRect.LayoutRect( navi2PaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_tabs_pane() );
+ − 1121
// Tab pane for 2 items
+ − 1122
TAknLayoutRect tab2PaneRect;
+ − 1123
tab2PaneRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane() );
+ − 1124
// Passive tab item - lets use layout where active is on left side of passive
+ − 1125
passiveTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) );
+ − 1126
// Active tab item
+ − 1127
activeTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) );
+ − 1128
// Left indication
+ − 1129
leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) );
+ − 1130
// Right indication
+ − 1131
rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) );
+ − 1132
// active tab text rect
+ − 1133
activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(0) );
+ − 1134
// passive tab text rect
+ − 1135
passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(0) );
+ − 1136
}
+ − 1137
+ − 1138
// active tab on left, passive on rightside
+ − 1139
TInt tabOverlap = activeTabRect.Rect().iBr.iX - passiveTabRect.Rect().iTl.iX;
+ − 1140
TInt tabHSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iX - activeTabRect.Rect().iTl.iX + activeTabRect.Rect().iBr.iX - activeTabTextRect.TextRect().iBr.iX)/2);
+ − 1141
TInt tabVSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iY - activeTabRect.Rect().iTl.iY + activeTabRect.Rect().iBr.iY - activeTabTextRect.TextRect().iBr.iY)/2);
+ − 1142
TInt tabBaseHeight = 0;
+ − 1143
if ( landscape && !AknLayoutUtils::PenEnabled())
+ − 1144
{
+ − 1145
// In landscape tab is below mainpane
+ − 1146
tabBaseHeight = mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY;
+ − 1147
}
+ − 1148
else
+ − 1149
{
+ − 1150
// In portrait (and in landscape touch) tab is above mainpane
+ − 1151
tabBaseHeight = tabsPaneRect.Rect().iBr.iY - mainAreaRect.Rect().iTl.iY;
+ − 1152
}
+ − 1153
TInt tabBaseOverlap = 0;
+ − 1154
if ( landscape && !AknLayoutUtils::PenEnabled())
+ − 1155
{
+ − 1156
// In landscape tab is below mainpane
+ − 1157
tabBaseOverlap = Max( 0, mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY);
+ − 1158
}
+ − 1159
else
+ − 1160
{
+ − 1161
// In portrait tab is above mainpane
+ − 1162
tabBaseOverlap = Max( 0, mainAreaRect.Rect().iTl.iY - tabsPaneRect.Rect().iBr.iY);
+ − 1163
}
+ − 1164
TInt tabButtonWidth = Max(leftIndicationRect.Rect().Width(), rightIndicationRect.Rect().Width());
+ − 1165
TInt tabVShift = Max( Abs(activeTabTextRect.TextRect().iBr.iY - passiveTabTextRect.TextRect().iBr.iY), Abs(activeTabTextRect.TextRect().iTl.iY - passiveTabTextRect.TextRect().iTl.iY) );
+ − 1166
TInt tabHShift = Max( Abs(activeTabTextRect.TextRect().iBr.iX - passiveTabTextRect.TextRect().iBr.iX), Abs(activeTabTextRect.TextRect().iTl.iX - passiveTabTextRect.TextRect().iTl.iX) );
+ − 1167
tabHShift -= (passiveTabRect.Rect().Width() - tabOverlap); // remove tab change and add overlapping area
+ − 1168
+ − 1169
switch( tabMetric )
+ − 1170
{
+ − 1171
case QStyle::PM_TabBarTabOverlap:
+ − 1172
tabValue = tabOverlap;
+ − 1173
break;
+ − 1174
case QStyle::PM_TabBarTabHSpace:
+ − 1175
tabValue = tabHSpace;
+ − 1176
break;
+ − 1177
case QStyle::PM_TabBarTabVSpace:
+ − 1178
tabValue = tabVSpace;
+ − 1179
break;
+ − 1180
case QStyle::PM_TabBarBaseHeight:
+ − 1181
tabValue = tabBaseHeight;
+ − 1182
break;
+ − 1183
case QStyle::PM_TabBarBaseOverlap:
+ − 1184
tabValue = tabBaseOverlap;
+ − 1185
break;
+ − 1186
case QStyle::PM_TabBarScrollButtonWidth:
+ − 1187
// Since in Qt the scroll indicator is shown within a button, we need to add button margins to this value
+ − 1188
{
+ − 1189
tabValue = tabButtonWidth + 2*PixelMetricValue(QStyle::PM_ButtonMargin);
+ − 1190
}
+ − 1191
break;
+ − 1192
case QStyle::PM_TabBarTabShiftHorizontal:
+ − 1193
tabValue = tabHShift;
+ − 1194
break;
+ − 1195
case QStyle::PM_TabBarTabShiftVertical:
+ − 1196
tabValue = tabVShift;
+ − 1197
break;
+ − 1198
default:
+ − 1199
break;
+ − 1200
}
+ − 1201
return tabValue;
+ − 1202
}
+ − 1203
+ − 1204
TInt PixelMetrics::PixelMetricMenuValue(QStyle::PixelMetric tabMetric, TRect mainPaneRect )
+ − 1205
{
+ − 1206
TInt menuValue = 0;
+ − 1207
TAknLayoutRect popupMenuRect;
+ − 1208
popupMenuRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_menu_window(0) );
+ − 1209
TAknLayoutRect listScrollPaneRect;
+ − 1210
listScrollPaneRect.LayoutRect( popupMenuRect.Rect(), AknLayoutScalable_Avkon::listscroll_menu_pane(0) );
+ − 1211
TAknLayoutRect listMenuPaneRect;
+ − 1212
listMenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_menu_pane(0) );
+ − 1213
TAknLayoutRect listMenuRow1Rect;
+ − 1214
listMenuRow1Rect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_single_pane_cp2(0));
+ − 1215
+ − 1216
switch (tabMetric)
+ − 1217
{
+ − 1218
case QStyle::PM_MenuPanelWidth:
+ − 1219
menuValue = listMenuPaneRect.Rect().iTl.iX - listScrollPaneRect.Rect().iTl.iX;
+ − 1220
if ( AknLayoutUtils::LayoutMirrored() )
+ − 1221
{
+ − 1222
menuValue = listScrollPaneRect.Rect().iBr.iX - listMenuPaneRect.Rect().iBr.iX;
+ − 1223
}
+ − 1224
break;
+ − 1225
case QStyle::PM_MenuHMargin:
+ − 1226
menuValue = listMenuRow1Rect.Rect().iTl.iX - popupMenuRect.Rect().iTl.iX;
+ − 1227
if ( AknLayoutUtils::LayoutMirrored() )
+ − 1228
{
+ − 1229
menuValue = popupMenuRect.Rect().iBr.iX - listMenuRow1Rect.Rect().iBr.iX;
+ − 1230
}
+ − 1231
break;
+ − 1232
case QStyle::PM_MenuVMargin:
+ − 1233
menuValue = listMenuRow1Rect.Rect().iTl.iY - popupMenuRect.Rect().iTl.iY;
+ − 1234
break;
+ − 1235
default:
+ − 1236
break;
+ − 1237
}
+ − 1238
return menuValue;
+ − 1239
}