Home | History | Annotate | Download | only in rendering
      1 /*
      2  * This file is part of the WebKit project.
      3  *
      4  * Copyright (C) 2006, 2008 Apple Computer, Inc.
      5  * Copyright (C) 2009 Torch Mobile, 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 RenderThemeWinCE_h
     25 #define RenderThemeWinCE_h
     26 
     27 #include "RenderTheme.h"
     28 
     29 typedef void* HANDLE;
     30 typedef struct HINSTANCE__* HINSTANCE;
     31 typedef HINSTANCE HMODULE;
     32 
     33 namespace WebCore {
     34 
     35     struct ThemeData {
     36         ThemeData() :m_part(0), m_state(0), m_classicState(0) {}
     37         ThemeData(int part, int state)
     38             : m_part(part)
     39             , m_state(state)
     40             , m_classicState(0)
     41         { }
     42 
     43         unsigned m_part;
     44         unsigned m_state;
     45         unsigned m_classicState;
     46     };
     47 
     48     class RenderThemeWinCE : public RenderTheme {
     49     public:
     50         static PassRefPtr<RenderTheme> create();
     51         ~RenderThemeWinCE();
     52 
     53         virtual String extraDefaultStyleSheet();
     54         virtual String extraQuirksStyleSheet();
     55 
     56         // A method asking if the theme's controls actually care about redrawing when hovered.
     57         virtual bool supportsHover(const RenderStyle*) const;
     58 
     59         virtual Color platformActiveSelectionBackgroundColor() const;
     60         virtual Color platformInactiveSelectionBackgroundColor() const;
     61         virtual Color platformActiveSelectionForegroundColor() const;
     62         virtual Color platformInactiveSelectionForegroundColor() const;
     63 
     64         // System fonts.
     65         virtual void systemFont(int propId, FontDescription&) const;
     66         virtual Color systemColor(int cssValueId) const;
     67 
     68         virtual bool paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& r)
     69         { return paintButton(o, i, r); }
     70         virtual void setCheckboxSize(RenderStyle*) const;
     71 
     72         virtual bool paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& r)
     73         { return paintButton(o, i, r); }
     74         virtual void setRadioSize(RenderStyle* style) const
     75         { return setCheckboxSize(style); }
     76 
     77         virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&);
     78 
     79         virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
     80 
     81         virtual bool paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r)
     82         { return paintTextField(o, i, r); }
     83 
     84         virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
     85         virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
     86         virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
     87 
     88         virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
     89 
     90         virtual bool paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& r);
     91         virtual bool paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r);
     92         virtual void adjustSliderThumbSize(RenderObject*) const;
     93 
     94         virtual bool popupOptionSupportsTextIndent() const { return true; }
     95 
     96         virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     97         virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
     98 
     99         virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    100         virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&);
    101 
    102         virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    103         virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return false; }
    104 
    105         virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    106         virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&);
    107 
    108         virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    109         virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&);
    110 
    111         virtual void themeChanged();
    112 
    113         virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
    114         virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
    115         virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
    116 
    117         static void setWebKitIsBeingUnloaded();
    118 
    119         virtual bool supportsFocusRing(const RenderStyle*) const;
    120 
    121     #if ENABLE(VIDEO)
    122         virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
    123         virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
    124         virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
    125         virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&);
    126         virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&);
    127         virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
    128         virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
    129     #endif
    130 
    131     private:
    132         RenderThemeWinCE();
    133 
    134         unsigned determineClassicState(RenderObject*);
    135         bool supportsFocus(ControlPart) const;
    136 
    137         ThemeData getThemeData(RenderObject*);
    138     };
    139 
    140 };
    141 
    142 #endif // RenderThemeWinCE_h
    143