webengine/osswebengine/WebCore/platform/symbian/RenderThemeSymbian.cpp
changeset 5 10e98eab6f85
parent 0 dd21522fd290
child 36 c711bdda59f4
equal deleted inserted replaced
1:7c90e6132015 5:10e98eab6f85
    13 *
    13 *
    14 * Description:  
    14 * Description:  
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 #include "RenderThemeSymbian.h"
    19 #include "config.h"
    19 #include "staticobjectscontainer.h"
    20 
       
    21 #include "RenderTheme.h"
       
    22 #include "Event.h"
       
    23 #include "Document.h"
       
    24 #include "Image.h"
       
    25 #include "GraphicsContext.h"
       
    26 #include <../bidi.h>
       
    27 #include <eikenv.h>
       
    28 #include "RenderBox.h"
       
    29 #include <BitmapTransforms.h>
       
    30 #include "WebCoreGraphicsContext.h"
       
    31 #include "MaskedBitmap.h"
       
    32 #include "BitmapImage.h"
       
    33 #include "WebCoreWidget.h"
       
    34 // implement Symbian theme here
    20 // implement Symbian theme here
    35 
    21 
       
    22 
       
    23 
    36 namespace WebCore {
    24 namespace WebCore {
    37 
    25 
    38 enum {
       
    39     ECheckBoxOn,
       
    40     ECheckBoxOff,
       
    41     ERadioOn,
       
    42     ERadioOff,
       
    43     ESelectArrow
       
    44 };
       
    45 
       
    46 class RenderThemeSymbian : public RenderTheme
       
    47 {
       
    48 public:
       
    49     RenderThemeSymbian();
       
    50     // A method asking if the theme's controls actually care about redrawing when hovered.
       
    51     bool supportsHover(const RenderStyle*) const { return true; }
       
    52     
       
    53     void setCheckboxSize(RenderStyle*) const;    
       
    54     void setRadioSize(RenderStyle*) const;
       
    55 
       
    56     void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
       
    57     void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
       
    58     void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
       
    59     void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
       
    60     
       
    61     bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
       
    62     bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
       
    63     bool paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
       
    64     bool paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
       
    65     bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
       
    66     bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
       
    67     bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
       
    68     
       
    69 
       
    70     bool isControlStyled(const RenderStyle*, const BorderData&,
       
    71                                  const BackgroundLayer&, const Color&) const;
       
    72     bool controlSupportsTints(const RenderObject*) const;
       
    73     void systemFont(int propId, FontDescription&) const;
       
    74     
       
    75     Color platformActiveSelectionBackgroundColor() const; 
       
    76     Color platformInactiveSelectionBackgroundColor() const;
       
    77     Color platformActiveSelectionForegroundColor() const;
       
    78     Color platformInactiveSelectionForegroundColor() const;
       
    79     
       
    80     void addIntrinsicMargins(RenderStyle*) const;
       
    81     void close();
       
    82     bool supportsFocus(EAppearance) const;
       
    83     void paintButtonDecorations(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
       
    84 
       
    85     bool supportsFocusRing(const RenderStyle*) const;
       
    86     void scaleImage(int type, int scalingFactor);
       
    87     void scaleImageL(int type, int scalingFactor);
       
    88 
       
    89     void cancel();
       
    90     void run();
       
    91 
       
    92     Image* m_checkBoxOn;
       
    93     Image* m_checkBoxOff;
       
    94     Image* m_scaledCheckBoxOn;
       
    95     Image* m_scaledCheckBoxOff;
       
    96     int m_scalingForCheckBoxOn;
       
    97     int m_scalingForCheckBoxOff;
       
    98 
       
    99     Image* m_radioButtonOn;
       
   100     Image* m_radioButtonOff;
       
   101     Image* m_scaledRadioOn;
       
   102     Image* m_scaledRadioOff;
       
   103     int m_scalingForRadioOn;
       
   104     int m_scalingForRadioOff;
       
   105 
       
   106     Image* m_selectArrow;
       
   107     Image* m_scaledSelectArrow;
       
   108     int m_scalingForSelectArrow;
       
   109 
       
   110     CBitmapScaler* m_bitmapScaler;
       
   111     CActiveSchedulerWait* m_asw;
       
   112 };
       
   113 
       
   114 RenderTheme* theme()
    26 RenderTheme* theme()
   115 {
    27 {
   116     static RenderThemeSymbian symbianTheme;
    28     return StaticObjectsContainer::instance()->theme();
   117     return &symbianTheme;
    29 }
   118 }
    30 
       
    31 
   119 
    32 
   120 MScrollView* scrollView(const RenderObject::PaintInfo& i)
    33 MScrollView* scrollView(const RenderObject::PaintInfo& i)
   121 {
    34 {
   122     return &(i.context->platformContext()->view());
    35     return &(i.context->platformContext()->view());
   123 }
    36 }
   124 
       
   125 class SyncScaler : public CActive
       
   126 {
       
   127 public:
       
   128     SyncScaler();
       
   129     ~SyncScaler();
       
   130     void init();
       
   131     void RunL();
       
   132     void DoCancel();
       
   133     TInt RunError(TInt aError);
       
   134     int m_error;
       
   135 };
       
   136 
    37 
   137 SyncScaler::SyncScaler() : CActive (CActive::EPriorityHigh)
    38 SyncScaler::SyncScaler() : CActive (CActive::EPriorityHigh)
   138 {
    39 {
   139     CActiveScheduler::Add(this);
    40     CActiveScheduler::Add(this);
   140 }
    41 }
   191     m_scalingForSelectArrow = 0;
    92     m_scalingForSelectArrow = 0;
   192 
    93 
   193     m_bitmapScaler = NULL;
    94     m_bitmapScaler = NULL;
   194     m_asw = NULL;
    95     m_asw = NULL;
   195 }
    96 }
       
    97 
       
    98 RenderThemeSymbian::~RenderThemeSymbian()
       
    99 {
       
   100 RDebug::Printf("RenderThemeSymbian::~RenderThemeSymbian");
       
   101 
       
   102     delete m_checkBoxOn;
       
   103     m_checkBoxOn = 0;
       
   104     
       
   105     delete m_checkBoxOff;
       
   106     m_checkBoxOff = 0;
       
   107     
       
   108     delete m_scaledCheckBoxOn;
       
   109     m_scaledCheckBoxOn = 0;
       
   110     
       
   111     delete m_scaledCheckBoxOff;
       
   112     m_scaledCheckBoxOff = 0;
       
   113     
       
   114     delete m_radioButtonOn;
       
   115     m_radioButtonOn = 0;
       
   116     
       
   117     delete m_radioButtonOff;
       
   118     m_radioButtonOff = 0;
       
   119      
       
   120     delete m_scaledRadioOn;
       
   121     m_scaledRadioOn = 0;
       
   122      
       
   123     delete m_scaledRadioOff;
       
   124     m_scaledRadioOff = 0;
       
   125      
       
   126     delete m_selectArrow;
       
   127     m_selectArrow = 0;
       
   128      
       
   129     delete m_scaledSelectArrow;
       
   130     m_scaledSelectArrow = 0;
       
   131 
       
   132     delete m_bitmapScaler;
       
   133     m_bitmapScaler = 0;
       
   134      
       
   135     delete m_asw;
       
   136     m_asw = 0;
       
   137 }
       
   138 
   196 
   139 
   197 void RenderThemeSymbian::systemFont(int propId, FontDescription& fontDescription) const
   140 void RenderThemeSymbian::systemFont(int propId, FontDescription& fontDescription) const
   198 {
   141 {
   199 }
   142 }
   200 
   143