]> git.saurik.com Git - iphone-api.git/blob - WebCore/RenderThemeChromiumWin.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / RenderThemeChromiumWin.h
1 /*
2 * This file is part of the WebKit project.
3 *
4 * Copyright (C) 2006 Apple Computer, Inc.
5 * Copyright (C) 2008, 2009 Google, Inc.
6 *
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.
11 *
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.
16 *
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.
21 *
22 */
23
24 #ifndef RenderThemeChromiumWin_h
25 #define RenderThemeChromiumWin_h
26
27 #include "RenderTheme.h"
28
29 #if WIN32
30 typedef void* HANDLE;
31 typedef struct HINSTANCE__* HINSTANCE;
32 typedef HINSTANCE HMODULE;
33 #endif
34
35 namespace WebCore {
36
37 struct ThemeData {
38 ThemeData() : m_part(0), m_state(0), m_classicState(0) {}
39
40 unsigned m_part;
41 unsigned m_state;
42 unsigned m_classicState;
43 };
44
45 class RenderThemeChromiumWin : public RenderTheme {
46 public:
47 RenderThemeChromiumWin() { }
48 ~RenderThemeChromiumWin() { }
49
50 virtual String extraDefaultStyleSheet();
51 virtual String extraQuirksStyleSheet();
52
53 // A method asking if the theme's controls actually care about redrawing when hovered.
54 virtual bool supportsHover(const RenderStyle*) const { return true; }
55
56 // A method asking if the theme is able to draw the focus ring.
57 virtual bool supportsFocusRing(const RenderStyle*) const;
58
59 // The platform selection color.
60 virtual Color platformActiveSelectionBackgroundColor() const;
61 virtual Color platformInactiveSelectionBackgroundColor() const;
62 virtual Color platformActiveSelectionForegroundColor() const;
63 virtual Color platformInactiveSelectionForegroundColor() const;
64 virtual Color platformTextSearchHighlightColor() const;
65
66 virtual double caretBlinkInterval() const;
67
68 // System fonts.
69 virtual void systemFont(int propId, Document*, FontDescription&) const;
70
71 virtual int minimumMenuListSize(RenderStyle*) const;
72
73 virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); }
74 virtual void setCheckboxSize(RenderStyle*) const;
75
76 virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); }
77 virtual void setRadioSize(RenderStyle*) const;
78
79 virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
80
81 virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
82
83 virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); }
84
85 virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
86
87 // MenuList refers to an unstyled menulist (meaning a menulist without
88 // background-color or border set) and MenuListButton refers to a styled
89 // menulist (a menulist with background-color or border set). They have
90 // this distinction to support showing aqua style themes whenever they
91 // possibly can, which is something we don't want to replicate.
92 //
93 // In short, we either go down the MenuList code path or the MenuListButton
94 // codepath. We never go down both. And in both cases, they render the
95 // entire menulist.
96 virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
97 virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
98 virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
99 virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
100
101 // These methods define the padding for the MenuList's inner block.
102 virtual int popupInternalPaddingLeft(RenderStyle*) const;
103 virtual int popupInternalPaddingRight(RenderStyle*) const;
104 virtual int popupInternalPaddingTop(RenderStyle*) const;
105 virtual int popupInternalPaddingBottom(RenderStyle*) const;
106
107 virtual void adjustButtonInnerStyle(RenderStyle*) const;
108
109 // Provide a way to pass the default font size from the Settings object
110 // to the render theme. FIXME: http://b/1129186 A cleaner way would be
111 // to remove the default font size from this object and have callers
112 // that need the value to get it directly from the appropriate Settings
113 // object.
114 static void setDefaultFontSize(int);
115
116 // Enables/Disables FindInPage mode, which (if enabled) overrides the
117 // selection rect color to be orange.
118 static void setFindInPageMode(bool);
119
120 private:
121 unsigned determineState(RenderObject*);
122 unsigned determineClassicState(RenderObject*);
123
124 ThemeData getThemeData(RenderObject*);
125
126 bool paintTextFieldInternal(RenderObject*, const RenderObject::PaintInfo&, const IntRect&, bool);
127
128 int menuListInternalPadding(RenderStyle*, int paddingType) const;
129
130 // A flag specifying whether we are in Find-in-page mode or not.
131 static bool m_findInPageMode;
132 };
133
134 } // namespace WebCore
135
136 #endif