Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-29062009...
[qt-netbsd.git] / src / 3rdparty / webkit / WebCore / rendering / RenderThemeSafari.h
blob4685238794fd86e3632a2af5309937fb0b8e6585
1 /*
2 * Copyright (C) 2007, 2008 Apple Inc.
3 * Copyright (C) 2009 Kenneth Rohde Christiansen
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 #ifndef RenderThemeSafari_h
23 #define RenderThemeSafari_h
25 #if USE(SAFARI_THEME)
27 #include "RenderTheme.h"
29 // If you have an empty placeholder SafariThemeConstants.h, then include SafariTheme.h
30 // This is a workaround until a version of WebKitSupportLibrary is released with an updated SafariThemeConstants.h
31 #include <SafariTheme/SafariThemeConstants.h>
32 #ifndef SafariThemeConstants_h
33 #include <SafariTheme/SafariTheme.h>
34 #endif
36 #if PLATFORM(WIN)
37 typedef void* HANDLE;
38 typedef struct HINSTANCE__* HINSTANCE;
39 typedef HINSTANCE HMODULE;
40 #endif
42 namespace WebCore {
44 using namespace SafariTheme;
46 class RenderStyle;
48 class RenderThemeSafari : public RenderTheme {
49 public:
50 static PassRefPtr<RenderTheme> create();
52 // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
53 // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
54 // controls that need to do this.
55 virtual int baselinePosition(const RenderObject*) const;
57 // A method asking if the control changes its tint when the window has focus or not.
58 virtual bool controlSupportsTints(const RenderObject*) const;
60 // A general method asking if any control tinting is supported at all.
61 virtual bool supportsControlTints() const { return true; }
63 virtual void adjustRepaintRect(const RenderObject*, IntRect&);
65 virtual bool isControlStyled(const RenderStyle*, const BorderData&,
66 const FillLayer&, const Color& backgroundColor) const;
68 virtual Color platformActiveSelectionBackgroundColor() const;
69 virtual Color platformInactiveSelectionBackgroundColor() const;
70 virtual Color activeListBoxSelectionBackgroundColor() const;
72 virtual Color focusRingColor() const;
74 // System fonts.
75 virtual void systemFont(int propId, FontDescription&) const;
77 virtual int minimumMenuListSize(RenderStyle*) const;
79 virtual void adjustSliderThumbSize(RenderObject*) const;
80 virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
82 virtual int popupInternalPaddingLeft(RenderStyle*) const;
83 virtual int popupInternalPaddingRight(RenderStyle*) const;
84 virtual int popupInternalPaddingTop(RenderStyle*) const;
85 virtual int popupInternalPaddingBottom(RenderStyle*) const;
87 protected:
88 // Methods for each appearance value.
89 virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
90 virtual void setCheckboxSize(RenderStyle*) const;
92 virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
93 virtual void setRadioSize(RenderStyle*) const;
95 virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
96 virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
97 virtual void setButtonSize(RenderStyle*) const;
99 virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
100 virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
102 virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
103 virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
105 virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
106 virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
108 virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
109 virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
111 virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
112 virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
114 virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
115 virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
117 virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
118 virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
120 virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
121 virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
123 virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
124 virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
126 virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
127 virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
129 virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
131 #if ENABLE(VIDEO)
132 virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
133 virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
134 virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
135 virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
136 virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
137 virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
138 virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
139 #endif
141 private:
142 RenderThemeSafari();
143 virtual ~RenderThemeSafari();
145 IntRect inflateRect(const IntRect&, const IntSize&, const int* margins) const;
147 // Get the control size based off the font. Used by some of the controls (like buttons).
149 NSControlSize controlSizeForFont(RenderStyle*) const;
150 NSControlSize controlSizeForSystemFont(RenderStyle*) const;
151 //void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize);
152 void setSizeFromFont(RenderStyle*, const IntSize* sizes) const;
153 IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const;
154 IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const;
155 void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const;
157 // Helpers for adjusting appearance and for painting
158 const IntSize* checkboxSizes() const;
159 const int* checkboxMargins(NSControlSize) const;
161 const IntSize* radioSizes() const;
162 const int* radioMargins(NSControlSize) const;
164 void setButtonPaddingFromControlSize(RenderStyle*, NSControlSize) const;
165 const IntSize* buttonSizes() const;
166 const int* buttonMargins(NSControlSize) const;
168 const IntSize* popupButtonSizes() const;
169 const int* popupButtonMargins(NSControlSize) const;
170 const int* popupButtonPadding(NSControlSize) const;
171 void paintMenuListButtonGradients(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
172 const IntSize* menuListSizes() const;
174 const IntSize* searchFieldSizes() const;
175 const IntSize* cancelButtonSizes() const;
176 const IntSize* resultsButtonSizes() const;
177 void setSearchFieldSize(RenderStyle*) const;
179 ThemeControlState determineState(RenderObject*) const;
182 } // namespace WebCore
184 #endif // #if USE(SAFARI_THEME)
186 #endif // RenderThemeSafari_h