Bug 669028 part.4 Rename nsILookAndFeel.h to LookAndFeel.h and widget should use mozilla::LookAndFeel rather than nsILookAndFeel r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 09 Sep 2011 11:27:12 +0900
changeset 76810 f84313aa98a067771894372c75bcbb69d4dec7a0
parent 76809 19b106d56f8a558817688b6d554ce956018e9f0b
child 76811 4a86d875f87655be4abdcbc2a4e4a03f76c67aea
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersroc
bugs669028
milestone9.0a1
Bug 669028 part.4 Rename nsILookAndFeel.h to LookAndFeel.h and widget should use mozilla::LookAndFeel rather than nsILookAndFeel r=roc
widget/public/LookAndFeel.h
widget/public/Makefile.in
widget/public/nsILookAndFeel.h
widget/src/cocoa/nsNativeThemeCocoa.h
widget/src/cocoa/nsNativeThemeCocoa.mm
widget/src/gtk2/nsNativeThemeGTK.cpp
widget/src/qt/nsNativeThemeQt.cpp
widget/src/windows/nsLookAndFeel.cpp
widget/src/windows/nsNativeThemeWin.cpp
widget/src/windows/nsUXThemeData.cpp
widget/src/windows/nsUXThemeData.h
widget/src/windows/nsWindow.cpp
widget/src/xpwidgets/nsNativeTheme.cpp
widget/src/xpwidgets/nsNativeTheme.h
widget/src/xpwidgets/nsXPLookAndFeel.cpp
widget/src/xpwidgets/nsXPLookAndFeel.h
rename from widget/public/nsILookAndFeel.h
rename to widget/public/LookAndFeel.h
--- a/widget/public/nsILookAndFeel.h
+++ b/widget/public/LookAndFeel.h
@@ -30,18 +30,18 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef __nsILookAndFeel
-#define __nsILookAndFeel
+#ifndef __LookAndFeel
+#define __LookAndFeel
 
 #ifndef MOZILLA_INTERNAL_API
 #error "This header is only usable from within libxul (MOZILLA_INTERNAL_API)."
 #endif
 
 #include "nsISupports.h"
 #include "nsColor.h"
 
@@ -900,9 +900,9 @@ public:
 // ------------------------------------------
 //  Bits for eIntID_AlertNotificationOrigin
 // ------------------------------------------
 
 #define NS_ALERT_HORIZONTAL 1
 #define NS_ALERT_LEFT       2
 #define NS_ALERT_TOP        4
 
-#endif /* __nsILookAndFeel */
+#endif /* __LookAndFeel */
--- a/widget/public/Makefile.in
+++ b/widget/public/Makefile.in
@@ -47,30 +47,35 @@ XPIDL_MODULE	= widget
 GRE_MODULE	= 1
 
 EXPORTS_NAMESPACES = IPC
 
 EXPORTS_IPC = \
 		nsGUIEventIPC.h \
 		$(NULL)
 
+EXPORTS_NAMESPACES += mozilla
+
+EXPORTS_mozilla = \
+		LookAndFeel.h \
+		$(NULL)
+
 ifdef MOZ_INSTRUMENT_EVENT_LOOP
-EXPORTS_NAMESPACES += mozilla
-EXPORTS_mozilla = \
-  WidgetTraceEvent.h
+EXPORTS_mozilla += \
+		WidgetTraceEvent.h \
+		$(NULL)
 endif
 
 EXPORTS		= \
 		nsIWidget.h \
 		nsGUIEvent.h \
 		nsEvent.h \
 		nsNativeWidget.h \
 		nsWidgetInitData.h \
 		nsWidgetsCID.h \
-		nsILookAndFeel.h \
 		nsIPluginWidget.h \
 		nsINativeKeyBindings.h \
 		nsIDeviceContextSpec.h \
 		nsIMenuRollup.h \
 		nsIRollupListener.h \
 		$(NULL)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
--- a/widget/src/cocoa/nsNativeThemeCocoa.h
+++ b/widget/src/cocoa/nsNativeThemeCocoa.h
@@ -39,17 +39,16 @@
 #define nsNativeThemeCocoa_h_
 
 #import <Carbon/Carbon.h>
 #import <Cocoa/Cocoa.h>
 
 #include "nsITheme.h"
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
-#include "nsILookAndFeel.h"
 #include "nsNativeTheme.h"
 #include "gfxASurface.h"
 
 @class CellDrawView;
 @class NSProgressBarCell;
 @class ContextAwareSearchFieldCell;
 class nsDeviceContext;
 struct SegmentedControlRenderSettings;
@@ -91,17 +90,16 @@ public:
   PRBool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
   PRBool WidgetIsContainer(PRUint8 aWidgetType);
   PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
   PRBool ThemeNeedsComboboxDropmarker();
   virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType);
 
 protected:  
 
-  nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID);
   nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame);
   nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
   CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft,
                                nsIFrame* aCurrent, nsIFrame* aRight);
 
   // Helpers for progressbar.
   double GetProgressValue(nsIFrame* aFrame);
   double GetProgressMaxValue(nsIFrame* aFrame);
--- a/widget/src/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/src/cocoa/nsNativeThemeCocoa.mm
@@ -50,17 +50,16 @@
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
 #include "nsIAtom.h"
 #include "nsEventStates.h"
 #include "nsINameSpaceManager.h"
 #include "nsPresContext.h"
-#include "nsILookAndFeel.h"
 #include "nsWidgetAtoms.h"
 #include "nsToolkit.h"
 #include "nsCocoaWindow.h"
 #include "nsNativeThemeColors.h"
 #include "nsIScrollableFrame.h"
 #include "nsIDOMHTMLProgressElement.h"
 
 #include "gfxContext.h"
--- a/widget/src/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/src/gtk2/nsNativeThemeGTK.cpp
@@ -46,17 +46,16 @@
 #include "nsIObserverService.h"
 #include "nsIServiceManager.h"
 #include "nsIFrame.h"
 #include "nsIPresShell.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIViewManager.h"
 #include "nsINameSpaceManager.h"
-#include "nsILookAndFeel.h"
 #include "nsGfxCIID.h"
 #include "nsTransform2D.h"
 #include "nsMenuFrame.h"
 #include "prlink.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsRenderingContext.h"
 #include "nsWidgetAtoms.h"
 #include "mozilla/Services.h"
--- a/widget/src/qt/nsNativeThemeQt.cpp
+++ b/widget/src/qt/nsNativeThemeQt.cpp
@@ -54,17 +54,16 @@
 #include "nsCoord.h"
 #include "nsNativeThemeQt.h"
 #include "nsPresContext.h"
 
 #include "nsRect.h"
 #include "nsSize.h"
 #include "nsTransform2D.h"
 #include "nsThemeConstants.h"
-#include "nsILookAndFeel.h"
 #include "nsIServiceManager.h"
 #include "nsIDOMHTMLInputElement.h"
 #include <malloc.h>
 
 
 #include "gfxASurface.h"
 #include "gfxContext.h"
 #include "gfxQtPlatform.h"
--- a/widget/src/windows/nsLookAndFeel.cpp
+++ b/widget/src/windows/nsLookAndFeel.cpp
@@ -437,17 +437,17 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(c
           if (shellWindow != NULL)
           {
             // Determine position
             APPBARDATA appBarData;
             appBarData.hWnd = shellWindow;
             appBarData.cbSize = sizeof(appBarData);
             if (gSHAppBarMessage(ABM_GETTASKBARPOS, &appBarData))
             {
-              // Set alert origin as a bit field - see nsILookAndFeel.h
+              // Set alert origin as a bit field - see LookAndFeel.h
               // 0 represents bottom right, sliding vertically.
               switch(appBarData.uEdge)
               {
                 case ABE_LEFT:
                   aMetric = NS_ALERT_HORIZONTAL | NS_ALERT_LEFT;
                   break;
                 case ABE_RIGHT:
                   aMetric = NS_ALERT_HORIZONTAL;
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -48,17 +48,16 @@
 #include "nsThemeConstants.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
 #include "nsEventStates.h"
 #include "nsINameSpaceManager.h"
-#include "nsILookAndFeel.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsMenuFrame.h"
 #include "nsWidgetAtoms.h"
 #include <malloc.h>
 #include "nsWindow.h"
 #include "nsIComboboxControlFrame.h"
 #include "prinrval.h"
 
--- a/widget/src/windows/nsUXThemeData.cpp
+++ b/widget/src/windows/nsUXThemeData.cpp
@@ -40,16 +40,18 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsUXThemeData.h"
 #include "nsDebug.h"
 // For GetWindowsVersion
 #include "nsWindow.h"
 #include "nsUXThemeConstants.h"
 
+using namespace mozilla;
+
 const PRUnichar
 nsUXThemeData::kThemeLibraryName[] = L"uxtheme.dll";
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
 const PRUnichar
 nsUXThemeData::kDwmLibraryName[] = L"dwmapi.dll";
 #endif
 
 HANDLE
@@ -367,24 +369,24 @@ const THEMELIST knownThemes[] = {
 };
 
 const THEMELIST knownColors[] = {
   { L"normalcolor", WINTHEMECOLOR_NORMAL },
   { L"homestead",   WINTHEMECOLOR_HOMESTEAD },
   { L"metallic",    WINTHEMECOLOR_METALLIC }
 };
 
-nsILookAndFeel::WindowsThemeIdentifier
-nsUXThemeData::sThemeId = nsILookAndFeel::eWindowsTheme_Generic;
+LookAndFeel::WindowsTheme
+nsUXThemeData::sThemeId = LookAndFeel::eWindowsTheme_Generic;
 
 PRBool
 nsUXThemeData::sIsDefaultWindowsTheme = PR_FALSE;
 
 // static
-nsILookAndFeel::WindowsThemeIdentifier
+LookAndFeel::WindowsTheme
 nsUXThemeData::GetNativeThemeId()
 {
   return sThemeId;
 }
 
 // static
 PRBool nsUXThemeData::IsDefaultWindowTheme()
 {
@@ -394,31 +396,31 @@ PRBool nsUXThemeData::IsDefaultWindowThe
 // static
 void
 nsUXThemeData::UpdateNativeThemeInfo()
 {
   // Trigger a refresh of themed button metrics if needed
   sTitlebarInfoPopulatedThemed = (nsWindow::GetWindowsVersion() < VISTA_VERSION);
 
   sIsDefaultWindowsTheme = PR_FALSE;
-  sThemeId = nsILookAndFeel::eWindowsTheme_Generic;
+  sThemeId = LookAndFeel::eWindowsTheme_Generic;
 
   if (!IsAppThemed() || !getCurrentThemeName) {
-    sThemeId = nsILookAndFeel::eWindowsTheme_Classic;
+    sThemeId = LookAndFeel::eWindowsTheme_Classic;
     return;
   }
 
   WCHAR themeFileName[MAX_PATH + 1];
   WCHAR themeColor[MAX_PATH + 1];
   if (FAILED(getCurrentThemeName(themeFileName,
                                  MAX_PATH,
                                  themeColor,
                                  MAX_PATH,
                                  NULL, 0))) {
-    sThemeId = nsILookAndFeel::eWindowsTheme_Classic;
+    sThemeId = LookAndFeel::eWindowsTheme_Classic;
     return;
   }
 
   LPCWSTR themeName = wcsrchr(themeFileName, L'\\');
   themeName = themeName ? themeName + 1 : themeFileName;
 
   WindowsTheme theme = WINTHEME_UNRECOGNIZED;
   for (int i = 0; i < NS_ARRAY_LENGTH(knownThemes); ++i) {
@@ -432,23 +434,23 @@ nsUXThemeData::UpdateNativeThemeInfo()
     return;
 
   if (theme == WINTHEME_AERO || theme == WINTHEME_LUNA)
     sIsDefaultWindowsTheme = PR_TRUE;
   
   if (theme != WINTHEME_LUNA) {
     switch(theme) {
       case WINTHEME_AERO:
-        sThemeId = nsILookAndFeel::eWindowsTheme_Aero;
+        sThemeId = LookAndFeel::eWindowsTheme_Aero;
         return;
       case WINTHEME_ZUNE:
-        sThemeId = nsILookAndFeel::eWindowsTheme_Zune;
+        sThemeId = LookAndFeel::eWindowsTheme_Zune;
         return;
       case WINTHEME_ROYALE:
-        sThemeId = nsILookAndFeel::eWindowsTheme_Royale;
+        sThemeId = LookAndFeel::eWindowsTheme_Royale;
         return;
       default:
         NS_WARNING("unhandled theme type.");
         return;
     }
   }
 
   // calculate the luna color scheme
@@ -457,21 +459,21 @@ nsUXThemeData::UpdateNativeThemeInfo()
     if (!lstrcmpiW(themeColor, knownColors[i].name)) {
       color = (WindowsThemeColor)knownColors[i].type;
       break;
     }
   }
 
   switch(color) {
     case WINTHEMECOLOR_NORMAL:
-      sThemeId = nsILookAndFeel::eWindowsTheme_LunaBlue;
+      sThemeId = LookAndFeel::eWindowsTheme_LunaBlue;
       return;
     case WINTHEMECOLOR_HOMESTEAD:
-      sThemeId = nsILookAndFeel::eWindowsTheme_LunaOlive;
+      sThemeId = LookAndFeel::eWindowsTheme_LunaOlive;
       return;
     case WINTHEMECOLOR_METALLIC:
-      sThemeId = nsILookAndFeel::eWindowsTheme_LunaSilver;
+      sThemeId = LookAndFeel::eWindowsTheme_LunaSilver;
       return;
     default:
       NS_WARNING("unhandled theme color.");
       return;
   }
 }
--- a/widget/src/windows/nsUXThemeData.h
+++ b/widget/src/windows/nsUXThemeData.h
@@ -38,17 +38,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 #ifndef __UXThemeData_h__
 #define __UXThemeData_h__
 #include <windows.h>
 #include <uxtheme.h>
 
 #include "nscore.h"
-#include "nsILookAndFeel.h"
+#include "mozilla/LookAndFeel.h"
 
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
 #include <dwmapi.h>
 #endif
 
 #include "nsWindowDefs.h"
 
 // These window messages are not defined in dwmapi.h
@@ -128,34 +128,34 @@ public:
    static const PRUnichar kDwmLibraryName[];
 #endif
   static BOOL sFlatMenus;
   static PRPackedBool sIsXPOrLater;
   static PRPackedBool sIsVistaOrLater;
   static PRBool sTitlebarInfoPopulatedAero;
   static PRBool sTitlebarInfoPopulatedThemed;
   static SIZE sCommandButtons[4];
-  static nsILookAndFeel::WindowsThemeIdentifier sThemeId;
+  static mozilla::LookAndFeel::WindowsTheme sThemeId;
   static PRBool sIsDefaultWindowsTheme;
 
   static void Initialize();
   static void Teardown();
   static void Invalidate();
   static HANDLE GetTheme(nsUXThemeClass cls);
   static HMODULE GetThemeDLL();
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   static HMODULE GetDwmDLL();
 #endif
 
   // nsWindow calls this to update desktop settings info
   static void InitTitlebarInfo();
   static void UpdateTitlebarInfo(HWND aWnd);
 
   static void UpdateNativeThemeInfo();
-  static nsILookAndFeel::WindowsThemeIdentifier GetNativeThemeId();
+  static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
   static PRBool IsDefaultWindowTheme();
 
   static inline BOOL IsAppThemed() {
     return isAppThemed && isAppThemed();
   }
 
   static inline HRESULT GetThemeColor(nsUXThemeClass cls, int iPartId, int iStateId,
                                                    int iPropId, OUT COLORREF* pFont) {
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -128,17 +128,16 @@
 #include "nsIRollupListener.h"
 #include "nsIMenuRollup.h"
 #include "nsIServiceManager.h"
 #include "nsIClipboard.h"
 #include "nsIMM32Handler.h"
 #include "nsILocalFile.h"
 #include "nsFontMetrics.h"
 #include "nsIFontEnumerator.h"
-#include "nsILookAndFeel.h"
 #include "nsGUIEvent.h"
 #include "nsFont.h"
 #include "nsRect.h"
 #include "nsThreadUtils.h"
 #include "nsNativeCharsetUtils.h"
 #include "nsWidgetAtoms.h"
 #include "nsUnicharUtils.h"
 #include "nsCRT.h"
--- a/widget/src/xpwidgets/nsNativeTheme.cpp
+++ b/widget/src/xpwidgets/nsNativeTheme.cpp
@@ -43,17 +43,16 @@
 #include "nsIFrame.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsEventStateManager.h"
 #include "nsString.h"
 #include "nsINameSpaceManager.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMXULMenuListElement.h"
-#include "nsILookAndFeel.h"
 #include "nsThemeConstants.h"
 #include "nsIComponentManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsProgressFrame.h"
 #include "nsMenuFrame.h"
 #include "mozilla/dom/Element.h"
 
 nsNativeTheme::nsNativeTheme()
--- a/widget/src/xpwidgets/nsNativeTheme.h
+++ b/widget/src/xpwidgets/nsNativeTheme.h
@@ -40,17 +40,16 @@
 // code duplication.
 
 #include "prtypes.h"
 #include "nsAlgorithm.h"
 #include "nsIAtom.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsMargin.h"
-#include "nsILookAndFeel.h"
 #include "nsWidgetAtoms.h"
 #include "nsEventStates.h"
 #include "nsTArray.h"
 #include "nsITimer.h"
 
 class nsIContent;
 class nsIFrame;
 class nsIPresShell;
--- a/widget/src/xpwidgets/nsXPLookAndFeel.cpp
+++ b/widget/src/xpwidgets/nsXPLookAndFeel.cpp
@@ -103,17 +103,17 @@ nsLookAndFeelFloatPref nsXPLookAndFeel::
   { "ui.SpellCheckerUnderlineRelativeSize",
     eMetricFloat_SpellCheckerUnderlineRelativeSize, PR_FALSE,
     nsLookAndFeelTypeFloat, 0 },
   { "ui.caretAspectRatio", eMetricFloat_CaretAspectRatio, PR_FALSE,
     nsLookAndFeelTypeFloat, 0 },
 };
 
 
-// This array MUST be kept in the same order as the color list in nsILookAndFeel.h.
+// This array MUST be kept in the same order as the color list in LookAndFeel.h.
 /* XXX If you add any strings longer than
  * "ui.IMESelectedConvertedTextBackground"
  * to the following array then you MUST update the
  * sizes of the sColorPrefs array in nsXPLookAndFeel.h
  */
 const char nsXPLookAndFeel::sColorPrefs[][38] =
 {
   "ui.windowBackground",
--- a/widget/src/xpwidgets/nsXPLookAndFeel.h
+++ b/widget/src/xpwidgets/nsXPLookAndFeel.h
@@ -33,17 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef __nsXPLookAndFeel
 #define __nsXPLookAndFeel
 
-#include "nsILookAndFeel.h"
+#include "mozilla/LookAndFeel.h"
 #include "nsCOMPtr.h"
 
 #ifdef NS_DEBUG
 struct nsSize;
 #endif
 
 class nsLookAndFeel;