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