1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/windows/nsUXThemeData.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,120 @@ 1.4 +/* vim: se cin sw=2 ts=2 et : */ 1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.6 + * 1.7 + * This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 +#ifndef __UXThemeData_h__ 1.11 +#define __UXThemeData_h__ 1.12 +#include <windows.h> 1.13 +#include <uxtheme.h> 1.14 + 1.15 +#include "nscore.h" 1.16 +#include "mozilla/LookAndFeel.h" 1.17 +#include "WinUtils.h" 1.18 + 1.19 +#include <dwmapi.h> 1.20 + 1.21 +#include "nsWindowDefs.h" 1.22 + 1.23 +// These window messages are not defined in dwmapi.h 1.24 +#ifndef WM_DWMCOMPOSITIONCHANGED 1.25 +#define WM_DWMCOMPOSITIONCHANGED 0x031E 1.26 +#endif 1.27 + 1.28 +// Windows 7 additions 1.29 +#ifndef WM_DWMSENDICONICTHUMBNAIL 1.30 +#define WM_DWMSENDICONICTHUMBNAIL 0x0323 1.31 +#define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326 1.32 +#endif 1.33 + 1.34 +#define DWMWA_FORCE_ICONIC_REPRESENTATION 7 1.35 +#define DWMWA_HAS_ICONIC_BITMAP 10 1.36 + 1.37 +enum nsUXThemeClass { 1.38 + eUXButton = 0, 1.39 + eUXEdit, 1.40 + eUXTooltip, 1.41 + eUXRebar, 1.42 + eUXMediaRebar, 1.43 + eUXCommunicationsRebar, 1.44 + eUXBrowserTabBarRebar, 1.45 + eUXToolbar, 1.46 + eUXMediaToolbar, 1.47 + eUXCommunicationsToolbar, 1.48 + eUXProgress, 1.49 + eUXTab, 1.50 + eUXScrollbar, 1.51 + eUXTrackbar, 1.52 + eUXSpin, 1.53 + eUXStatus, 1.54 + eUXCombobox, 1.55 + eUXHeader, 1.56 + eUXListview, 1.57 + eUXMenu, 1.58 + eUXWindowFrame, 1.59 + eUXNumClasses 1.60 +}; 1.61 + 1.62 +// Native windows style constants 1.63 +enum WindowsTheme { 1.64 + WINTHEME_UNRECOGNIZED = 0, 1.65 + WINTHEME_CLASSIC = 1, // no theme 1.66 + WINTHEME_AERO = 2, 1.67 + WINTHEME_LUNA = 3, 1.68 + WINTHEME_ROYALE = 4, 1.69 + WINTHEME_ZUNE = 5, 1.70 + WINTHEME_AERO_LITE = 6 1.71 +}; 1.72 +enum WindowsThemeColor { 1.73 + WINTHEMECOLOR_UNRECOGNIZED = 0, 1.74 + WINTHEMECOLOR_NORMAL = 1, 1.75 + WINTHEMECOLOR_HOMESTEAD = 2, 1.76 + WINTHEMECOLOR_METALLIC = 3 1.77 +}; 1.78 + 1.79 +#define CMDBUTTONIDX_MINIMIZE 0 1.80 +#define CMDBUTTONIDX_RESTORE 1 1.81 +#define CMDBUTTONIDX_CLOSE 2 1.82 +#define CMDBUTTONIDX_BUTTONBOX 3 1.83 + 1.84 +class nsUXThemeData { 1.85 + static HMODULE sThemeDLL; 1.86 + static HANDLE sThemes[eUXNumClasses]; 1.87 + 1.88 + static const wchar_t *GetClassName(nsUXThemeClass); 1.89 + 1.90 +public: 1.91 + static const wchar_t kThemeLibraryName[]; 1.92 + static bool sFlatMenus; 1.93 + static bool sTitlebarInfoPopulatedAero; 1.94 + static bool sTitlebarInfoPopulatedThemed; 1.95 + static SIZE sCommandButtons[4]; 1.96 + static mozilla::LookAndFeel::WindowsTheme sThemeId; 1.97 + static bool sIsDefaultWindowsTheme; 1.98 + static bool sIsHighContrastOn; 1.99 + 1.100 + static void Initialize(); 1.101 + static void Teardown(); 1.102 + static void Invalidate(); 1.103 + static HANDLE GetTheme(nsUXThemeClass cls); 1.104 + static HMODULE GetThemeDLL(); 1.105 + 1.106 + // nsWindow calls this to update desktop settings info 1.107 + static void InitTitlebarInfo(); 1.108 + static void UpdateTitlebarInfo(HWND aWnd); 1.109 + 1.110 + static void UpdateNativeThemeInfo(); 1.111 + static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId(); 1.112 + static bool IsDefaultWindowTheme(); 1.113 + static bool IsHighContrastOn(); 1.114 + 1.115 + // This method returns the cached compositor state. Most 1.116 + // callers should call without the argument. The cache 1.117 + // should be modified only when the application receives 1.118 + // WM_DWMCOMPOSITIONCHANGED. This rule prevents inconsistent 1.119 + // results for two or more calls which check the state during 1.120 + // composition transition. 1.121 + static bool CheckForCompositor(bool aUpdateCache = false); 1.122 +}; 1.123 +#endif // __UXThemeData_h__