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"
14 #include "mozilla/Maybe.h"
17 #include "nsWindowDefs.h"
34 // This class makes sure we don't attempt to open a theme if the previous
35 // loading attempt has failed because OpenThemeData is a heavy task and
36 // it's less likely that the API returns a different result.
37 class ThemeHandle final
{
38 mozilla::Maybe
<HANDLE
> mHandle
;
41 ThemeHandle() = default;
44 // Disallow copy and move
45 ThemeHandle(const ThemeHandle
&) = delete;
46 ThemeHandle(ThemeHandle
&&) = delete;
47 ThemeHandle
& operator=(const ThemeHandle
&) = delete;
48 ThemeHandle
& operator=(ThemeHandle
&&) = delete;
51 void OpenOnce(HWND aWindow
, LPCWSTR aClassList
);
55 static ThemeHandle sThemes
[eUXNumClasses
];
56 static const wchar_t* GetClassName(nsUXThemeClass
);
59 static bool sIsHighContrastOn
;
61 static void Invalidate();
62 static HANDLE
GetTheme(nsUXThemeClass cls
);
63 static HMODULE
GetThemeDLL();
65 static void UpdateNativeThemeInfo();
66 static bool IsHighContrastOn() { return sIsHighContrastOn
; }
68 #endif // __UXThemeData_h__