- {
- x = widget->allocation.x + offset + horizontal_padding +
- (toggle_size - toggle_spacing - indicator_size) / 2;
- }
- else
- {
- x = widget->allocation.x + widget->allocation.width -
- offset - horizontal_padding - toggle_size + toggle_spacing +
- (toggle_size - toggle_spacing - indicator_size) / 2;
- }
-
- y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
-
- if (check_menu_item->active ||
- check_menu_item->always_show_toggle ||
- (GTK_WIDGET_STATE (check_menu_item) == GTK_STATE_PRELIGHT))
- {
- state_type = GTK_WIDGET_STATE (widget);
-
- if (check_menu_item->inconsistent)
- shadow_type = GTK_SHADOW_ETCHED_IN;
- else if (check_menu_item->active)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
- state_type = GTK_STATE_INSENSITIVE;
-
- if (check_menu_item->draw_as_radio)
- {
- gtk_paint_option (widget->style, widget->window,
- state_type, shadow_type,
- area, widget, "option",
- x, y, indicator_size, indicator_size);
- }
- else
- {
- gtk_paint_check (widget->style, widget->window,
- state_type, shadow_type,
- area, widget, "check",
- x, y, indicator_size, indicator_size);
- }
- }
+ {
+ x = offset + horizontal_padding +
+ (toggle_size - toggle_spacing - indicator_size) / 2;
+ }
+ else
+ {
+ x = allocation.width -
+ offset - horizontal_padding - toggle_size + toggle_spacing +
+ (toggle_size - toggle_spacing - indicator_size) / 2;
+ }
+
+ y = (allocation.height - indicator_size) / 2;
+
+ if (priv->active ||
+ priv->always_show_toggle ||
+ (state & GTK_STATE_FLAG_PRELIGHT))
+ {
+ gtk_style_context_save (context);
+
+ if (priv->inconsistent)
+ state |= GTK_STATE_FLAG_INCONSISTENT;
+ else if (priv->active)
+ state |= GTK_STATE_FLAG_ACTIVE;
+
+ gtk_style_context_set_state (context, state);
+
+ if (priv->draw_as_radio)
+ {
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_RADIO);
+ gtk_render_option (context, cr, x, y,
+ indicator_size, indicator_size);
+ }
+ else
+ {
+ 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);
+ }