Show
Ignore:
Timestamp:
08/04/08 12:23:14 (5 months ago)
Author:
mbensi
Message:

merge with webkit revision 35534

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/WebCore/platform/wx/RenderThemeWx.cpp

    r243 r429  
    3030#include "FrameView.h" 
    3131#include "GraphicsContext.h" 
     32#include "NotImplemented.h" 
    3233#include "RenderView.h" 
     34 
     35#include "WebKit/wx/WebView.h" 
    3336 
    3437#include <wx/defs.h> 
     
    6164    virtual void setRadioSize(RenderStyle*) const; 
    6265 
     66    virtual void adjustRepaintRect(const RenderObject*, IntRect&); 
     67 
    6368    virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 
    6469    virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 
     
    6772    virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 
    6873 
     74    virtual int minimumMenuListSize(RenderStyle*) const; 
     75 
     76    virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 
     77    virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 
     78 
     79    virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 
     80    virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 
     81 
    6982    virtual bool isControlStyled(const RenderStyle*, const BorderData&, 
    7083                                 const FillLayer&, const Color&) const; 
     
    7992    virtual Color platformActiveSelectionForegroundColor() const; 
    8093    virtual Color platformInactiveSelectionForegroundColor() const; 
     94     
     95    virtual int popupInternalPaddingLeft(RenderStyle*) const; 
     96    virtual int popupInternalPaddingRight(RenderStyle*) const; 
     97    virtual int popupInternalPaddingTop(RenderStyle*) const; 
     98    virtual int popupInternalPaddingBottom(RenderStyle*) const; 
    8199 
    82100private: 
     
    87105}; 
    88106 
     107 
     108// Constants 
     109 
     110#define MINIMUM_MENU_LIST_SIZE 21 
     111#define POPUP_INTERNAL_PADDING_LEFT 6 
     112#define POPUP_INTERNAL_PADDING_TOP 2 
     113#define POPUP_INTERNAL_PADDING_BOTTOM 2 
     114 
     115#ifdef __WXMAC__ 
     116#define POPUP_INTERNAL_PADDING_RIGHT 22 
     117#else 
     118#define POPUP_INTERNAL_PADDING_RIGHT 20 
     119#endif 
     120 
    89121RenderTheme* theme() 
    90122{ 
     
    100132 
    101133    return RenderTheme::isControlStyled(style, border, background, backgroundColor); 
     134} 
     135 
     136void RenderThemeWx::adjustRepaintRect(const RenderObject* o, IntRect& r) 
     137{ 
     138    switch (o->style()->appearance()) { 
     139        case MenulistAppearance: { 
     140            r.setWidth(r.width() + 100); 
     141            break; 
     142        } 
     143        default: 
     144            break; 
     145    } 
    102146} 
    103147 
     
    191235    wxWindow* window = o->view()->frameView()->nativeWindow(); 
    192236    wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); 
    193     wxASSERT(dc->IsOk()); 
    194  
    195237    int flags = 0; 
    196238     
     
    207249    if (appearance == PushButtonAppearance || appearance == ButtonAppearance) 
    208250        wxRendererNative::Get().DrawPushButton(window, *dc, r, flags); 
    209     // TODO: add a radio button rendering API to wx 
    210     //else if(appearance == RadioAppearance) 
     251    else if(appearance == RadioAppearance) { 
     252        if (isChecked(o)) 
     253            flags |= wxCONTROL_CHECKED;         
     254        wxRenderer_DrawRadioButton(window, *dc, r, flags); 
     255    } 
    211256    else if(appearance == CheckboxAppearance) { 
    212257        if (isChecked(o)) 
     
    214259        wxRendererNative::Get().DrawCheckBox(window, *dc, r, flags); 
    215260    } 
     261    return false; 
     262} 
     263 
     264void RenderThemeWx::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const 
     265{ 
     266     
     267} 
     268 
     269bool RenderThemeWx::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) 
     270{ 
     271    wxWindow* window = o->view()->frameView()->nativeWindow(); 
     272    wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); 
     273    wxRenderer_DrawTextCtrl(window, *dc, r, 0); 
     274    return false; 
     275} 
     276 
     277int RenderThemeWx::minimumMenuListSize(RenderStyle*) const  
     278{  
     279    return MINIMUM_MENU_LIST_SIZE;  
     280} 
     281 
     282void RenderThemeWx::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const 
     283{ 
     284} 
     285     
     286bool RenderThemeWx::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) 
     287{ 
     288    wxWindow* window = o->view()->frameView()->nativeWindow(); 
     289    wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); 
     290     
     291    int flags = 0;       
     292    if (!isEnabled(o)) 
     293        flags |= wxCONTROL_DISABLED; 
    216294         
     295    if (supportsFocus(o->style()->appearance()) && isFocused(o)) 
     296        flags |= wxCONTROL_FOCUSED; 
     297 
     298    if (isPressed(o)) 
     299        flags |= wxCONTROL_PRESSED; 
     300 
     301    wxRenderer_DrawChoice(window, *dc, r, flags); 
     302 
    217303    return false; 
    218304} 
    219305 
    220 void RenderThemeWx::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const 
    221 
    222      
    223 
    224  
    225 bool RenderThemeWx::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) 
    226 
    227     i.context->save(); 
    228     i.context->setStrokeStyle(SolidStroke); 
    229     i.context->setStrokeThickness(1); 
    230     i.context->setStrokeColor(Color(0, 0, 0)); 
    231     i.context->drawRect(r); 
    232     i.context->restore(); 
     306void RenderThemeWx::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const 
     307
     308    notImplemented(); 
     309
     310     
     311bool RenderThemeWx::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) 
     312
     313    wxWindow* window = o->view()->frameView()->nativeWindow(); 
     314    wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); 
     315     
     316    int flags = 0;       
     317    if (!isEnabled(o)) 
     318        flags |= wxCONTROL_DISABLED; 
     319         
     320    if (supportsFocus(o->style()->appearance()) && isFocused(o)) 
     321        flags |= wxCONTROL_FOCUSED; 
     322     
     323    if (isPressed(o)) 
     324        flags |= wxCONTROL_PRESSED; 
     325 
     326    wxRendererNative::Get().DrawComboBoxDropButton(window, *dc, r, flags); 
     327             
    233328    return false; 
    234329} 
    235330 
     331     
    236332Color RenderThemeWx::platformActiveSelectionBackgroundColor() const 
    237333{ 
     
    263359} 
    264360 
    265 
    266  
     361int RenderThemeWx::popupInternalPaddingLeft(RenderStyle*) const  
     362{  
     363    return POPUP_INTERNAL_PADDING_LEFT;  
     364
     365 
     366int RenderThemeWx::popupInternalPaddingRight(RenderStyle*) const  
     367
     368    return POPUP_INTERNAL_PADDING_RIGHT; 
     369
     370 
     371int RenderThemeWx::popupInternalPaddingTop(RenderStyle*) const  
     372
     373    return POPUP_INTERNAL_PADDING_TOP; 
     374
     375 
     376int RenderThemeWx::popupInternalPaddingBottom(RenderStyle*) const 
     377{  
     378    return POPUP_INTERNAL_PADDING_BOTTOM;  
     379
     380 
     381
     382