{
PROP_0,
PROP_PATH,
- PROP_SLASH,
PROP_EDITING_CANCELED
};
obj->path = g_value_dup_string (value);
break;
- case PROP_SLASH:
- psppire_button_editable_set_slash (obj, g_value_get_boolean (value));
- break;
-
case PROP_EDITING_CANCELED:
break;
g_value_set_string (value, obj->path);
break;
- case PROP_SLASH:
- g_value_set_boolean (value, psppire_button_editable_get_slash (obj));
- break;
-
case PROP_EDITING_CANCELED:
g_value_set_boolean (value, FALSE);
break;
return TRUE;
}
-static gboolean
-psppire_button_editable_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkWidgetClass *widget_class;
- GtkStyle *style = gtk_widget_get_style (widget);
- GtkAllocation allocation;
- gboolean retval;
-
- widget_class = GTK_WIDGET_CLASS (psppire_button_editable_parent_class);
- retval = widget_class->expose_event (widget, event);
-
- gtk_widget_get_allocation (widget, &allocation);
- if (PSPPIRE_BUTTON_EDITABLE (widget)->slash)
- gdk_draw_line (gtk_widget_get_window (widget), style->black_gc,
- allocation.x,
- allocation.y + allocation.height,
- allocation.x + allocation.width,
- allocation.y);
- return retval;
-}
-
static void
psppire_button_editable_class_init (PsppireButtonEditableClass *class)
{
gobject_class->finalize = psppire_button_editable_finalize;
widget_class->button_release_event = psppire_button_editable_button_release;
- widget_class->expose_event = psppire_button_editable_expose_event;
g_object_class_install_property (gobject_class,
PROP_PATH,
"",
G_PARAM_READWRITE));
- g_object_class_install_property (gobject_class,
- PROP_SLASH,
- g_param_spec_boolean ("slash",
- _("Diagonal slash"),
- _("Whether to draw a diagonal slash across the button."),
- FALSE,
- G_PARAM_READWRITE));
-
g_object_class_override_property (gobject_class,
PROP_EDITING_CANCELED,
"editing-canceled");
psppire_button_editable_init (PsppireButtonEditable *obj)
{
obj->path = g_strdup ("");
- obj->slash = FALSE;
}
PsppireButtonEditable *
return PSPPIRE_BUTTON_EDITABLE (g_object_new (PSPPIRE_TYPE_BUTTON_EDITABLE, NULL));
}
-void
-psppire_button_editable_set_slash (PsppireButtonEditable *button,
- gboolean slash)
-{
- g_return_if_fail (button != NULL);
- if ((button->slash != 0) != (slash != 0))
- {
- button->slash = slash;
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
-}
-
-gboolean
-psppire_button_editable_get_slash (const PsppireButtonEditable *button)
-{
- g_return_val_if_fail (button != NULL, FALSE);
- return button->slash;
-}
\f
/* GtkCellEditable interface. */