Changeset 24595 in webkit
- Timestamp:
- Jul 24, 2007 11:29:35 AM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r24585 r24595 1 2007-07-24 Alp Toker <alp.toker@collabora.co.uk> 2 3 Reviewed by Adam. 4 5 http://bugs.webkit.org/show_bug.cgi?id=14711 6 RenderThemeGdk's buttons are state-agnostic (pressed, hovered) 7 8 Remove unnecessary label from widget instances. 9 Render check and radio widgets correctly. 10 Determine the widget state and render it appropriately. 11 12 * platform/gdk/RenderThemeGdk.cpp: 13 (WebCore::RenderThemeGdk::determineState): 14 (WebCore::RenderThemeGdk::paintCheckbox): 15 (WebCore::RenderThemeGdk::paintRadio): 16 (WebCore::RenderThemeGdk::paintButton): 17 (WebCore::RenderThemeGdk::gtkButton): 18 (WebCore::RenderThemeGdk::gtkCheckbox): 19 (WebCore::RenderThemeGdk::gtkRadioButton): 20 * platform/gdk/RenderThemeGdk.h: 21 1 22 2007-07-24 Mark Rowe <mrowe@apple.com> 2 23 -
trunk/WebCore/platform/gdk/RenderThemeGdk.cpp
r24322 r24595 5 5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 6 6 * Copyright (C) 2007 Holger Hans Peter Freyther 7 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> 7 8 * All rights reserved. 8 9 * … … 34 35 #define THEME_COLOR 204 35 36 #define THEME_FONT 210 36 37 // Generic state constants38 #define TS_NORMAL 139 #define TS_HOVER 240 #define TS_ACTIVE 341 #define TS_DISABLED 442 #define TS_FOCUSED 543 37 44 38 // Button constants … … 132 126 } 133 127 134 unsignedRenderThemeGdk::determineState(RenderObject* o)135 { 136 unsigned result = TS_NORMAL;128 GtkStateType RenderThemeGdk::determineState(RenderObject* o) 129 { 130 GtkStateType result = GTK_STATE_NORMAL; 137 131 if (!isEnabled(o)) 138 result = TS_DISABLED; 139 else if (isReadOnlyControl(o)) 140 result = TFS_READONLY; // Readonly is supported on textfields. 141 else if (supportsFocus(o->style()->appearance()) && isFocused(o)) 142 result = TS_FOCUSED; 132 result = GTK_STATE_INSENSITIVE; 143 133 else if (isPressed(o)) 144 result = TS_ACTIVE;134 result = GTK_STATE_ACTIVE; 145 135 else if (isHovered(o)) 146 result = TS_HOVER; 147 if (isChecked(o)) 148 result += 4; // 4 unchecked states, 4 checked states. 136 result = GTK_STATE_PRELIGHT; 149 137 return result; 150 138 } … … 188 176 // FIXME: is it the right thing to do? 189 177 GtkWidget *checkbox = gtkCheckbox(); 190 gtk_paint_ box(checkbox->style, i.context->gdkDrawable(),191 GTK_STATE_NORMAL,GTK_SHADOW_OUT,192 NULL, checkbox, "checkbutton",193 rect.x(), rect.y(), rect.width(), rect.height());178 gtk_paint_check(checkbox->style, i.context->gdkDrawable(), 179 determineState(o), isChecked(o) ? GTK_SHADOW_IN : GTK_SHADOW_OUT, 180 NULL, checkbox, "checkbutton", 181 rect.x(), rect.y(), rect.width(), rect.height()); 194 182 195 183 return false; … … 220 208 // FIXME: is it the right thing to do? 221 209 GtkWidget *radio = gtkRadioButton(); 222 gtk_paint_ box(radio->style, i.context->gdkDrawable(),223 GTK_STATE_NORMAL,GTK_SHADOW_OUT,224 NULL, radio, "radiobutton",225 rect.x(), rect.y(), rect.width(), rect.height());226 227 return false; 228 } 229 230 bool RenderThemeGdk::paintButton(RenderObject* , const RenderObject::PaintInfo& i, const IntRect& rect)210 gtk_paint_option(radio->style, i.context->gdkDrawable(), 211 determineState(o), isChecked(o) ? GTK_SHADOW_IN : GTK_SHADOW_OUT, 212 NULL, radio, "radiobutton", 213 rect.x(), rect.y(), rect.width(), rect.height()); 214 215 return false; 216 } 217 218 bool RenderThemeGdk::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) 231 219 { 232 220 // FIXME: should use theme-aware drawing. This should honor the state as well 233 221 GtkWidget *button = gtkButton(); 234 222 gtk_paint_box(button->style, i.context->gdkDrawable(), 235 GTK_STATE_NORMAL,GTK_SHADOW_OUT,223 determineState(o), isChecked(o) ? GTK_SHADOW_IN : GTK_SHADOW_OUT, 236 224 NULL, button, "button", 237 225 rect.x(), rect.y(), rect.width(), rect.height()); … … 267 255 { 268 256 if (!m_gtkButton) { 269 m_gtkButton = gtk_button_new _with_label("WebKit rocks");257 m_gtkButton = gtk_button_new(); 270 258 gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkButton); 271 259 gtk_widget_realize(m_gtkButton); … … 278 266 { 279 267 if (!m_gtkCheckbox) { 280 m_gtkCheckbox = gtk_check_button_new _with_label("WebKit rocks");268 m_gtkCheckbox = gtk_check_button_new(); 281 269 gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkCheckbox); 282 270 gtk_widget_realize(m_gtkCheckbox); … … 289 277 { 290 278 if (!m_gtkRadioButton) { 291 m_gtkRadioButton = gtk_radio_button_new _with_label(NULL, "WebKit rocks");279 m_gtkRadioButton = gtk_radio_button_new(NULL); 292 280 gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkRadioButton); 293 281 gtk_widget_realize(m_gtkRadioButton); -
trunk/WebCore/platform/gdk/RenderThemeGdk.h
r24322 r24595 70 70 void close(); 71 71 72 unsigneddetermineState(RenderObject*);72 GtkStateType determineState(RenderObject*); 73 73 bool supportsFocus(EAppearance); 74 74
Note: See TracChangeset
for help on using the changeset viewer.