1/* 2 * This file is part of the WebKit project. 3 * 4 * Copyright (C) 2006 Apple Computer, Inc. 5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 6 * Copyright (C) 2007 Holger Hans Peter Freyther 7 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 8 * Copyright (C) 2009 Kenneth Rohde Christiansen 9 * All rights reserved. 10 * 11 * This library is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Library General Public 13 * License as published by the Free Software Foundation; either 14 * version 2 of the License, or (at your option) any later version. 15 * 16 * This library is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Library General Public License for more details. 20 * 21 * You should have received a copy of the GNU Library General Public License 22 * along with this library; see the file COPYING.LIB. If not, write to 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 * Boston, MA 02110-1301, USA. 25 * 26 */ 27 28#ifndef RenderThemeGtk_h 29#define RenderThemeGtk_h 30 31#include "GRefPtr.h" 32#include "RenderTheme.h" 33 34typedef struct _GtkWidget GtkWidget; 35typedef struct _GtkStyle GtkStyle; 36typedef struct _GtkContainer GtkContainer; 37typedef struct _GdkRectangle GdkRectangle; 38typedef struct _GdkDrawable GdkDrawable; 39typedef struct _GtkBorder GtkBorder; 40typedef struct _GtkThemeParts GtkThemeParts; 41 42namespace WebCore { 43 44class RenderThemeGtk : public RenderTheme { 45private: 46 RenderThemeGtk(); 47 virtual ~RenderThemeGtk(); 48 49public: 50 static PassRefPtr<RenderTheme> create(); 51 52 // A method asking if the theme's controls actually care about redrawing when hovered. 53 virtual bool supportsHover(const RenderStyle* style) const { return true; } 54 55 // A method asking if the theme is able to draw the focus ring. 56 virtual bool supportsFocusRing(const RenderStyle*) const; 57 58 // A method asking if the control changes its tint when the window has focus or not. 59 virtual bool controlSupportsTints(const RenderObject*) const; 60 61 // A general method asking if any control tinting is supported at all. 62 virtual bool supportsControlTints() const { return true; } 63 64 // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline 65 // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of 66 // controls that need to do this. 67 virtual int baselinePosition(const RenderObject*) const; 68 69 // The platform selection color. 70 virtual Color platformActiveSelectionBackgroundColor() const; 71 virtual Color platformInactiveSelectionBackgroundColor() const; 72 virtual Color platformActiveSelectionForegroundColor() const; 73 virtual Color platformInactiveSelectionForegroundColor() const; 74 75 // List Box selection color 76 virtual Color activeListBoxSelectionBackgroundColor() const; 77 virtual Color activeListBoxSelectionForegroundColor() const; 78 virtual Color inactiveListBoxSelectionBackgroundColor() const; 79 virtual Color inactiveListBoxSelectionForegroundColor() const; 80 81 virtual double caretBlinkInterval() const; 82 83 virtual void platformColorsDidChange(); 84 85 // System fonts. 86 virtual void systemFont(int propId, FontDescription&) const; 87 88#if ENABLE(VIDEO) 89 virtual String extraMediaControlsStyleSheet(); 90#endif 91 92 GtkThemeParts* partsForDrawable(GdkDrawable*) const; 93 94protected: 95 virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); 96 virtual void setCheckboxSize(RenderStyle* style) const; 97 98 virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); 99 virtual void setRadioSize(RenderStyle* style) const; 100 101 virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 102 virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 103 104 virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 105 virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 106 107 virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 108 109 virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 110 virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 111 112 virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 113 virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 114 115 virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 116 virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 117 118 virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 119 virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 120 121 virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 122 virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 123 124 virtual void adjustSliderThumbSize(RenderObject*) const; 125 126#if ENABLE(VIDEO) 127 virtual void initMediaStyling(GtkStyle* style, bool force); 128 virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 129 virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 130 virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 131 virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 132 virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 133 virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 134 virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 135#endif 136 137private: 138 /* 139 * hold the state 140 */ 141 GtkWidget* gtkEntry() const; 142 GtkWidget* gtkTreeView() const; 143 144 /* 145 * unmapped GdkWindow having a container. This is holding all 146 * our fake widgets 147 */ 148 GtkContainer* gtkContainer() const; 149 150 mutable GtkWidget* m_gtkWindow; 151 mutable GtkContainer* m_gtkContainer; 152 mutable GtkWidget* m_gtkEntry; 153 mutable GtkWidget* m_gtkTreeView; 154 155 mutable Color m_panelColor; 156 mutable Color m_sliderColor; 157 mutable Color m_sliderThumbColor; 158 159 const int m_mediaIconSize; 160 const int m_mediaSliderHeight; 161 const int m_mediaSliderThumbWidth; 162 const int m_mediaSliderThumbHeight; 163 164 RefPtr<Image> m_fullscreenButton; 165 RefPtr<Image> m_muteButton; 166 RefPtr<Image> m_unmuteButton; 167 RefPtr<Image> m_playButton; 168 RefPtr<Image> m_pauseButton; 169 RefPtr<Image> m_seekBackButton; 170 RefPtr<Image> m_seekForwardButton; 171 Page* m_page; 172 GRefPtr<GHashTable> m_partsTable; 173 174}; 175 176} 177 178#endif // RenderThemeGtk_h 179