Bug 1758713 [wpt PR 33128] - Clarify the status of the CSS build system, a=testonly
[gecko.git] / widget / windows / nsLookAndFeel.h
blobe85131a275cddc5f35853ab64590d1a0d86048c1
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 /**
62 * Fetches the Windows accent color from the Windows settings if
63 * the accent color is set to apply to the title bar, otherwise
64 * returns an error code.
66 nsresult GetAccentColor(nscolor& aColor);
68 /**
69 * If the Windows accent color from the Windows settings is set
70 * to apply to the title bar, this computes the color that should
71 * be used for text that is to be written over a background that has
72 * the accent color. Otherwise, (if the accent color should not
73 * apply to the title bar) this returns an error code.
75 nsresult GetAccentColorText(nscolor& aColor);
77 nscolor GetColorForSysColorIndex(int index);
79 LookAndFeelFont GetLookAndFeelFontInternal(const LOGFONTW& aLogFont,
80 bool aUseShellDlg);
82 LookAndFeelFont GetLookAndFeelFont(LookAndFeel::FontID anID);
84 // Cached colors and flags indicating success in their retrieval.
85 nscolor mColorMenuHoverText;
86 bool mHasColorMenuHoverText;
87 nscolor mColorAccent;
88 bool mHasColorAccent;
89 nscolor mColorAccentText;
90 bool mHasColorAccentText;
91 nscolor mColorMediaText;
92 bool mHasColorMediaText;
93 nscolor mColorCommunicationsText;
94 bool mHasColorCommunicationsText;
96 nscolor mSysColorTable[SYS_COLOR_COUNT];
98 bool mInitialized;
100 void EnsureInit();
102 nsCOMPtr<nsIWindowsRegKey> mDwmKey;
105 #endif