Don't use GTK_WIDGET_STATE in internal code anymore

Use gtk_widget_get/set_state() instead

https://bugzilla.gnome.org/show_bug.cgi?id=69872
This commit is contained in:
Javier Jardón 2010-03-03 21:49:33 +01:00 committed by Tristan Van Berkom
parent ca43e7d3be
commit 8ea37e551b
53 changed files with 218 additions and 197 deletions

View File

@ -57,7 +57,7 @@ scribble_expose_event (GtkWidget *widget,
*/
gdk_draw_drawable (widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
widget->style->fg_gc[gtk_widget_get_state (widget)],
pixmap,
/* Only copy the area that was exposed. */
event->area.x, event->area.y,

View File

@ -56,7 +56,7 @@ gboolean
expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
gdk_draw_arc (widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
widget->style->fg_gc[gtk_widget_get_state (widget)],
TRUE,
0, 0, widget->allocation.width, widget->allocation.height,
0, 64 * 360);

View File

@ -12777,7 +12777,7 @@ static gboolean
expose_event( GtkWidget *widget, GdkEventExpose *event )
{
gdk_draw_drawable(widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
widget->style->fg_gc[gtk_widget_get_state (widget)],
pixmap,
event->area.x, event->area.y,
event->area.x, event->area.y,
@ -12837,7 +12837,7 @@ contexts are:</para>
widget->style->white_gc
widget->style->black_gc
widget->style->fg_gc[GTK_STATE_NORMAL]
widget->style->bg_gc[GTK_WIDGET_STATE(widget)]
widget->style->bg_gc[gtk_widget_get_state(widget)]
</programlisting>
<para>The fields <literal>fg_gc</literal>, <literal>bg_gc</literal>, <literal>dark_gc</literal>, and
@ -13139,7 +13139,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
switch (source)
{
case GDK_SOURCE_MOUSE:
gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
gc = widget->style->dark_gc[gtk_widget_get_state (widget)];
break;
case GDK_SOURCE_PEN:
gc = widget->style->black_gc;
@ -13148,7 +13148,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
gc = widget->style->white_gc;
break;
default:
gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
gc = widget->style->light_gc[gtk_widget_get_state (widget)];
}
update_rect.x = x - 10 * pressure;
@ -15706,7 +15706,7 @@ static gboolean expose_event( GtkWidget *widget,
GdkEventExpose *event )
{
gdk_draw_drawable (widget-&gt;window,
widget-&gt;style-&gt;fg_gc[GTK_WIDGET_STATE (widget)],
widget-&gt;style-&gt;fg_gc[gtk_widget_get_state (widget)],
pixmap,
event-&gt;area.x, event-&gt;area.y,
event-&gt;area.x, event-&gt;area.y,
@ -15897,7 +15897,7 @@ static gboolean
expose_event (GtkWidget *widget, GdkEventExpose *event)
{
gdk_draw_drawable (widget-&gt;window,
widget-&gt;style-&gt;fg_gc[GTK_WIDGET_STATE (widget)],
widget-&gt;style-&gt;fg_gc[gtk_widget_get_state (widget)],
pixmap,
event-&gt;area.x, event-&gt;area.y,
event-&gt;area.x, event-&gt;area.y,
@ -15918,7 +15918,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
switch (source)
{
case GDK_SOURCE_MOUSE:
gc = widget-&gt;style-&gt;dark_gc[GTK_WIDGET_STATE (widget)];
gc = widget-&gt;style-&gt;dark_gc[gtk_widget_get_state (widget)];
break;
case GDK_SOURCE_PEN:
gc = widget-&gt;style-&gt;black_gc;
@ -15927,7 +15927,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
gc = widget-&gt;style-&gt;white_gc;
break;
default:
gc = widget-&gt;style-&gt;light_gc[GTK_WIDGET_STATE (widget)];
gc = widget-&gt;style-&gt;light_gc[gtk_widget_get_state (widget)];
}
update_rect.x = x - 10 * pressure;

View File

@ -50,7 +50,7 @@ static gboolean expose_event( GtkWidget *widget,
GdkEventExpose *event )
{
gdk_draw_drawable (widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
widget->style->fg_gc[gtk_widget_get_state (widget)],
pixmap,
event->area.x, event->area.y,
event->area.x, event->area.y,

View File

@ -49,7 +49,7 @@ static gboolean
expose_event (GtkWidget *widget, GdkEventExpose *event)
{
gdk_draw_drawable (widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
widget->style->fg_gc[gtk_widget_get_state (widget)],
pixmap,
event->area.x, event->area.y,
event->area.x, event->area.y,
@ -70,7 +70,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
switch (source)
{
case GDK_SOURCE_MOUSE:
gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
gc = widget->style->dark_gc[gtk_widget_get_state (widget)];
break;
case GDK_SOURCE_PEN:
gc = widget->style->black_gc;
@ -79,7 +79,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
gc = widget->style->white_gc;
break;
default:
gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
gc = widget->style->light_gc[gtk_widget_get_state (widget)];
}
update_rect.x = x - 10 * pressure;

View File

@ -413,7 +413,7 @@ gtk_accel_label_expose_event (GtkWidget *widget,
gtk_paint_layout (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
FALSE,
&event->area,
widget,

View File

@ -1520,7 +1520,7 @@ _gtk_button_paint (GtkButton *button,
}
if (button->relief != GTK_RELIEF_NONE || button->depressed ||
GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT)
gtk_widget_get_state(widget) == GTK_STATE_PRELIGHT)
gtk_paint_box (widget->style, widget->window,
state_type,
shadow_type, area, widget, "button",
@ -1559,7 +1559,7 @@ _gtk_button_paint (GtkButton *button,
y += child_displacement_y;
}
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
area, widget, "button",
x, y, width, height);
}
@ -1575,7 +1575,7 @@ gtk_button_expose (GtkWidget *widget,
GtkButton *button = GTK_BUTTON (widget);
_gtk_button_paint (button, &event->area,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
button->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
"button", "buttondefault");

View File

@ -186,16 +186,16 @@ dates_difference(guint year1, guint mm1, guint dd1,
#define SCROLL_DELAY_FACTOR 5
/* Color usage */
#define HEADER_FG_COLOR(widget) (& (widget)->style->fg[GTK_WIDGET_STATE (widget)])
#define HEADER_BG_COLOR(widget) (& (widget)->style->bg[GTK_WIDGET_STATE (widget)])
#define HEADER_FG_COLOR(widget) (& (widget)->style->fg[gtk_widget_get_state (widget)])
#define HEADER_BG_COLOR(widget) (& (widget)->style->bg[gtk_widget_get_state (widget)])
#define SELECTED_BG_COLOR(widget) (& (widget)->style->base[gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE])
#define SELECTED_FG_COLOR(widget) (& (widget)->style->text[gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE])
#define NORMAL_DAY_COLOR(widget) (& (widget)->style->text[GTK_WIDGET_STATE (widget)])
#define PREV_MONTH_COLOR(widget) (& (widget)->style->mid[GTK_WIDGET_STATE (widget)])
#define NEXT_MONTH_COLOR(widget) (& (widget)->style->mid[GTK_WIDGET_STATE (widget)])
#define MARKED_COLOR(widget) (& (widget)->style->text[GTK_WIDGET_STATE (widget)])
#define BACKGROUND_COLOR(widget) (& (widget)->style->base[GTK_WIDGET_STATE (widget)])
#define HIGHLIGHT_BACK_COLOR(widget) (& (widget)->style->mid[GTK_WIDGET_STATE (widget)])
#define NORMAL_DAY_COLOR(widget) (& (widget)->style->text[gtk_widget_get_state (widget)])
#define PREV_MONTH_COLOR(widget) (& (widget)->style->mid[gtk_widget_get_state (widget)])
#define NEXT_MONTH_COLOR(widget) (& (widget)->style->mid[gtk_widget_get_state (widget)])
#define MARKED_COLOR(widget) (& (widget)->style->text[gtk_widget_get_state (widget)])
#define BACKGROUND_COLOR(widget) (& (widget)->style->base[gtk_widget_get_state (widget)])
#define HIGHLIGHT_BACK_COLOR(widget) (& (widget)->style->mid[gtk_widget_get_state (widget)])
enum {
ARROW_YEAR_LEFT,
@ -2685,7 +2685,7 @@ gtk_calendar_expose (GtkWidget *widget,
calendar_paint_week_numbers (calendar);
if (event->window == widget->window)
{
gtk_paint_shadow (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_shadow (widget->style, widget->window, gtk_widget_get_state (widget),
GTK_SHADOW_IN, NULL, widget, "calendar",
0, 0, widget->allocation.width, widget->allocation.height);
}

View File

@ -714,7 +714,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
if (!pixbuf)
return;
if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
{
GtkIconSource *source;

View File

@ -360,7 +360,7 @@ gtk_cell_renderer_spinner_render (GtkCellRenderer *cellr,
}
state = GTK_STATE_NORMAL;
if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cellr->sensitive)
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cellr->sensitive)
{
state = GTK_STATE_INSENSITIVE;
}

View File

@ -1649,13 +1649,13 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
state = GTK_STATE_ACTIVE;
}
else if ((flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT &&
GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
{
state = GTK_STATE_PRELIGHT;
}
else
{
if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
state = GTK_STATE_INSENSITIVE;
else
state = GTK_STATE_NORMAL;

View File

@ -349,7 +349,7 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
else
shadow = celltoggle->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
{
state = GTK_STATE_INSENSITIVE;
}

View File

@ -473,9 +473,9 @@ gtk_cell_view_expose (GtkWidget *widget,
area.x = widget->allocation.x + (rtl ? widget->allocation.width : 0);
area.y = widget->allocation.y;
if (GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
state = GTK_CELL_RENDERER_PRELIT;
else if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
else if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
state = GTK_CELL_RENDERER_INSENSITIVE;
else
state = 0;

View File

@ -154,14 +154,14 @@ gtk_check_button_paint (GtkWidget *widget,
GtkWidget *child = GTK_BIN (widget)->child;
if (interior_focus && child && gtk_widget_get_visible (child))
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
area, widget, "checkbutton",
child->allocation.x - focus_width - focus_pad,
child->allocation.y - focus_width - focus_pad,
child->allocation.width + 2 * (focus_width + focus_pad),
child->allocation.height + 2 * (focus_width + focus_pad));
else
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
area, widget, "checkbutton",
border_width + widget->allocation.x,
border_width + widget->allocation.y,
@ -398,7 +398,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_PRELIGHT)
if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
{
GdkRectangle restrict_area;
GdkRectangle new_area;

View File

@ -441,17 +441,17 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
GtkShadowType shadow_type;
gint x, y;
if (gtk_widget_is_drawable (GTK_WIDGET (check_menu_item)))
widget = GTK_WIDGET (check_menu_item);
if (gtk_widget_is_drawable (widget))
{
guint offset;
guint toggle_size;
guint toggle_spacing;
guint horizontal_padding;
guint indicator_size;
widget = GTK_WIDGET (check_menu_item);
gtk_widget_style_get (GTK_WIDGET (check_menu_item),
gtk_widget_style_get (widget,
"toggle-spacing", &toggle_spacing,
"horizontal-padding", &horizontal_padding,
"indicator-size", &indicator_size,
@ -477,9 +477,9 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
if (check_menu_item->active ||
check_menu_item->always_show_toggle ||
(GTK_WIDGET_STATE (check_menu_item) == GTK_STATE_PRELIGHT))
(gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT))
{
state_type = GTK_WIDGET_STATE (widget);
state_type = gtk_widget_get_state (widget);
if (check_menu_item->inconsistent)
shadow_type = GTK_SHADOW_ETCHED_IN;

View File

@ -1100,7 +1100,7 @@ gtk_combo_box_state_changed (GtkWidget *widget,
{
if (priv->tree_view && priv->cell_view)
gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view),
&widget->style->base[GTK_WIDGET_STATE (widget)]);
&widget->style->base[gtk_widget_get_state (widget)]);
}
gtk_widget_queue_draw (widget);
@ -1118,12 +1118,12 @@ gtk_combo_box_button_state_changed (GtkWidget *widget,
{
if (!priv->tree_view && priv->cell_view)
{
if ((GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE) !=
(GTK_WIDGET_STATE (priv->cell_view) == GTK_STATE_INSENSITIVE))
if ((gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) !=
(gtk_widget_get_state (priv->cell_view) == GTK_STATE_INSENSITIVE))
gtk_widget_set_sensitive (priv->cell_view, gtk_widget_get_sensitive (widget));
gtk_widget_set_state (priv->cell_view,
GTK_WIDGET_STATE (widget));
gtk_widget_get_state (widget));
}
}
@ -1183,7 +1183,7 @@ gtk_combo_box_style_set (GtkWidget *widget,
if (priv->tree_view && priv->cell_view)
gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view),
&widget->style->base[GTK_WIDGET_STATE (widget)]);
&widget->style->base[gtk_widget_get_state (widget)]);
if (GTK_IS_ENTRY (GTK_BIN (combo_box)->child))
g_object_set (GTK_BIN (combo_box)->child, "shadow-type",
@ -3675,6 +3675,8 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
{
GtkComboBoxPrivate *priv = combo_box->priv;
GtkTreeSelection *sel;
GtkStyle *style;
GtkWidget *widget = GTK_WIDGET (combo_box);
priv->button = gtk_toggle_button_new ();
gtk_widget_set_parent (priv->button,
@ -3691,8 +3693,9 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
if (priv->cell_view)
{
gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view),
&GTK_WIDGET (combo_box)->style->base[GTK_WIDGET_STATE (combo_box)]);
style = gtk_widget_get_style (widget);
gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view),
&style->base[gtk_widget_get_state (widget)]);
priv->box = gtk_event_box_new ();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->box),

View File

@ -2674,7 +2674,7 @@ realize_icon_info (GtkWidget *widget,
attributes_mask);
gdk_window_set_user_data (icon_info->window, widget);
gdk_window_set_background (icon_info->window,
&widget->style->base[GTK_WIDGET_STATE (widget)]);
&widget->style->base[gtk_widget_get_state (widget)]);
gtk_widget_queue_resize (widget);
}
@ -2796,8 +2796,8 @@ gtk_entry_realize (GtkWidget *widget)
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background (entry->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
gdk_window_show (entry->text_area);
@ -3305,7 +3305,7 @@ gtk_entry_draw_frame (GtkWidget *widget,
gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
if (state_hint)
state = gtk_widget_has_focus (widget) ?
GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
else
state = GTK_STATE_NORMAL;
@ -3323,7 +3323,8 @@ gtk_entry_draw_frame (GtkWidget *widget,
width += 2 * priv->focus_width;
height += 2 * priv->focus_width;
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window,
gtk_widget_get_state (widget),
&event->area, widget, "entry",
0, 0, width, height);
}
@ -3455,9 +3456,9 @@ gtk_entry_expose (GtkWidget *widget,
gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
if (state_hint)
state = gtk_widget_has_focus (widget) ?
GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
else
state = GTK_WIDGET_STATE(widget);
state = gtk_widget_get_state(widget);
if (widget->window == event->window)
{
@ -3502,7 +3503,7 @@ gtk_entry_expose (GtkWidget *widget,
gdk_drawable_get_size (icon_info->window, &width, &height);
gtk_paint_flat_box (widget->style, icon_info->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
gtk_widget_get_state (widget), GTK_SHADOW_NONE,
NULL, widget, "entry_bg",
0, 0, width, height);
@ -4244,13 +4245,13 @@ gtk_entry_state_changed (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
{
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background (entry->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
if (icon_info && icon_info->window)
gdk_window_set_background (icon_info->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (icon_info->window, &widget->style->base[gtk_widget_get_state (widget)]);
}
if (gtk_widget_is_sensitive (widget))
@ -4462,13 +4463,13 @@ gtk_entry_style_set (GtkWidget *widget,
if (previous_style && gtk_widget_get_realized (widget))
{
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background (entry->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
if (icon_info && icon_info->window)
gdk_window_set_background (icon_info->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (icon_info->window, &widget->style->base[gtk_widget_get_state (widget)]);
}
}
@ -6448,38 +6449,41 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
{
GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
EntryIconInfo *icon_info = priv->icons[icon_pos];
GdkScreen *screen;
GtkIconInfo *info;
GtkIconTheme *icon_theme;
GtkSettings *settings;
GtkStateType state;
GtkWidget *widget;
GdkScreen *screen;
gint width, height;
GtkIconInfo *info;
gint state;
if (!icon_info || icon_info->pixbuf)
return;
widget = GTK_WIDGET (entry);
switch (icon_info->storage_type)
{
case GTK_IMAGE_EMPTY:
case GTK_IMAGE_PIXBUF:
break;
case GTK_IMAGE_STOCK:
state = GTK_WIDGET_STATE (entry);
GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL;
icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
state = gtk_widget_get_state (widget);
gtk_widget_set_state (widget, GTK_STATE_NORMAL);
icon_info->pixbuf = gtk_widget_render_icon (widget,
icon_info->stock_id,
GTK_ICON_SIZE_MENU,
NULL);
if (!icon_info->pixbuf)
icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
icon_info->pixbuf = gtk_widget_render_icon (widget,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU,
NULL);
GTK_WIDGET_STATE (entry) = state;
gtk_widget_set_state (widget, state);
break;
case GTK_IMAGE_ICON_NAME:
screen = gtk_widget_get_screen (GTK_WIDGET (entry));
screen = gtk_widget_get_screen (widget);
if (screen)
{
icon_theme = gtk_icon_theme_get_for_screen (screen);
@ -6496,19 +6500,19 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
if (icon_info->pixbuf == NULL)
{
state = GTK_WIDGET_STATE (entry);
GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL;
icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
state = gtk_widget_get_state (widget);
gtk_widget_set_state (widget, GTK_STATE_NORMAL);
icon_info->pixbuf = gtk_widget_render_icon (widget,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU,
NULL);
GTK_WIDGET_STATE (entry) = state;
gtk_widget_set_state (widget, state);
}
}
break;
case GTK_IMAGE_GICON:
screen = gtk_widget_get_screen (GTK_WIDGET (entry));
screen = gtk_widget_get_screen (widget);
if (screen)
{
icon_theme = gtk_icon_theme_get_for_screen (screen);
@ -6530,13 +6534,13 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
if (icon_info->pixbuf == NULL)
{
state = GTK_WIDGET_STATE (entry);
GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL;
icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
state = gtk_widget_get_state (widget);
gtk_widget_set_state (widget, GTK_STATE_NORMAL);
icon_info->pixbuf = gtk_widget_render_icon (widget,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU,
NULL);
GTK_WIDGET_STATE (entry) = state;
gtk_widget_set_state (widget, state);
}
}
break;

View File

@ -888,7 +888,7 @@ gtk_expander_paint_focus (GtkExpander *expander,
height = rect.height + 2 * focus_pad;
}
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
area, widget, "expander",
x, y, width, height);
}

View File

@ -450,9 +450,9 @@ gtk_handle_box_realize (GtkWidget *widget)
gdk_window_set_type_hint (hb->float_window, GDK_WINDOW_TYPE_HINT_TOOLBAR);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (hb));
gtk_style_set_background (widget->style, hb->bin_window, GTK_WIDGET_STATE (hb));
gtk_style_set_background (widget->style, hb->float_window, GTK_WIDGET_STATE (hb));
gtk_style_set_background (widget->style, widget->window, gtk_widget_get_state (widget));
gtk_style_set_background (widget->style, hb->bin_window, gtk_widget_get_state (widget));
gtk_style_set_background (widget->style, hb->float_window, gtk_widget_get_state (widget));
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
}
@ -716,7 +716,7 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
}
gtk_paint_shadow (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
GTK_SHADOW_ETCHED_IN,
NULL, widget, "handle",
x,
@ -727,7 +727,7 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
handle_position == GTK_POS_RIGHT)
gtk_paint_hline (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
NULL, widget, "handlebox",
handle_position == GTK_POS_LEFT ? DRAG_HANDLE_SIZE : 0,
handle_position == GTK_POS_LEFT ? widget->allocation.width : widget->allocation.width - DRAG_HANDLE_SIZE,
@ -735,7 +735,7 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
else
gtk_paint_vline (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
NULL, widget, "handlebox",
handle_position == GTK_POS_TOP ? DRAG_HANDLE_SIZE : 0,
handle_position == GTK_POS_TOP ? widget->allocation.height : widget->allocation.height - DRAG_HANDLE_SIZE,
@ -890,14 +890,14 @@ gtk_handle_box_paint (GtkWidget *widget,
if (!event)
gtk_paint_box (widget->style,
hb->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
hb->shadow_type,
area, widget, "handlebox_bin",
0, 0, -1, -1);
else
gtk_paint_box (widget->style,
hb->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
hb->shadow_type,
&event->area, widget, "handlebox_bin",
0, 0, -1, -1);

View File

@ -1235,7 +1235,7 @@ paint_triangle (GtkHSV *hsv,
NULL);
gtk_paint_focus (widget->style, widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
NULL, widget, detail,
widget->allocation.x + xx - FOCUS_RADIUS - focus_width - focus_pad,
widget->allocation.y + yy - FOCUS_RADIUS - focus_width - focus_pad,
@ -1293,7 +1293,7 @@ gtk_hsv_expose (GtkWidget *widget,
if (gtk_widget_has_focus (widget) && priv->focus_on_ring)
gtk_paint_focus (widget->style, widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
&event->area, widget, NULL,
widget->allocation.x,
widget->allocation.y,

View File

@ -1592,7 +1592,7 @@ gtk_icon_view_expose (GtkWidget *widget,
case GTK_ICON_VIEW_DROP_INTO:
gtk_paint_focus (widget->style,
icon_view->priv->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
NULL,
widget,
"iconview-drop-indicator",
@ -1602,7 +1602,7 @@ gtk_icon_view_expose (GtkWidget *widget,
case GTK_ICON_VIEW_DROP_ABOVE:
gtk_paint_focus (widget->style,
icon_view->priv->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
NULL,
widget,
"iconview-drop-indicator",
@ -1612,7 +1612,7 @@ gtk_icon_view_expose (GtkWidget *widget,
case GTK_ICON_VIEW_DROP_LEFT:
gtk_paint_focus (widget->style,
icon_view->priv->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
NULL,
widget,
"iconview-drop-indicator",
@ -1622,7 +1622,7 @@ gtk_icon_view_expose (GtkWidget *widget,
case GTK_ICON_VIEW_DROP_BELOW:
gtk_paint_focus (widget->style,
icon_view->priv->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
NULL,
widget,
"iconview-drop-indicator",
@ -1632,7 +1632,7 @@ gtk_icon_view_expose (GtkWidget *widget,
case GTK_ICON_VIEW_DROP_RIGHT:
gtk_paint_focus (widget->style,
icon_view->priv->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
NULL,
widget,
"iconview-drop-indicator",
@ -7397,7 +7397,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
cairo_set_line_width (cr, 1.);
gdk_cairo_set_source_color
(cr, &widget->style->base[GTK_WIDGET_STATE (widget)]);
(cr, &widget->style->base[gtk_widget_get_state (widget)]);
cairo_rectangle (cr, 0, 0, item->width + 2, item->height + 2);
cairo_fill (cr);

View File

@ -1883,7 +1883,7 @@ gtk_image_expose (GtkWidget *widget,
mask = NULL;
pixbuf = NULL;
needs_state_transform = GTK_WIDGET_STATE (widget) != GTK_STATE_NORMAL;
needs_state_transform = gtk_widget_get_state (widget) != GTK_STATE_NORMAL;
switch (image->storage_type)
{
@ -1971,7 +1971,7 @@ gtk_image_expose (GtkWidget *widget,
gtk_icon_set_render_icon (image->data.icon_set.icon_set,
widget->style,
gtk_widget_get_direction (widget),
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
image->icon_size,
widget,
NULL);
@ -2066,7 +2066,7 @@ gtk_image_expose (GtkWidget *widget,
rendered = gtk_style_render_icon (widget->style,
source,
gtk_widget_get_direction (widget),
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
/* arbitrary */
(GtkIconSize)-1,
widget,
@ -2319,7 +2319,7 @@ gtk_image_calc_size (GtkImage *image)
pixbuf = gtk_icon_set_render_icon (image->data.icon_set.icon_set,
widget->style,
gtk_widget_get_direction (widget),
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
image->icon_size,
widget,
NULL);

View File

@ -3721,7 +3721,7 @@ gtk_label_expose (GtkWidget *widget,
gtk_paint_layout (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
FALSE,
&event->area,
widget,
@ -3835,7 +3835,7 @@ gtk_label_expose (GtkWidget *widget,
1);
gdk_region_get_clipbox (clip, &rect);
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
&event->area, widget, "label",
rect.x, rect.y, rect.width, rect.height);

View File

@ -785,8 +785,14 @@ static void
gtk_list_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
GtkStyle *style;
if (previous_style && gtk_widget_get_realized (widget))
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
{
style = gtk_widget_get_style (widget);
gdk_window_set_background (gtk_widget_get_window (widget),
&style->base[gtk_widget_get_state (widget)]);
}
}
/* GtkContainer Methods :
@ -1456,7 +1462,7 @@ gtk_list_select_all (GtkList *list)
list->undo_unselection = NULL;
if (list->children &&
GTK_WIDGET_STATE (list->children->data) != GTK_STATE_SELECTED)
gtk_widget_get_state (list->children->data) != GTK_STATE_SELECTED)
gtk_list_fake_toggle_row (list, GTK_WIDGET (list->children->data));
list->anchor_state = GTK_STATE_SELECTED;

View File

@ -527,10 +527,16 @@ static void
gtk_list_item_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
GtkStyle *style;
g_return_if_fail (widget != NULL);
if (previous_style && gtk_widget_get_realized (widget))
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
{
style = gtk_widget_get_style (widget);
gdk_window_set_background (gtk_widget_get_window (widget),
&style->base[gtk_widget_get_state (widget)]);
}
}
static gint
@ -570,11 +576,11 @@ gtk_list_item_expose (GtkWidget *widget,
if (gtk_widget_has_focus (widget))
{
if (GTK_IS_LIST (widget->parent) && GTK_LIST (widget->parent)->add_mode)
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
NULL, widget, "add-mode",
0, 0, widget->allocation.width, widget->allocation.height);
else
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
NULL, widget, NULL,
0, 0, widget->allocation.width, widget->allocation.height);
}

View File

@ -1210,7 +1210,7 @@ gtk_menu_attach_to_widget (GtkMenu *menu,
g_object_set_data_full (G_OBJECT (attach_widget), I_(ATTACHED_MENUS), list,
(GDestroyNotify) g_list_free);
if (GTK_WIDGET_STATE (menu) != GTK_STATE_NORMAL)
if (gtk_widget_get_state (GTK_WIDGET (menu)) != GTK_STATE_NORMAL)
gtk_widget_set_state (GTK_WIDGET (menu), GTK_STATE_NORMAL);
/* we don't need to set the style here, since

View File

@ -517,7 +517,7 @@ gtk_menu_bar_paint (GtkWidget *widget,
gtk_paint_box (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
get_shadow_type (GTK_MENU_BAR (widget)),
area, widget, "menubar",
border, border,

View File

@ -903,7 +903,7 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
if (event->detail != GDK_NOTIFY_INFERIOR)
{
if (GTK_WIDGET_STATE (menu_item) != GTK_STATE_PRELIGHT)
if (gtk_widget_get_state (menu_item) != GTK_STATE_PRELIGHT)
gtk_menu_shell_select_item (menu_shell, menu_item);
/* If any mouse button is down, and there is a submenu
@ -972,7 +972,7 @@ gtk_menu_shell_leave_notify (GtkWidget *widget,
(menu_item->submenu == NULL))
{
if ((event->detail != GDK_NOTIFY_INFERIOR) &&
(GTK_WIDGET_STATE (menu_item) != GTK_STATE_NORMAL))
(gtk_widget_get_state (GTK_WIDGET (menu_item)) != GTK_STATE_NORMAL))
{
gtk_menu_shell_deselect (menu_shell);
}

View File

@ -3294,7 +3294,7 @@ gtk_notebook_draw_focus (GtkWidget *widget,
area.height = page->tab_label->allocation.height + 2 * focus_width;
gtk_paint_focus (widget->style, event->window,
GTK_WIDGET_STATE (widget), NULL, widget, "tab",
gtk_widget_get_state (widget), NULL, widget, "tab",
area.x, area.y, area.width, area.height);
}
}
@ -5044,7 +5044,7 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook,
state_type = GTK_STATE_PRELIGHT;
}
else
state_type = GTK_WIDGET_STATE (widget);
state_type = gtk_widget_get_state (widget);
if (notebook->click_child == nbarrow)
shadow_type = GTK_SHADOW_IN;

View File

@ -518,7 +518,7 @@ gtk_option_menu_paint (GtkWidget *widget,
}
gtk_paint_box (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
gtk_widget_get_state (widget), GTK_SHADOW_OUT,
area, widget, "optionmenu",
button_area.x, button_area.y,
button_area.width, button_area.height);
@ -532,7 +532,7 @@ gtk_option_menu_paint (GtkWidget *widget,
widget->style->xthickness;
gtk_paint_tab (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
gtk_widget_get_state (widget), GTK_SHADOW_OUT,
area, widget, "optionmenutab",
tab_x,
button_area.y + (button_area.height - props.indicator_size.height) / 2,
@ -562,7 +562,7 @@ gtk_option_menu_paint (GtkWidget *widget,
button_area.height += 2 * (props.focus_width + props.focus_pad);
}
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
area, widget, "button",
button_area.x,
button_area.y,

View File

@ -1081,7 +1081,7 @@ gtk_paned_expose (GtkWidget *widget,
else if (paned->handle_prelit)
state = GTK_STATE_PRELIGHT;
else
state = GTK_WIDGET_STATE (widget);
state = gtk_widget_get_state (widget);
gtk_paint_handle (widget->style, widget->window,
state, GTK_SHADOW_NONE,

View File

@ -201,7 +201,7 @@ gtk_pixmap_expose (GtkWidget *widget,
gdk_gc_set_clip_origin (widget->style->black_gc, x, y);
}
if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE
&& pixmap->build_insensitive)
{
if (!pixmap->pixmap_insensitive)

View File

@ -653,7 +653,7 @@ gtk_radio_button_clicked (GtkButton *button)
else
depressed = toggle_button->active;
if (GTK_WIDGET_STATE (button) != new_state)
if (gtk_widget_get_state (GTK_WIDGET (button)) != new_state)
gtk_widget_set_state (GTK_WIDGET (button), new_state);
if (toggled)
@ -727,7 +727,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_PRELIGHT)
if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
{
GdkRectangle restrict_area;
GdkRectangle new_area;

View File

@ -1929,7 +1929,7 @@ gtk_range_expose (GtkWidget *widget,
}
if (sensitive && gtk_widget_has_focus (widget))
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
&area, widget, "trough",
widget->allocation.x + range->range_rect.x,
widget->allocation.y + range->range_rect.y,

View File

@ -784,7 +784,7 @@ gtk_ruler_real_draw_ticks (GtkRuler *ruler)
gtk_paint_layout (widget->style,
ruler->backing_store,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
FALSE,
NULL,
widget,
@ -801,7 +801,7 @@ gtk_ruler_real_draw_ticks (GtkRuler *ruler)
gtk_paint_layout (widget->style,
ruler->backing_store,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
FALSE,
NULL,
widget,

View File

@ -197,7 +197,7 @@ gtk_separator_expose (GtkWidget *widget,
{
if (wide_separators)
gtk_paint_box (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
&event->area, widget, "hseparator",
widget->allocation.x,
widget->allocation.y + (widget->allocation.height -
@ -206,7 +206,7 @@ gtk_separator_expose (GtkWidget *widget,
separator_height);
else
gtk_paint_hline (widget->style, widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
&event->area, widget, "hseparator",
widget->allocation.x,
widget->allocation.x + widget->allocation.width - 1,
@ -217,7 +217,7 @@ gtk_separator_expose (GtkWidget *widget,
{
if (wide_separators)
gtk_paint_box (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
&event->area, widget, "vseparator",
widget->allocation.x + (widget->allocation.width -
separator_width) / 2,
@ -226,7 +226,7 @@ gtk_separator_expose (GtkWidget *widget,
widget->allocation.height);
else
gtk_paint_vline (widget->style, widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
&event->area, widget, "vseparator",
widget->allocation.y,
widget->allocation.y + widget->allocation.height - 1,

View File

@ -844,7 +844,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
}
else
{
state_type = GTK_WIDGET_STATE (widget);
state_type = gtk_widget_get_state (widget);
}
shadow_type = GTK_SHADOW_OUT;

View File

@ -837,7 +837,7 @@ gtk_statusbar_expose_event (GtkWidget *widget,
gtk_paint_resize_grip (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
&event->area,
widget,
"statusbar",

View File

@ -1278,8 +1278,8 @@ gtk_text_realize (GtkWidget *widget)
widget->style = gtk_style_attach (widget->style, widget->window);
/* Can't call gtk_style_set_background here because it's handled specially */
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background (text->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
text->bg_gc = create_bg_gc (text);
@ -1316,8 +1316,8 @@ gtk_text_style_set (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
{
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background (text->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
if (text->bg_gc)
{
@ -1344,8 +1344,8 @@ gtk_text_state_changed (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
{
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background (text->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
}
}
@ -1442,7 +1442,7 @@ gtk_text_draw_focus (GtkWidget *widget)
xextra -= 1;
yextra -= 1;
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
NULL, widget, "text",
0, 0,
widget->allocation.width,
@ -4695,7 +4695,7 @@ draw_bg_rect (GtkText* text, GtkPropertyMark *mark,
x, y, width, height);
}
else if (!gdk_color_equal(MARK_CURRENT_BACK (text, mark),
&GTK_WIDGET(text)->style->base[GTK_WIDGET_STATE (text)]))
&GTK_WIDGET(text)->style->base[gtk_widget_get_state (GTK_WIDGET (text))]))
{
gdk_gc_set_foreground (text->gc, MARK_CURRENT_BACK (text, mark));

View File

@ -242,14 +242,14 @@ _gtk_text_util_create_drag_icon (GtkWidget *widget,
-1);
gdk_draw_rectangle (drawable,
widget->style->base_gc [GTK_WIDGET_STATE (widget)],
widget->style->base_gc [gtk_widget_get_state (widget)],
TRUE,
0, 0,
pixmap_width + 1,
pixmap_height + 1);
gdk_draw_layout (drawable,
widget->style->text_gc [GTK_WIDGET_STATE (widget)],
widget->style->text_gc [gtk_widget_get_state (widget)],
1 + DRAG_ICON_LAYOUT_BORDER,
1 + DRAG_ICON_LAYOUT_BORDER,
layout);
@ -357,14 +357,14 @@ _gtk_text_util_create_rich_drag_icon (GtkWidget *widget,
pixmap_width + 2, pixmap_height + 2, -1);
gdk_draw_rectangle (drawable,
widget->style->base_gc [GTK_WIDGET_STATE (widget)],
widget->style->base_gc [gtk_widget_get_state (widget)],
TRUE,
0, 0,
pixmap_width + 1,
pixmap_height + 1);
gtk_text_layout_draw (layout, widget, drawable,
widget->style->text_gc [GTK_WIDGET_STATE (widget)],
widget->style->text_gc [gtk_widget_get_state (widget)],
- (1 + DRAG_ICON_LAYOUT_BORDER),
- (1 + DRAG_ICON_LAYOUT_BORDER),
0, 0,

View File

@ -3856,7 +3856,7 @@ gtk_text_view_realize (GtkWidget *widget)
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window,
&widget->style->bg[GTK_WIDGET_STATE (widget)]);
&widget->style->bg[gtk_widget_get_state (widget)]);
text_window_realize (text_view->text_window, widget);
@ -3942,25 +3942,25 @@ gtk_text_view_set_background (GtkTextView *text_view)
GtkWidget *widget = GTK_WIDGET (text_view);
gdk_window_set_background (widget->window,
&widget->style->bg[GTK_WIDGET_STATE (widget)]);
&widget->style->bg[gtk_widget_get_state (widget)]);
gdk_window_set_background (text_view->text_window->bin_window,
&widget->style->base[GTK_WIDGET_STATE (widget)]);
&widget->style->base[gtk_widget_get_state (widget)]);
if (text_view->left_window)
gdk_window_set_background (text_view->left_window->bin_window,
&widget->style->bg[GTK_WIDGET_STATE (widget)]);
&widget->style->bg[gtk_widget_get_state (widget)]);
if (text_view->right_window)
gdk_window_set_background (text_view->right_window->bin_window,
&widget->style->bg[GTK_WIDGET_STATE (widget)]);
&widget->style->bg[gtk_widget_get_state (widget)]);
if (text_view->top_window)
gdk_window_set_background (text_view->top_window->bin_window,
&widget->style->bg[GTK_WIDGET_STATE (widget)]);
&widget->style->bg[gtk_widget_get_state (widget)]);
if (text_view->bottom_window)
gdk_window_set_background (text_view->bottom_window->bin_window,
&widget->style->bg[GTK_WIDGET_STATE (widget)]);
&widget->style->bg[gtk_widget_get_state (widget)]);
}
static void
@ -4696,7 +4696,7 @@ gtk_text_view_draw_focus (GtkWidget *widget)
{
if (gtk_widget_has_focus (widget) && !interior_focus)
{
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
NULL, widget, "textview",
0, 0,
widget->allocation.width,
@ -8066,12 +8066,12 @@ text_window_realize (GtkTextWindow *win,
gdk_window_set_background (win->bin_window,
&widget->style->base[GTK_WIDGET_STATE (widget)]);
&widget->style->base[gtk_widget_get_state (widget)]);
}
else
{
gdk_window_set_background (win->bin_window,
&widget->style->bg[GTK_WIDGET_STATE (widget)]);
&widget->style->bg[gtk_widget_get_state (widget)]);
}
g_object_set_qdata (G_OBJECT (win->window),

View File

@ -426,7 +426,7 @@ gtk_toggle_button_expose (GtkWidget *widget,
GtkStateType state_type;
GtkShadowType shadow_type;
state_type = GTK_WIDGET_STATE (widget);
state_type = gtk_widget_get_state (widget);
if (GTK_TOGGLE_BUTTON (widget)->inconsistent)
{

View File

@ -871,7 +871,7 @@ gtk_toolbar_expose (GtkWidget *widget,
{
gtk_paint_box (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
get_shadow_type (toolbar),
&event->area, widget, "toolbar",
border_width + widget->allocation.x,
@ -4884,7 +4884,7 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget,
if (wide_separators)
gtk_paint_box (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
area, widget, "vseparator",
allocation->x + (allocation->width - separator_width) / 2,
allocation->y + allocation->height * start_fraction,
@ -4892,7 +4892,7 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget,
allocation->height * (end_fraction - start_fraction));
else
gtk_paint_vline (widget->style, widget->window,
GTK_WIDGET_STATE (widget), area, widget,
gtk_widget_get_state (widget), area, widget,
"toolbar",
allocation->y + allocation->height * start_fraction,
allocation->y + allocation->height * end_fraction,
@ -4910,7 +4910,7 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget,
if (wide_separators)
gtk_paint_box (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
area, widget, "hseparator",
allocation->x + allocation->width * start_fraction,
allocation->y + (allocation->height - separator_height) / 2,
@ -4918,7 +4918,7 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget,
separator_height);
else
gtk_paint_hline (widget->style, widget->window,
GTK_WIDGET_STATE (widget), area, widget,
gtk_widget_get_state (widget), area, widget,
"toolbar",
allocation->x + allocation->width * start_fraction,
allocation->x + allocation->width * end_fraction,

View File

@ -259,7 +259,7 @@ gtk_tray_icon_expose (GtkWidget *widget,
height = widget->allocation.height - 2 * border_width;
gtk_paint_focus (widget->style, widget->window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
&event->area, widget, "tray_icon",
x, y, width, height);
}

View File

@ -651,7 +651,7 @@ gtk_tree_item_paint (GtkWidget *widget,
}
if (gtk_widget_has_focus (widget))
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
NULL, widget, "treeitem",
0, 0,
widget->allocation.width,

View File

@ -4230,9 +4230,10 @@ invalidate_empty_focus (GtkTreeView *tree_view)
static void
draw_empty_focus (GtkTreeView *tree_view, GdkRectangle *clip_area)
{
GtkWidget *widget = GTK_WIDGET (tree_view);
gint w, h;
if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
if (!gtk_widget_has_focus (widget))
return;
gdk_drawable_get_size (tree_view->priv->bin_window, &w, &h);
@ -4241,11 +4242,11 @@ draw_empty_focus (GtkTreeView *tree_view, GdkRectangle *clip_area)
h -= 2;
if (w > 0 && h > 0)
gtk_paint_focus (GTK_WIDGET (tree_view)->style,
gtk_paint_focus (gtk_widget_get_style (widget),
tree_view->priv->bin_window,
GTK_WIDGET_STATE (tree_view),
gtk_widget_get_state (widget),
clip_area,
GTK_WIDGET (tree_view),
widget,
NULL,
1, 1, w, h);
}
@ -4869,7 +4870,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
if (row_ending_details)
gtk_paint_focus (widget->style,
tree_view->priv->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
&event->area,
widget,
(is_first
@ -4882,7 +4883,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
else
gtk_paint_focus (widget->style,
tree_view->priv->bin_window,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
&event->area,
widget,
"treeview-drop-indicator",
@ -4896,7 +4897,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
if (highlight_y >= 0)
{
gdk_draw_line (event->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
widget->style->fg_gc[gtk_widget_get_state (widget)],
rtl ? highlight_x + expander_cell_width : highlight_x,
highlight_y,
rtl ? 0 : bin_window_width,
@ -9513,7 +9514,9 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
gint expander_size;
GtkExpanderStyle expander_style;
gtk_widget_style_get (GTK_WIDGET (tree_view),
widget = GTK_WIDGET (tree_view);
gtk_widget_style_get (widget,
"vertical-separator", &vertical_separator,
NULL);
expander_size = tree_view->priv->expander_size - EXPANDER_EXTRA_PADDING;
@ -9521,8 +9524,6 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
if (! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT))
return;
widget = GTK_WIDGET (tree_view);
gtk_tree_view_get_arrow_xrange (tree_view, tree, &x_offset, &x2);
area.x = x_offset;
@ -9530,7 +9531,7 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
area.width = expander_size + 2;
area.height = MAX (CELL_HEIGHT (node, vertical_separator), (expander_size - vertical_separator));
if (GTK_WIDGET_STATE (tree_view) == GTK_STATE_INSENSITIVE)
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
{
state = GTK_STATE_INSENSITIVE;
}
@ -13809,7 +13810,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
expose_area.height = background_area.height + 2;
gdk_draw_rectangle (drawable,
widget->style->base_gc [GTK_WIDGET_STATE (widget)],
widget->style->base_gc [gtk_widget_get_state (widget)],
TRUE,
0, 0,
bin_window_width + 2,

View File

@ -3519,7 +3519,7 @@ _gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column,
#if 0
gtk_paint_focus (tree_column->tree_view->style,
window,
GTK_WIDGET_STATE (tree_column->tree_view),
gtk_widget_get_state (tree_column->tree_view),
NULL,
tree_column->tree_view,
"treeview",

View File

@ -5784,7 +5784,7 @@ gtk_widget_set_state (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (state == GTK_WIDGET_STATE (widget))
if (state == gtk_widget_get_state (widget))
return;
if (state == GTK_STATE_INSENSITIVE)
@ -6246,7 +6246,7 @@ gtk_widget_set_sensitive (GtkWidget *widget,
else
{
GTK_OBJECT_FLAGS (widget) &= ~(GTK_SENSITIVE);
data.state = GTK_WIDGET_STATE (widget);
data.state = gtk_widget_get_state (widget);
}
data.state_restoration = TRUE;
data.use_forall = TRUE;
@ -6343,10 +6343,10 @@ gtk_widget_set_parent (GtkWidget *widget,
g_object_ref_sink (widget);
widget->parent = parent;
if (GTK_WIDGET_STATE (parent) != GTK_STATE_NORMAL)
data.state = GTK_WIDGET_STATE (parent);
if (gtk_widget_get_state (parent) != GTK_STATE_NORMAL)
data.state = gtk_widget_get_state (parent);
else
data.state = GTK_WIDGET_STATE (widget);
data.state = gtk_widget_get_state (widget);
data.state_restoration = FALSE;
data.parent_sensitive = (gtk_widget_is_sensitive (parent) != FALSE);
data.use_forall = gtk_widget_is_sensitive (parent) != gtk_widget_is_sensitive (widget);
@ -7354,7 +7354,7 @@ gtk_widget_render_icon (GtkWidget *widget,
retval = gtk_icon_set_render_icon (icon_set,
widget->style,
gtk_widget_get_direction (widget),
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
size,
widget,
detail);
@ -9174,7 +9174,7 @@ static void
gtk_widget_propagate_state (GtkWidget *widget,
GtkStateData *data)
{
guint8 old_state = GTK_WIDGET_STATE (widget);
guint8 old_state = gtk_widget_get_state (widget);
guint8 old_saved_state = widget->saved_state;
/* don't call this function with state==GTK_STATE_INSENSITIVE,
@ -9190,9 +9190,9 @@ gtk_widget_propagate_state (GtkWidget *widget,
if (gtk_widget_is_sensitive (widget))
{
if (data->state_restoration)
GTK_WIDGET_STATE (widget) = widget->saved_state;
widget->state = widget->saved_state;
else
GTK_WIDGET_STATE (widget) = data->state;
widget->state = data->state;
}
else
{
@ -9201,9 +9201,9 @@ gtk_widget_propagate_state (GtkWidget *widget,
if (data->state != GTK_STATE_INSENSITIVE)
widget->saved_state = data->state;
}
else if (GTK_WIDGET_STATE (widget) != GTK_STATE_INSENSITIVE)
widget->saved_state = GTK_WIDGET_STATE (widget);
GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE;
else if (gtk_widget_get_state (widget) != GTK_STATE_INSENSITIVE)
widget->saved_state = gtk_widget_get_state (widget);
widget->state = GTK_STATE_INSENSITIVE;
}
if (gtk_widget_is_focus (widget) && !gtk_widget_is_sensitive (widget))
@ -9215,7 +9215,7 @@ gtk_widget_propagate_state (GtkWidget *widget,
gtk_window_set_focus (GTK_WINDOW (window), NULL);
}
if (old_state != GTK_WIDGET_STATE (widget) ||
if (old_state != gtk_widget_get_state (widget) ||
old_saved_state != widget->saved_state)
{
g_object_ref (widget);

View File

@ -152,6 +152,7 @@ typedef enum
#define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid))
#endif
#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_STATE:
* @wid: a #GtkWidget.
@ -161,7 +162,7 @@ typedef enum
* Deprecated: 2.20: Use gtk_widget_get_state() instead.
*/
#define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state)
/* FIXME: Deprecating GTK_WIDGET_STATE requires fixing GTK internals. */
#endif
#ifndef GTK_DISABLE_DEPRECATED
/**

View File

@ -881,7 +881,7 @@ gail_button_ref_state_set (AtkObject *obj)
if (widget == NULL)
return state_set;
if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
if (gtk_widget_get_state (widget) == GTK_STATE_ACTIVE)
atk_state_set_add_state (state_set, ATK_STATE_ARMED);
if (!gtk_widget_get_can_focus (widget))
@ -902,7 +902,7 @@ gail_button_pressed_enter_handler (GtkWidget *widget)
{
AtkObject *accessible;
if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
if (gtk_widget_get_state (widget) == GTK_STATE_ACTIVE)
{
accessible = gtk_widget_get_accessible (widget);
atk_object_notify_state_change (accessible, ATK_STATE_ARMED, TRUE);

View File

@ -3529,7 +3529,7 @@ grippy_expose (GtkWidget *area, GdkEventExpose *event, GdkWindowEdge edge)
{
gtk_paint_resize_grip (area->style,
area->window,
GTK_WIDGET_STATE (area),
gtk_widget_get_state (area),
&event->area,
area,
"statusbar",

View File

@ -56,7 +56,7 @@ update_cursor (GtkWidget *widget, gdouble x, gdouble y)
x != cursor_x || y != cursor_y))
{
gdk_draw_drawable (widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
widget->style->fg_gc[gtk_widget_get_state (widget)],
pixmap,
cursor_x - 5, cursor_y - 5,
cursor_x - 5, cursor_y - 5,
@ -103,7 +103,7 @@ static gint
expose_event (GtkWidget *widget, GdkEventExpose *event)
{
gdk_draw_drawable (widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
widget->style->fg_gc[gtk_widget_get_state (widget)],
pixmap,
event->area.x, event->area.y,
event->area.x, event->area.y,
@ -124,7 +124,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
switch (source)
{
case GDK_SOURCE_MOUSE:
gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
gc = widget->style->dark_gc[gtk_widget_get_state (widget)];
break;
case GDK_SOURCE_PEN:
gc = widget->style->black_gc;
@ -133,7 +133,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
gc = widget->style->white_gc;
break;
default:
gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
gc = widget->style->light_gc[gtk_widget_get_state (widget)];
}
update_rect.x = x - 10 * pressure;

View File

@ -2864,7 +2864,7 @@ line_numbers_expose (GtkWidget *widget,
gtk_paint_layout (widget->style,
target,
GTK_WIDGET_STATE (widget),
gtk_widget_get_state (widget),
FALSE,
NULL,
widget,