#ifndef RenderTheme_h
#define RenderTheme_h
#include "RenderObject.h"
namespace WebCore {
class Element;
class PopupMenu;
class RenderMenuList;
enum ControlState {
HoverState,
PressedState,
FocusState,
EnabledState,
CheckedState,
ReadOnlyState
};
class RenderTheme {
public:
RenderTheme() { }
virtual ~RenderTheme() { }
void adjustStyle(CSSStyleSelector*, RenderStyle*, Element*, bool UAHasAppearance,
const BorderData&, const BackgroundLayer&, const Color& backgroundColor);
bool paint(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
bool paintBorderOnly(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
bool paintDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual short baselinePosition(const RenderObject*) const;
virtual bool isControlContainer(EAppearance) const;
virtual bool controlSupportsTints(const RenderObject*) const { return false; }
virtual bool isControlStyled(const RenderStyle*, const BorderData&, const BackgroundLayer&, const Color& backgroundColor) const;
virtual bool supportsControlTints() const { return false; }
virtual void adjustRepaintRect(const RenderObject*, IntRect&) { }
virtual bool stateChanged(RenderObject*, ControlState) const;
virtual void themeChanged() { }
virtual bool supportsFocusRing(const RenderStyle*) const;
virtual bool supportsHover(const RenderStyle*) const { return false; }
Color activeSelectionBackgroundColor() const;
Color inactiveSelectionBackgroundColor() const;
virtual Color platformActiveSelectionBackgroundColor() const;
virtual Color platformInactiveSelectionBackgroundColor() const;
virtual Color platformActiveSelectionForegroundColor() const;
virtual Color platformInactiveSelectionForegroundColor() const;
virtual Color activeListBoxSelectionBackgroundColor() const;
virtual Color activeListBoxSelectionForegroundColor() const;
virtual Color inactiveListBoxSelectionBackgroundColor() const;
virtual Color inactiveListBoxSelectionForegroundColor() const;
void platformColorsDidChange();
virtual void systemFont(int propId, FontDescription&) const = 0;
virtual int minimumMenuListSize(RenderStyle*) const { return 0; }
virtual void adjustSliderThumbSize(RenderObject*) const;
bool isChecked(const RenderObject*) const;
bool isIndeterminate(const RenderObject*) const;
bool isEnabled(const RenderObject*) const;
bool isFocused(const RenderObject*) const;
bool isPressed(const RenderObject*) const;
bool isHovered(const RenderObject*) const;
bool isReadOnlyControl(const RenderObject*) const;
virtual int popupInternalPaddingLeft(RenderStyle*) const { return 0; }
virtual int popupInternalPaddingRight(RenderStyle*) const { return 0; }
virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; }
virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; }
protected:
virtual void adjustCheckboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void setCheckboxSize(RenderStyle*) const { }
virtual void adjustRadioStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void setRadioSize(RenderStyle*) const { }
virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void setButtonSize(RenderStyle*) const { }
virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
private:
mutable Color m_activeSelectionColor;
mutable Color m_inactiveSelectionColor;
};
RenderTheme* theme();
}
#endif // RenderTheme_h