1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/. */
7 
8 #ifndef __nsLookAndFeel
9 #define __nsLookAndFeel
10 
11 #include "nsXPLookAndFeel.h"
12 #include "nsCOMPtr.h"
13 #include "gfxFont.h"
14 
15 struct _GtkStyle;
16 
17 class nsLookAndFeel: public nsXPLookAndFeel {
18 public:
19     nsLookAndFeel();
20     virtual ~nsLookAndFeel();
21 
22     virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult);
23     virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
24     virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
25     virtual bool GetFontImpl(FontID aID, nsString& aFontName,
26                              gfxFontStyle& aFontStyle,
27                              float aDevPixPerCSSPixel);
28 
29     virtual void RefreshImpl();
30     virtual char16_t GetPasswordCharacterImpl();
31     virtual bool GetEchoPasswordImpl();
32 
33 protected:
34 #if (MOZ_WIDGET_GTK == 2)
35     struct _GtkStyle *mStyle;
36 #else
37     struct _GtkStyleContext *mBackgroundStyle;
38     struct _GtkStyleContext *mButtonStyle;
39 #endif
40 
41     // Cached fonts
42     bool mDefaultFontCached;
43     bool mButtonFontCached;
44     bool mFieldFontCached;
45     bool mMenuFontCached;
46     nsString mDefaultFontName;
47     nsString mButtonFontName;
48     nsString mFieldFontName;
49     nsString mMenuFontName;
50     gfxFontStyle mDefaultFontStyle;
51     gfxFontStyle mButtonFontStyle;
52     gfxFontStyle mFieldFontStyle;
53     gfxFontStyle mMenuFontStyle;
54 
55     // Cached colors
56     nscolor sInfoBackground;
57     nscolor sInfoText;
58     nscolor sMenuBackground;
59     nscolor sMenuBarText;
60     nscolor sMenuBarHoverText;
61     nscolor sMenuText;
62     nscolor sMenuTextInactive;
63     nscolor sMenuHover;
64     nscolor sMenuHoverText;
65     nscolor sButtonText;
66     nscolor sButtonHoverText;
67     nscolor sButtonBackground;
68     nscolor sFrameOuterLightBorder;
69     nscolor sFrameInnerDarkBorder;
70     nscolor sOddCellBackground;
71     nscolor sNativeHyperLinkText;
72     nscolor sComboBoxText;
73     nscolor sComboBoxBackground;
74     nscolor sMozFieldText;
75     nscolor sMozFieldBackground;
76     nscolor sMozWindowText;
77     nscolor sMozWindowBackground;
78     nscolor sTextSelectedText;
79     nscolor sTextSelectedBackground;
80     nscolor sMozScrollbar;
81 #if (MOZ_WIDGET_GTK == 3)
82     nscolor sInfoBarText;
83 #endif
84     char16_t sInvisibleCharacter;
85     float   sCaretRatio;
86     bool    sMenuSupportsDrag;
87 
88     void Init();
89 };
90 
91 #endif
92