]> git.saurik.com Git - iphone-api.git/blob - WebCore/RenderThemeWin.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / RenderThemeWin.h
1 /*
2 * This file is part of the WebKit project.
3 *
4 * Copyright (C) 2006, 2008 Apple Computer, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #ifndef RenderThemeWin_h
24 #define RenderThemeWin_h
25
26 #include "RenderTheme.h"
27
28 #if WIN32
29 typedef void* HANDLE;
30 typedef struct HINSTANCE__* HINSTANCE;
31 typedef HINSTANCE HMODULE;
32 #endif
33
34 namespace WebCore {
35
36 struct ThemeData {
37 ThemeData() :m_part(0), m_state(0), m_classicState(0) {}
38 ThemeData(int part, int state)
39 : m_part(part)
40 , m_state(state)
41 , m_classicState(0)
42 { }
43
44 unsigned m_part;
45 unsigned m_state;
46 unsigned m_classicState;
47 };
48
49 class RenderThemeWin : public RenderTheme {
50 public:
51 RenderThemeWin();
52 ~RenderThemeWin();
53
54 virtual String extraDefaultStyleSheet();
55 virtual String extraQuirksStyleSheet();
56
57 // A method asking if the theme's controls actually care about redrawing when hovered.
58 virtual bool supportsHover(const RenderStyle*) const;
59
60 virtual Color platformActiveSelectionBackgroundColor() const;
61 virtual Color platformInactiveSelectionBackgroundColor() const;
62 virtual Color platformActiveSelectionForegroundColor() const;
63 virtual Color platformInactiveSelectionForegroundColor() const;
64
65 // System fonts.
66 virtual void systemFont(int propId, FontDescription&) const;
67 virtual Color systemColor(int cssValueId) const;
68
69 virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
70 { return paintButton(o, i, r); }
71 virtual void setCheckboxSize(RenderStyle*) const;
72
73 virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
74 { return paintButton(o, i, r); }
75 virtual void setRadioSize(RenderStyle* style) const
76 { return setCheckboxSize(style); }
77
78 virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
79
80 virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
81
82 virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
83 { return paintTextField(o, i, r); }
84
85 virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
86 virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
87 virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
88
89 virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
90
91 virtual bool paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
92 virtual bool paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
93 virtual void adjustSliderThumbSize(RenderObject*) const;
94
95 virtual void adjustButtonInnerStyle(RenderStyle*) const;
96
97 virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
98 virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
99
100 virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
101 virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
102
103 virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
104 virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return false; }
105
106 virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
107 virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
108
109 virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
110 virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
111
112 virtual void themeChanged();
113
114 virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
115 virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
116 virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
117
118 static void setWebKitIsBeingUnloaded();
119
120 virtual bool supportsFocusRing(const RenderStyle*) const;
121
122 private:
123 void addIntrinsicMargins(RenderStyle*) const;
124 void close();
125
126 unsigned determineState(RenderObject*);
127 unsigned determineClassicState(RenderObject*);
128 unsigned determineSliderThumbState(RenderObject*);
129 unsigned determineButtonState(RenderObject*);
130
131 bool supportsFocus(ControlPart) const;
132
133 ThemeData getThemeData(RenderObject*);
134 ThemeData getClassicThemeData(RenderObject* o);
135
136 HANDLE buttonTheme() const;
137 HANDLE textFieldTheme() const;
138 HANDLE menuListTheme() const;
139 HANDLE sliderTheme() const;
140
141 mutable HANDLE m_buttonTheme;
142 mutable HANDLE m_textFieldTheme;
143 mutable HANDLE m_menuListTheme;
144 mutable HANDLE m_sliderTheme;
145 };
146
147 };
148
149 #endif