Bug 1861709 replace AudioCallbackDriver::ThreadRunning() assertions that mean to...
[gecko.git] / widget / windows / nsLookAndFeel.h
blob897a388964d8bc5b25fa6aa5900a68c158bb4f04
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef __nsLookAndFeel
7 #define __nsLookAndFeel
9 #include <bitset>
10 #include <windows.h>
12 #include "nsXPLookAndFeel.h"
13 #include "gfxFont.h"
14 #include "mozilla/RangedArray.h"
15 #include "nsIWindowsRegKey.h"
18 * Gesture System Metrics
20 #ifndef SM_DIGITIZER
21 # define SM_DIGITIZER 94
22 # define TABLET_CONFIG_NONE 0x00000000
23 # define NID_INTEGRATED_TOUCH 0x00000001
24 # define NID_EXTERNAL_TOUCH 0x00000002
25 # define NID_INTEGRATED_PEN 0x00000004
26 # define NID_EXTERNAL_PEN 0x00000008
27 # define NID_MULTI_INPUT 0x00000040
28 # define NID_READY 0x00000080
29 #endif
32 * Tablet mode detection
34 #ifndef SM_SYSTEMDOCKED
35 # define SM_CONVERTIBLESLATEMODE 0x00002003
36 # define SM_SYSTEMDOCKED 0x00002004
37 #endif
40 * Color constant inclusive bounds for GetSysColor
42 #define SYS_COLOR_MIN 0
43 #define SYS_COLOR_MAX 30
44 #define SYS_COLOR_COUNT (SYS_COLOR_MAX - SYS_COLOR_MIN + 1)
46 class nsLookAndFeel final : public nsXPLookAndFeel {
47 public:
48 nsLookAndFeel();
49 virtual ~nsLookAndFeel();
51 void NativeInit() final;
52 void RefreshImpl() override;
53 nsresult NativeGetInt(IntID, int32_t& aResult) override;
54 nsresult NativeGetFloat(FloatID, float& aResult) override;
55 nsresult NativeGetColor(ColorID, ColorScheme, nscolor& aResult) override;
56 bool NativeGetFont(FontID aID, nsString& aFontName,
57 gfxFontStyle& aFontStyle) override;
58 char16_t GetPasswordCharacterImpl() override;
60 private:
61 struct TitlebarColors {
62 // NOTE: These are the DWM accent colors, which might not match the
63 // UISettings/UWP accent color in some cases, see bug 1796730.
64 mozilla::Maybe<nscolor> mAccent;
65 mozilla::Maybe<nscolor> mAccentText;
66 mozilla::Maybe<nscolor> mAccentInactive;
67 mozilla::Maybe<nscolor> mAccentInactiveText;
69 bool mUseAccent = false;
71 struct Set {
72 nscolor mBg = 0;
73 nscolor mFg = 0;
74 nscolor mBorder = 0;
77 Set mActiveLight;
78 Set mActiveDark;
80 Set mInactiveLight;
81 Set mInactiveDark;
83 const Set& Get(mozilla::ColorScheme aScheme, bool aActive) const {
84 if (aScheme == mozilla::ColorScheme::Dark) {
85 return aActive ? mActiveDark : mInactiveDark;
87 return aActive ? mActiveLight : mInactiveLight;
91 TitlebarColors ComputeTitlebarColors();
93 nscolor GetColorForSysColorIndex(int index);
95 LookAndFeelFont GetLookAndFeelFontInternal(const LOGFONTW& aLogFont,
96 bool aUseShellDlg);
98 LookAndFeelFont GetLookAndFeelFont(LookAndFeel::FontID anID);
100 // Cached colors and flags indicating success in their retrieval.
101 mozilla::Maybe<nscolor> mColorMenuHoverText;
103 mozilla::Maybe<nscolor> mDarkHighlight;
104 mozilla::Maybe<nscolor> mDarkHighlightText;
106 TitlebarColors mTitlebarColors;
108 nscolor mColorAccent = 0;
109 nscolor mColorAccentText = 0;
111 nscolor mSysColorTable[SYS_COLOR_COUNT];
113 bool mInitialized = false;
115 void EnsureInit();
118 #endif