- if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_PRELIGHT)
- {
- GdkRectangle restrict_area;
- GdkRectangle new_area;
-
- restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
- restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
- restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
- restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
-
- if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
- {
- gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
- GTK_SHADOW_ETCHED_OUT,
- area, widget, "checkbutton",
- new_area.x, new_area.y,
- new_area.width, new_area.height);
- }
- }
-
- gtk_paint_check (widget->style, widget->window,
- state_type, shadow_type,
- area, widget, "checkbutton",
- x, y, indicator_size, indicator_size);
- }
+ x = indicator_spacing + border_width;
+ y = (allocation.height - indicator_size) / 2;
+
+ child = gtk_bin_get_child (GTK_BIN (check_button));
+ if (!interior_focus || !(child && gtk_widget_get_visible (child)))
+ x += focus_width + focus_pad;
+
+ state &= ~(GTK_STATE_FLAG_INCONSISTENT |
+ GTK_STATE_FLAG_ACTIVE |
+ GTK_STATE_FLAG_SELECTED |
+ GTK_STATE_FLAG_PRELIGHT);
+
+ if (gtk_toggle_button_get_inconsistent (toggle_button))
+ state |= GTK_STATE_FLAG_INCONSISTENT;
+ else if (gtk_toggle_button_get_active (toggle_button) ||
+ (button->priv->button_down && button->priv->in_button))
+ state |= GTK_STATE_FLAG_ACTIVE;
+
+ if (button->priv->activate_timeout || (button->priv->button_down && button->priv->in_button))
+ state |= GTK_STATE_FLAG_SELECTED;
+
+ if (button->priv->in_button)
+ state |= GTK_STATE_FLAG_PRELIGHT;
+
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ x = allocation.width - (indicator_size + x);
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+
+ if (state & GTK_STATE_FLAG_PRELIGHT)
+ gtk_render_background (context, cr,
+ border_width, border_width,
+ allocation.width - (2 * border_width),
+ allocation.height - (2 * border_width));
+
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_CHECK);
+
+ gtk_render_check (context, cr,
+ x, y, indicator_size, indicator_size);
+
+ gtk_style_context_restore (context);