Changeset 24595 in webkit


Ignore:
Timestamp:
Jul 24, 2007 11:29:35 AM (17 years ago)
Author:
alp
Message:

2007-07-24 Alp Toker <alp.toker@collabora.co.uk>

Reviewed by Adam.

http://bugs.webkit.org/show_bug.cgi?id=14711
RenderThemeGdk's buttons are state-agnostic (pressed, hovered)

Remove unnecessary label from widget instances.
Render check and radio widgets correctly.
Determine the widget state and render it appropriately.

  • platform/gdk/RenderThemeGdk.cpp: (WebCore::RenderThemeGdk::determineState): (WebCore::RenderThemeGdk::paintCheckbox): (WebCore::RenderThemeGdk::paintRadio): (WebCore::RenderThemeGdk::paintButton): (WebCore::RenderThemeGdk::gtkButton): (WebCore::RenderThemeGdk::gtkCheckbox): (WebCore::RenderThemeGdk::gtkRadioButton):
  • platform/gdk/RenderThemeGdk.h:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r24585 r24595  
     12007-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
    1222007-07-24  Mark Rowe  <mrowe@apple.com>
    223
  • trunk/WebCore/platform/gdk/RenderThemeGdk.cpp

    r24322 r24595  
    55 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
    66 * Copyright (C) 2007 Holger Hans Peter Freyther
     7 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk>
    78 * All rights reserved.
    89 *
     
    3435#define THEME_COLOR 204
    3536#define THEME_FONT  210
    36 
    37 // Generic state constants
    38 #define TS_NORMAL    1
    39 #define TS_HOVER     2
    40 #define TS_ACTIVE    3
    41 #define TS_DISABLED  4
    42 #define TS_FOCUSED   5
    4337
    4438// Button constants
     
    132126}
    133127
    134 unsigned RenderThemeGdk::determineState(RenderObject* o)
    135 {
    136     unsigned result = TS_NORMAL;
     128GtkStateType RenderThemeGdk::determineState(RenderObject* o)
     129{
     130    GtkStateType result = GTK_STATE_NORMAL;
    137131    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;
    143133    else if (isPressed(o))
    144         result = TS_ACTIVE;
     134        result = GTK_STATE_ACTIVE;
    145135    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;
    149137    return result;
    150138}
     
    188176    // FIXME: is it the right thing to do?
    189177    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());
    194182
    195183    return false;
     
    220208    // FIXME: is it the right thing to do?
    221209    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
     218bool RenderThemeGdk::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
    231219{
    232220    // FIXME: should use theme-aware drawing. This should honor the state as well
    233221    GtkWidget *button = gtkButton();
    234222    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,
    236224                  NULL, button, "button",
    237225                  rect.x(), rect.y(), rect.width(), rect.height());
     
    267255{
    268256    if (!m_gtkButton) {
    269         m_gtkButton = gtk_button_new_with_label("WebKit rocks");
     257        m_gtkButton = gtk_button_new();
    270258        gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkButton);
    271259        gtk_widget_realize(m_gtkButton);
     
    278266{
    279267    if (!m_gtkCheckbox) {
    280         m_gtkCheckbox = gtk_check_button_new_with_label("WebKit rocks");
     268        m_gtkCheckbox = gtk_check_button_new();
    281269        gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkCheckbox);
    282270        gtk_widget_realize(m_gtkCheckbox);
     
    289277{
    290278    if (!m_gtkRadioButton) {
    291         m_gtkRadioButton = gtk_radio_button_new_with_label(NULL, "WebKit rocks");
     279        m_gtkRadioButton = gtk_radio_button_new(NULL);
    292280        gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkRadioButton);
    293281        gtk_widget_realize(m_gtkRadioButton);
  • trunk/WebCore/platform/gdk/RenderThemeGdk.h

    r24322 r24595  
    7070    void close();
    7171
    72     unsigned determineState(RenderObject*);
     72    GtkStateType determineState(RenderObject*);
    7373    bool supportsFocus(EAppearance);
    7474
Note: See TracChangeset for help on using the changeset viewer.