Changeset 429 for trunk/WebCore/platform/wx/RenderThemeWx.cpp
- Timestamp:
- 08/04/08 12:23:14 (5 months ago)
- Files:
-
- trunk/WebCore/platform/wx/RenderThemeWx.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/WebCore/platform/wx/RenderThemeWx.cpp
r243 r429 30 30 #include "FrameView.h" 31 31 #include "GraphicsContext.h" 32 #include "NotImplemented.h" 32 33 #include "RenderView.h" 34 35 #include "WebKit/wx/WebView.h" 33 36 34 37 #include <wx/defs.h> … … 61 64 virtual void setRadioSize(RenderStyle*) const; 62 65 66 virtual void adjustRepaintRect(const RenderObject*, IntRect&); 67 63 68 virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 64 69 virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); … … 67 72 virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 68 73 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 69 82 virtual bool isControlStyled(const RenderStyle*, const BorderData&, 70 83 const FillLayer&, const Color&) const; … … 79 92 virtual Color platformActiveSelectionForegroundColor() const; 80 93 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; 81 99 82 100 private: … … 87 105 }; 88 106 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 89 121 RenderTheme* theme() 90 122 { … … 100 132 101 133 return RenderTheme::isControlStyled(style, border, background, backgroundColor); 134 } 135 136 void 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 } 102 146 } 103 147 … … 191 235 wxWindow* window = o->view()->frameView()->nativeWindow(); 192 236 wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); 193 wxASSERT(dc->IsOk());194 195 237 int flags = 0; 196 238 … … 207 249 if (appearance == PushButtonAppearance || appearance == ButtonAppearance) 208 250 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 } 211 256 else if(appearance == CheckboxAppearance) { 212 257 if (isChecked(o)) … … 214 259 wxRendererNative::Get().DrawCheckBox(window, *dc, r, flags); 215 260 } 261 return false; 262 } 263 264 void RenderThemeWx::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const 265 { 266 267 } 268 269 bool 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 277 int RenderThemeWx::minimumMenuListSize(RenderStyle*) const 278 { 279 return MINIMUM_MENU_LIST_SIZE; 280 } 281 282 void RenderThemeWx::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const 283 { 284 } 285 286 bool 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; 216 294 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 217 303 return false; 218 304 } 219 305 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(); 306 void RenderThemeWx::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const 307 { 308 notImplemented(); 309 } 310 311 bool 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 233 328 return false; 234 329 } 235 330 331 236 332 Color RenderThemeWx::platformActiveSelectionBackgroundColor() const 237 333 { … … 263 359 } 264 360 265 } 266 361 int RenderThemeWx::popupInternalPaddingLeft(RenderStyle*) const 362 { 363 return POPUP_INTERNAL_PADDING_LEFT; 364 } 365 366 int RenderThemeWx::popupInternalPaddingRight(RenderStyle*) const 367 { 368 return POPUP_INTERNAL_PADDING_RIGHT; 369 } 370 371 int RenderThemeWx::popupInternalPaddingTop(RenderStyle*) const 372 { 373 return POPUP_INTERNAL_PADDING_TOP; 374 } 375 376 int RenderThemeWx::popupInternalPaddingBottom(RenderStyle*) const 377 { 378 return POPUP_INTERNAL_PADDING_BOTTOM; 379 } 380 381 } 382
