Updated nsLookAndFeel implementation - updated some of the native colors, make it compile also with Qt 4.3
authorpekka.vanhoja
Sat, 19 Apr 2008 19:07:20 +0300
changeset 16873 582e62adc0790f65719e7c9cd9a793614200a93b
parent 16872 0c8ccb5bb6f01849cedb93025a5a88261274666e
child 16874 89a5cfa2fb9c6e9ce871d13615e71ae72e6439c8
push id1298
push userpavlov@mozilla.com
push dateSun, 17 Aug 2008 05:03:09 +0000
treeherderautoland@4a506fa751d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0a1pre
Updated nsLookAndFeel implementation - updated some of the native colors, make it compile also with Qt 4.3
widget/src/qt/nsLookAndFeel.cpp
--- a/widget/src/qt/nsLookAndFeel.cpp
+++ b/widget/src/qt/nsLookAndFeel.cpp
@@ -37,16 +37,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsLookAndFeel.h"
 
 #include <QPalette>
 #include <QApplication>
 #include <QStyle>
+#include <qglobal.h>
 
 #undef NS_LOOKANDFEEL_DEBUG
 #ifdef NS_LOOKANDFEEL_DEBUG
 #include <QDebug>
 #endif
 
 #define QCOLOR_TO_NS_RGB(c) \
     ((nscolor)NS_RGB(c.red(),c.green(),c.blue()))
@@ -181,21 +182,29 @@ nsresult nsLookAndFeel::NativeGetColor(c
       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Window));
       break;
 
     case eColor_inactivecaptiontext:
       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Text));
       break;
 
     case eColor_infobackground:
+#if (QT_VERSION >= 440)
       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ToolTipBase));
+#else
+      aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Base));
+#endif
       break;
 
     case eColor_infotext:
+#if (QT_VERSION >= 440)
       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ToolTipText));
+#else
+      aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
+#endif
       break;
 
     case eColor_menu:
       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
       break;
 
     case eColor_menutext:
       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
@@ -251,27 +260,33 @@ nsresult nsLookAndFeel::NativeGetColor(c
        aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
        break;
 
      case eColor__moz_dialog:
        aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
        break;
 
      case eColor__moz_dialogtext:
-       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
+       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
        break;
 
      case eColor__moz_dragtargetzone:
        aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
        break;
 
      case eColor__moz_buttonhovertext:
        aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ButtonText));
        break;
 
+    case eColor__moz_menuhovertext:
+    case eColor__moz_menubarhovertext:
+       aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
+       break;
+
+
      default:
        aColor = 0;
        res    = NS_ERROR_FAILURE;
        break;
   }
   return res;
 }