Bug 1658004 [wpt PR 24923] - [EventTiming] Improve some of the flaky tests, a=testonly
[gecko.git] / widget / gtk / nsLookAndFeel.h
blobfa3779a60301375734075f7850651e7eb0ef5662
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
3 */
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/. */
8 #ifndef __nsLookAndFeel
9 #define __nsLookAndFeel
11 #include "X11UndefineNone.h"
12 #include "nsXPLookAndFeel.h"
13 #include "nsCOMPtr.h"
14 #include "gfxFont.h"
16 struct _GtkStyle;
18 class nsLookAndFeel final : public nsXPLookAndFeel {
19 public:
20 nsLookAndFeel();
21 virtual ~nsLookAndFeel();
23 void NativeInit() final;
24 void RefreshImpl() override;
25 nsresult NativeGetColor(ColorID aID, nscolor& aResult) override;
26 nsresult GetIntImpl(IntID aID, int32_t& aResult) override;
27 nsresult GetFloatImpl(FloatID aID, float& aResult) override;
28 bool GetFontImpl(FontID aID, nsString& aFontName,
29 gfxFontStyle& aFontStyle) override;
31 char16_t GetPasswordCharacterImpl() override;
32 bool GetEchoPasswordImpl() override;
34 LookAndFeelCache GetCacheImpl() override;
35 void SetCacheImpl(const LookAndFeelCache& aCache) override;
37 bool IsCSDAvailable() const { return mCSDAvailable; }
39 static const nscolor kBlack = NS_RGB(0, 0, 0);
40 static const nscolor kWhite = NS_RGB(255, 255, 255);
42 protected:
43 // Cached fonts
44 bool mDefaultFontCached = false;
45 bool mButtonFontCached = false;
46 bool mFieldFontCached = false;
47 bool mMenuFontCached = false;
48 nsString mDefaultFontName;
49 nsString mButtonFontName;
50 nsString mFieldFontName;
51 nsString mMenuFontName;
52 gfxFontStyle mDefaultFontStyle;
53 gfxFontStyle mButtonFontStyle;
54 gfxFontStyle mFieldFontStyle;
55 gfxFontStyle mMenuFontStyle;
57 // Cached colors
58 nscolor mInfoBackground = kWhite;
59 nscolor mInfoText = kBlack;
60 nscolor mMenuBackground = kWhite;
61 nscolor mMenuBarText = kBlack;
62 nscolor mMenuBarHoverText = kBlack;
63 nscolor mMenuText = kBlack;
64 nscolor mMenuTextInactive = kWhite;
65 nscolor mMenuHover = kWhite;
66 nscolor mMenuHoverText = kBlack;
67 nscolor mButtonDefault = kWhite;
68 nscolor mButtonText = kBlack;
69 nscolor mButtonHoverText = kBlack;
70 nscolor mButtonHoverFace = kWhite;
71 nscolor mButtonActiveText = kBlack;
72 nscolor mFrameOuterLightBorder = kBlack;
73 nscolor mFrameInnerDarkBorder = kBlack;
74 nscolor mOddCellBackground = kWhite;
75 nscolor mNativeHyperLinkText = kBlack;
76 nscolor mComboBoxText = kBlack;
77 nscolor mComboBoxBackground = kWhite;
78 nscolor mFieldText = kBlack;
79 nscolor mFieldBackground = kWhite;
80 nscolor mMozWindowText = kBlack;
81 nscolor mMozWindowBackground = kWhite;
82 nscolor mMozWindowActiveBorder = kBlack;
83 nscolor mMozWindowInactiveBorder = kBlack;
84 nscolor mMozWindowInactiveCaption = kWhite;
85 nscolor mMozCellHighlightBackground = kWhite;
86 nscolor mMozCellHighlightText = kBlack;
87 nscolor mTextSelectedText = kBlack;
88 nscolor mTextSelectedBackground = kWhite;
89 nscolor mMozScrollbar = kWhite;
90 nscolor mInfoBarText = kBlack;
91 nscolor mMozColHeaderText = kBlack;
92 nscolor mMozColHeaderHoverText = kBlack;
93 char16_t mInvisibleCharacter = 0;
94 float mCaretRatio = 0.0f;
95 int32_t mCaretBlinkTime = 0;
96 bool mMenuSupportsDrag = false;
97 bool mCSDAvailable = false;
98 bool mCSDHideTitlebarByDefault = false;
99 bool mCSDMaximizeButton = false;
100 bool mCSDMinimizeButton = false;
101 bool mCSDCloseButton = false;
102 bool mCSDReversedPlacement = false;
103 bool mSystemUsesDarkTheme = false;
104 bool mPrefersReducedMotion = false;
105 bool mHighContrast = false;
106 bool mInitialized = false;
107 int32_t mCSDMaximizeButtonPosition = 0;
108 int32_t mCSDMinimizeButtonPosition = 0;
109 int32_t mCSDCloseButtonPosition = 0;
111 void EnsureInit();
112 void ConfigureContentGtkTheme();
114 private:
115 nsresult InitCellHighlightColors();
118 #endif