util/s60pixelmetrics/pixel_metrics.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the utility applications of the Qt Toolkit.
     7 ** This file is part of the utility applications of the Qt Toolkit.
     8 **
     8 **
    48 
    48 
    49 // Version number for dynamic calculations. These are to be exported to static data,
    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.
    50 // so that we can keep dynamic and static values inline.
    51 // Please adjust version data if correcting dynamic PM calculations.
    51 // Please adjust version data if correcting dynamic PM calculations.
    52 const TInt KPMMajorVersion = 1;
    52 const TInt KPMMajorVersion = 1;
    53 const TInt KPMMinorVersion = 15;
    53 const TInt KPMMinorVersion = 17;
    54 
    54 
    55 TPixelMetricsVersion PixelMetrics::Version()
    55 TPixelMetricsVersion PixelMetrics::Version()
    56     {
    56     {
    57     TPixelMetricsVersion version;
    57     TPixelMetricsVersion version;
    58     version.majorVersion = KPMMajorVersion;
    58     version.majorVersion = KPMMajorVersion;
   853             }
   853             }
   854             break;
   854             break;
   855         case QStyle::PM_FocusFrameHMargin:
   855         case QStyle::PM_FocusFrameHMargin:
   856         case QStyle::PM_FocusFrameVMargin:
   856         case QStyle::PM_FocusFrameVMargin:
   857             {
   857             {
   858             TAknLayoutRect gridRect;
   858             TAknLayoutRect listScrollPane;
   859             gridRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::grid_highlight_pane(0));
   859             listScrollPane.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0));
   860             TAknLayoutRect gridRectCenter;
   860             TAknLayoutRect listGenPane;
   861             gridRectCenter.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::cell_highlight_pane_g1());
   861             listGenPane.LayoutRect(listScrollPane.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0));
       
   862             TAknLayoutRect listSinglePane;
       
   863             listSinglePane.LayoutRect(listGenPane.Rect(), AknLayoutScalable_Avkon::list_single_pane(0));
       
   864             TAknLayoutText listSinglePaneText;
       
   865             listSinglePaneText.LayoutText(listSinglePane.Rect(), AknLayoutScalable_Avkon::list_single_pane_t1(0));
       
   866             TAknLayoutRect highlightRect;
       
   867             highlightRect.LayoutRect(listSinglePane.Rect(), AknLayoutScalable_Avkon::list_highlight_pane_cp1().LayoutLine());
   862 
   868 
   863             // The difference of center piece from border tell the frame width.
   869             // The difference of center piece from border tell the frame width.
   864             if ( value == QStyle::PM_FocusFrameHMargin)
   870             if ( value == QStyle::PM_FocusFrameHMargin)
   865                 {
   871                 {
   866                 value = gridRect.Rect().iBr.iX - gridRectCenter.Rect().iBr.iX;
   872                  //use topleft for horizontal as S60 uses different values for right and left borders
       
   873                  value = listSinglePaneText.TextRect().iTl.iX - highlightRect.Rect().iTl.iX;
   867                 }
   874                 }
   868             else
   875             else
   869                 {
   876                 {
   870                 value = gridRect.Rect().iBr.iY - gridRectCenter.Rect().iBr.iY;
   877                  value = highlightRect.Rect().iBr.iY - listSinglePaneText.TextRect().iBr.iY;
   871                 }
   878                 }
   872             }
   879             }
   873             break;
   880             break;
   874         case QStyle::PM_ToolBarIconSize:
   881         case QStyle::PM_ToolBarIconSize:
   875             {
   882             {
   994             value = 3;
  1001             value = 3;
   995             break;
  1002             break;
   996         case QStyle::PM_Custom_ThinLineWidth:
  1003         case QStyle::PM_Custom_ThinLineWidth:
   997             value = 1;
  1004             value = 1;
   998             break;
  1005             break;
       
  1006         case QStyle::PM_Custom_MessageBoxHeight:
       
  1007             {
       
  1008             TAknLayoutRect popupRect;
       
  1009             popupRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::popup_window_general(0));
       
  1010             value = popupRect.Rect().Height();
       
  1011             }
       
  1012             break;
   999         case QStyle::PM_ButtonShiftHorizontal:
  1013         case QStyle::PM_ButtonShiftHorizontal:
  1000         case QStyle::PM_ButtonShiftVertical:
  1014         case QStyle::PM_ButtonShiftVertical:
  1001             value = 0;
  1015             value = 0;
  1002             break;
  1016             break;
  1003 
  1017 
  1004         case QStyle::PM_ToolBarExtensionExtent:
  1018         case QStyle::PM_ToolBarExtensionExtent:
  1005             value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape);
  1019             value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape);
       
  1020             break;
       
  1021 
       
  1022         case QStyle::PM_MenuScrollerHeight:
       
  1023             value = 0;
  1006             break;
  1024             break;
  1007 
  1025 
  1008 // todo: re-check if these really are not available in s60
  1026 // 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
  1027         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
  1028         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
  1029         case QStyle::PM_SpinBoxSliderHeight:       // The height of the optional spin box slider. Not in S60
  1012         case QStyle::PM_HeaderMargin: // not in S60
  1030         case QStyle::PM_HeaderMargin: // not in S60
  1013         case QStyle::PM_MenuScrollerHeight: // not in S60
       
  1014         case QStyle::PM_MenuTearoffHeight: // not in S60
  1031         case QStyle::PM_MenuTearoffHeight: // not in S60
  1015         case QStyle::PM_DockWidgetFrameWidth: // not in S60
  1032         case QStyle::PM_DockWidgetFrameWidth: // not in S60
  1016         case QStyle::PM_DockWidgetSeparatorExtent: // not in S60
  1033         case QStyle::PM_DockWidgetSeparatorExtent: // not in S60
  1017         case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60
  1034         case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60
  1018         case QStyle::PM_HeaderGripMargin: // not in S60
  1035         case QStyle::PM_HeaderGripMargin: // not in S60