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__
13 #include "mozilla/LookAndFeel.h"
18 #include "nsWindowDefs.h"
20 // These window messages are not defined in dwmapi.h
21 #ifndef WM_DWMCOMPOSITIONCHANGED
22 #define WM_DWMCOMPOSITIONCHANGED 0x031E
25 // Windows 7 additions
26 #ifndef WM_DWMSENDICONICTHUMBNAIL
27 #define WM_DWMSENDICONICTHUMBNAIL 0x0323
28 #define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326
31 #define DWMWA_FORCE_ICONIC_REPRESENTATION 7
32 #define DWMWA_HAS_ICONIC_BITMAP 10
40 eUXCommunicationsRebar
,
41 eUXBrowserTabBarRebar
,
44 eUXCommunicationsToolbar
,
59 // Native windows style constants
61 WINTHEME_UNRECOGNIZED
= 0,
62 WINTHEME_CLASSIC
= 1, // no theme
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
82 static HMODULE sThemeDLL
;
83 static HANDLE sThemes
[eUXNumClasses
];
85 static const wchar_t *GetClassName(nsUXThemeClass
);
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__