michael@0: /* vim: se cin sw=2 ts=2 et : */ michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef __UXThemeData_h__ michael@0: #define __UXThemeData_h__ michael@0: #include michael@0: #include michael@0: michael@0: #include "nscore.h" michael@0: #include "mozilla/LookAndFeel.h" michael@0: #include "WinUtils.h" michael@0: michael@0: #include michael@0: michael@0: #include "nsWindowDefs.h" michael@0: michael@0: // These window messages are not defined in dwmapi.h michael@0: #ifndef WM_DWMCOMPOSITIONCHANGED michael@0: #define WM_DWMCOMPOSITIONCHANGED 0x031E michael@0: #endif michael@0: michael@0: // Windows 7 additions michael@0: #ifndef WM_DWMSENDICONICTHUMBNAIL michael@0: #define WM_DWMSENDICONICTHUMBNAIL 0x0323 michael@0: #define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326 michael@0: #endif michael@0: michael@0: #define DWMWA_FORCE_ICONIC_REPRESENTATION 7 michael@0: #define DWMWA_HAS_ICONIC_BITMAP 10 michael@0: michael@0: enum nsUXThemeClass { michael@0: eUXButton = 0, michael@0: eUXEdit, michael@0: eUXTooltip, michael@0: eUXRebar, michael@0: eUXMediaRebar, michael@0: eUXCommunicationsRebar, michael@0: eUXBrowserTabBarRebar, michael@0: eUXToolbar, michael@0: eUXMediaToolbar, michael@0: eUXCommunicationsToolbar, michael@0: eUXProgress, michael@0: eUXTab, michael@0: eUXScrollbar, michael@0: eUXTrackbar, michael@0: eUXSpin, michael@0: eUXStatus, michael@0: eUXCombobox, michael@0: eUXHeader, michael@0: eUXListview, michael@0: eUXMenu, michael@0: eUXWindowFrame, michael@0: eUXNumClasses michael@0: }; michael@0: michael@0: // Native windows style constants michael@0: enum WindowsTheme { michael@0: WINTHEME_UNRECOGNIZED = 0, michael@0: WINTHEME_CLASSIC = 1, // no theme michael@0: WINTHEME_AERO = 2, michael@0: WINTHEME_LUNA = 3, michael@0: WINTHEME_ROYALE = 4, michael@0: WINTHEME_ZUNE = 5, michael@0: WINTHEME_AERO_LITE = 6 michael@0: }; michael@0: enum WindowsThemeColor { michael@0: WINTHEMECOLOR_UNRECOGNIZED = 0, michael@0: WINTHEMECOLOR_NORMAL = 1, michael@0: WINTHEMECOLOR_HOMESTEAD = 2, michael@0: WINTHEMECOLOR_METALLIC = 3 michael@0: }; michael@0: michael@0: #define CMDBUTTONIDX_MINIMIZE 0 michael@0: #define CMDBUTTONIDX_RESTORE 1 michael@0: #define CMDBUTTONIDX_CLOSE 2 michael@0: #define CMDBUTTONIDX_BUTTONBOX 3 michael@0: michael@0: class nsUXThemeData { michael@0: static HMODULE sThemeDLL; michael@0: static HANDLE sThemes[eUXNumClasses]; michael@0: michael@0: static const wchar_t *GetClassName(nsUXThemeClass); michael@0: michael@0: public: michael@0: static const wchar_t kThemeLibraryName[]; michael@0: static bool sFlatMenus; michael@0: static bool sTitlebarInfoPopulatedAero; michael@0: static bool sTitlebarInfoPopulatedThemed; michael@0: static SIZE sCommandButtons[4]; michael@0: static mozilla::LookAndFeel::WindowsTheme sThemeId; michael@0: static bool sIsDefaultWindowsTheme; michael@0: static bool sIsHighContrastOn; michael@0: michael@0: static void Initialize(); michael@0: static void Teardown(); michael@0: static void Invalidate(); michael@0: static HANDLE GetTheme(nsUXThemeClass cls); michael@0: static HMODULE GetThemeDLL(); michael@0: michael@0: // nsWindow calls this to update desktop settings info michael@0: static void InitTitlebarInfo(); michael@0: static void UpdateTitlebarInfo(HWND aWnd); michael@0: michael@0: static void UpdateNativeThemeInfo(); michael@0: static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId(); michael@0: static bool IsDefaultWindowTheme(); michael@0: static bool IsHighContrastOn(); michael@0: michael@0: // This method returns the cached compositor state. Most michael@0: // callers should call without the argument. The cache michael@0: // should be modified only when the application receives michael@0: // WM_DWMCOMPOSITIONCHANGED. This rule prevents inconsistent michael@0: // results for two or more calls which check the state during michael@0: // composition transition. michael@0: static bool CheckForCompositor(bool aUpdateCache = false); michael@0: }; michael@0: #endif // __UXThemeData_h__