Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* vim: se cin sw=2 ts=2 et : */
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef __UXThemeData_h__
8 #define __UXThemeData_h__
9 #include <windows.h>
10 #include <uxtheme.h>
12 #include "nscore.h"
13 #include "mozilla/LookAndFeel.h"
14 #include "WinUtils.h"
16 #include <dwmapi.h>
18 #include "nsWindowDefs.h"
20 // These window messages are not defined in dwmapi.h
21 #ifndef WM_DWMCOMPOSITIONCHANGED
22 #define WM_DWMCOMPOSITIONCHANGED 0x031E
23 #endif
25 // Windows 7 additions
26 #ifndef WM_DWMSENDICONICTHUMBNAIL
27 #define WM_DWMSENDICONICTHUMBNAIL 0x0323
28 #define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326
29 #endif
31 #define DWMWA_FORCE_ICONIC_REPRESENTATION 7
32 #define DWMWA_HAS_ICONIC_BITMAP 10
34 enum nsUXThemeClass {
35 eUXButton = 0,
36 eUXEdit,
37 eUXTooltip,
38 eUXRebar,
39 eUXMediaRebar,
40 eUXCommunicationsRebar,
41 eUXBrowserTabBarRebar,
42 eUXToolbar,
43 eUXMediaToolbar,
44 eUXCommunicationsToolbar,
45 eUXProgress,
46 eUXTab,
47 eUXScrollbar,
48 eUXTrackbar,
49 eUXSpin,
50 eUXStatus,
51 eUXCombobox,
52 eUXHeader,
53 eUXListview,
54 eUXMenu,
55 eUXWindowFrame,
56 eUXNumClasses
57 };
59 // Native windows style constants
60 enum WindowsTheme {
61 WINTHEME_UNRECOGNIZED = 0,
62 WINTHEME_CLASSIC = 1, // no theme
63 WINTHEME_AERO = 2,
64 WINTHEME_LUNA = 3,
65 WINTHEME_ROYALE = 4,
66 WINTHEME_ZUNE = 5,
67 WINTHEME_AERO_LITE = 6
68 };
69 enum WindowsThemeColor {
70 WINTHEMECOLOR_UNRECOGNIZED = 0,
71 WINTHEMECOLOR_NORMAL = 1,
72 WINTHEMECOLOR_HOMESTEAD = 2,
73 WINTHEMECOLOR_METALLIC = 3
74 };
76 #define CMDBUTTONIDX_MINIMIZE 0
77 #define CMDBUTTONIDX_RESTORE 1
78 #define CMDBUTTONIDX_CLOSE 2
79 #define CMDBUTTONIDX_BUTTONBOX 3
81 class nsUXThemeData {
82 static HMODULE sThemeDLL;
83 static HANDLE sThemes[eUXNumClasses];
85 static const wchar_t *GetClassName(nsUXThemeClass);
87 public:
88 static const wchar_t kThemeLibraryName[];
89 static bool sFlatMenus;
90 static bool sTitlebarInfoPopulatedAero;
91 static bool sTitlebarInfoPopulatedThemed;
92 static SIZE sCommandButtons[4];
93 static mozilla::LookAndFeel::WindowsTheme sThemeId;
94 static bool sIsDefaultWindowsTheme;
95 static bool sIsHighContrastOn;
97 static void Initialize();
98 static void Teardown();
99 static void Invalidate();
100 static HANDLE GetTheme(nsUXThemeClass cls);
101 static HMODULE GetThemeDLL();
103 // nsWindow calls this to update desktop settings info
104 static void InitTitlebarInfo();
105 static void UpdateTitlebarInfo(HWND aWnd);
107 static void UpdateNativeThemeInfo();
108 static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
109 static bool IsDefaultWindowTheme();
110 static bool IsHighContrastOn();
112 // This method returns the cached compositor state. Most
113 // callers should call without the argument. The cache
114 // should be modified only when the application receives
115 // WM_DWMCOMPOSITIONCHANGED. This rule prevents inconsistent
116 // results for two or more calls which check the state during
117 // composition transition.
118 static bool CheckForCompositor(bool aUpdateCache = false);
119 };
120 #endif // __UXThemeData_h__