2 * This file is part of the WebKit project.
4 * Copyright (C) 2006, 2008 Apple Computer, Inc.
5 * Copyright (C) 2009 Kenneth Rohde Christiansen
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #ifndef RenderThemeWin_h
25 #define RenderThemeWin_h
27 #include "RenderTheme.h"
31 typedef struct HINSTANCE__* HINSTANCE;
32 typedef HINSTANCE HMODULE;
38 ThemeData() :m_part(0), m_state(0), m_classicState(0) {}
39 ThemeData(int part, int state)
47 unsigned m_classicState;
50 class RenderThemeWin : public RenderTheme {
52 static PassRefPtr<RenderTheme> create();
54 virtual String extraDefaultStyleSheet();
55 virtual String extraQuirksStyleSheet();
57 // A method asking if the theme's controls actually care about redrawing when hovered.
58 virtual bool supportsHover(const RenderStyle*) const;
60 virtual Color platformActiveSelectionBackgroundColor() const;
61 virtual Color platformInactiveSelectionBackgroundColor() const;
62 virtual Color platformActiveSelectionForegroundColor() const;
63 virtual Color platformInactiveSelectionForegroundColor() const;
66 virtual void systemFont(int propId, FontDescription&) const;
67 virtual Color systemColor(int cssValueId) const;
69 virtual bool paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& r)
70 { return paintButton(o, i, r); }
71 virtual void setCheckboxSize(RenderStyle*) const;
73 virtual bool paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& r)
74 { return paintButton(o, i, r); }
75 virtual void setRadioSize(RenderStyle* style) const
76 { return setCheckboxSize(style); }
78 virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&);
80 virtual void adjustInnerSpinButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
81 virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&);
83 virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
85 virtual bool paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r)
86 { return paintTextField(o, i, r); }
88 virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
89 virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
90 virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
92 virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
94 virtual bool paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& r);
95 virtual bool paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r);
96 virtual void adjustSliderThumbSize(RenderStyle*) const;
98 virtual bool popupOptionSupportsTextIndent() const { return true; }
100 virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
101 virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
103 virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
104 virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&);
106 virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
107 virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return false; }
109 virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
110 virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&);
112 virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
113 virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&);
115 virtual void themeChanged();
117 virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
118 virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
119 virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
121 static void setWebKitIsBeingUnloaded();
123 virtual bool supportsFocusRing(const RenderStyle*) const;
126 virtual String extraMediaControlsStyleSheet();
127 #if ENABLE(FULLSCREEN_API)
128 virtual String extraFullScreenStyleSheet();
130 virtual bool supportsClosedCaptioning() const;
131 virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, const IntRect&);
132 virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
133 virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
134 virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
135 virtual bool paintMediaRewindButton(RenderObject*, const PaintInfo&, const IntRect&);
136 virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&);
137 virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&);
138 virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
139 virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
140 virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&);
141 virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&);
142 virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
143 virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
144 virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const;
147 virtual bool shouldShowPlaceholderWhenFocused() const { return true; }
150 enum ControlSubPart {
159 void addIntrinsicMargins(RenderStyle*) const;
162 unsigned determineState(RenderObject*);
163 unsigned determineClassicState(RenderObject*, ControlSubPart = None);
164 unsigned determineSliderThumbState(RenderObject*);
165 unsigned determineButtonState(RenderObject*);
166 unsigned determineSpinButtonState(RenderObject*, ControlSubPart = None);
168 bool supportsFocus(ControlPart) const;
170 ThemeData getThemeData(RenderObject*, ControlSubPart = None);
171 ThemeData getClassicThemeData(RenderObject* o, ControlSubPart = None);
173 HANDLE buttonTheme() const;
174 HANDLE textFieldTheme() const;
175 HANDLE menuListTheme() const;
176 HANDLE sliderTheme() const;
177 HANDLE spinButtonTheme() const;
179 mutable HANDLE m_buttonTheme;
180 mutable HANDLE m_textFieldTheme;
181 mutable HANDLE m_menuListTheme;
182 mutable HANDLE m_sliderTheme;
183 mutable HANDLE m_spinButtonTheme;