Backed out changeset 8517afe50156 (bug 540456) for reftest failures.
[gecko.git] / widget / windows / nsUXThemeData.h
blob9486430adc71b1336081748bb4ccf4654c010b12
1 /* vim: se cin sw=2 ts=2 et : */
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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
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
69 enum WindowsThemeColor {
70 WINTHEMECOLOR_UNRECOGNIZED = 0,
71 WINTHEMECOLOR_NORMAL = 1,
72 WINTHEMECOLOR_HOMESTEAD = 2,
73 WINTHEMECOLOR_METALLIC = 3
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 PRUnichar 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;
96 static void Initialize();
97 static void Teardown();
98 static void Invalidate();
99 static HANDLE GetTheme(nsUXThemeClass cls);
100 static HMODULE GetThemeDLL();
102 // nsWindow calls this to update desktop settings info
103 static void InitTitlebarInfo();
104 static void UpdateTitlebarInfo(HWND aWnd);
106 static void UpdateNativeThemeInfo();
107 static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
108 static bool IsDefaultWindowTheme();
110 // This method returns the cached compositor state. Most
111 // callers should call without the argument. The cache
112 // should be modified only when the application receives
113 // WM_DWMCOMPOSITIONCHANGED. This rule prevents inconsistent
114 // results for two or more calls which check the state during
115 // composition transition.
116 static bool CheckForCompositor(bool aUpdateCache = false);
118 #endif // __UXThemeData_h__