OSDN Git Service

74820f2c98788aed13156c61692375dba49da7ab
[android-x86/external-webkit.git] / WebCore / platform / android / RenderThemeAndroid.h
1 /*
2  * Copyright 2006, The Android Open Source Project
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *  * Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  *  * Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #ifndef RenderThemeAndroid_h
27 #define RenderThemeAndroid_h
28
29 #include "RenderTheme.h"
30
31 namespace WebCore {
32
33 class RenderSkinButton;
34 class RenderSkinRadio;
35 class RenderSkinCombo;
36
37 struct ThemeData {
38     ThemeData()
39         : m_part(0)
40         , m_state(0)
41     {
42     }
43
44     unsigned m_part;
45     unsigned m_state;
46 };
47
48 class RenderThemeAndroid : public RenderTheme {
49 public:
50     static PassRefPtr<RenderTheme> create();
51     ~RenderThemeAndroid();
52     
53     virtual bool stateChanged(RenderObject*, ControlState) const;
54        
55     virtual bool supportsFocusRing(const RenderStyle*) const;
56     // A method asking if the theme's controls actually care about redrawing when hovered.
57     virtual bool supportsHover(const RenderStyle* style) const { return style->affectedByHoverRules(); }
58
59     virtual int baselinePosition(const RenderObject*) const;
60
61     virtual Color platformActiveSelectionBackgroundColor() const;
62     virtual Color platformInactiveSelectionBackgroundColor() const;
63     virtual Color platformActiveSelectionForegroundColor() const;
64     virtual Color platformInactiveSelectionForegroundColor() const;
65     virtual Color platformTextSearchHighlightColor() const;
66
67     virtual Color platformActiveListBoxSelectionBackgroundColor() const;
68     virtual Color platformInactiveListBoxSelectionBackgroundColor() const;
69     virtual Color platformActiveListBoxSelectionForegroundColor() const;
70     virtual Color platformInactiveListBoxSelectionForegroundColor() const;
71
72     virtual void systemFont(int, WebCore::FontDescription&) const {}
73
74     virtual int minimumMenuListSize(RenderStyle*) const { return 0; }
75
76 protected:
77     virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&);
78     virtual void setCheckboxSize(RenderStyle*) const;
79
80 #if ENABLE(VIDEO)
81     virtual String extraMediaControlsStyleSheet();
82     virtual void adjustSliderThumbSize(RenderObject* o) const;
83     virtual bool shouldRenderMediaControlPart(ControlPart part, Element* e);
84     bool paintMediaMuteButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
85     bool paintMediaPlayButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
86     bool paintMediaSeekBackButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
87     bool paintMediaSeekForwardButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
88     bool paintMediaSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
89     bool paintMediaSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
90     virtual bool paintMediaControlsBackground(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect);
91 #endif
92
93     virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&);
94     virtual void setRadioSize(RenderStyle*) const;
95
96     virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
97     virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&);
98
99     virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
100     virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
101
102     virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
103     virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&);
104     
105     bool paintCombo(RenderObject*, const PaintInfo&,  const IntRect&);
106
107     virtual void adjustListboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
108     virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
109     virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
110
111     virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
112     virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
113     
114     virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
115     virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
116
117 private:
118     RenderThemeAndroid();
119     void addIntrinsicMargins(RenderStyle*) const;
120     void close();
121
122     bool supportsFocus(ControlPart);
123     friend RenderTheme* theme();
124 };
125
126 } // namespace WebCore
127
128 #endif // RenderThemeAndroid_h