2 * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * SECTION:gtkcelleditable
22 * @Short_description: Interface for widgets which can are used for editing
24 * @Title: GtkCellEditable
25 * @See_also: #GtkEntry, #GtkCellRenderer
27 * The #GtkCellEditable interface must be implemented for widgets to be usable
28 * when editing the contents of a #GtkTreeView cell.
32 #include "gtkcelleditable.h"
33 #include "gtkmarshalers.h"
34 #include "gtkprivate.h"
38 typedef GtkCellEditableIface GtkCellEditableInterface;
39 G_DEFINE_INTERFACE(GtkCellEditable, gtk_cell_editable, GTK_TYPE_WIDGET)
42 gtk_cell_editable_default_init (GtkCellEditableInterface *iface)
45 * GtkCellEditable:editing-canceled:
47 * Indicates whether editing on the cell has been canceled.
51 g_object_interface_install_property (iface,
52 g_param_spec_boolean ("editing-canceled",
53 P_("Editing Canceled"),
54 P_("Indicates that editing has been canceled"),
56 GTK_PARAM_READWRITE));
59 * GtkCellEditable::editing-done:
60 * @cell_editable: the object on which the signal was emitted
62 * This signal is a sign for the cell renderer to update its
63 * value from the @cell_editable.
65 * Implementations of #GtkCellEditable are responsible for
66 * emitting this signal when they are done editing, e.g.
67 * #GtkEntry is emitting it when the user presses Enter.
69 * gtk_cell_editable_editing_done() is a convenience method
70 * for emitting #GtkCellEditable::editing-done.
72 g_signal_new (I_("editing-done"),
73 GTK_TYPE_CELL_EDITABLE,
75 G_STRUCT_OFFSET (GtkCellEditableIface, editing_done),
77 _gtk_marshal_VOID__VOID,
81 * GtkCellEditable::remove-widget:
82 * @cell_editable: the object on which the signal was emitted
84 * This signal is meant to indicate that the cell is finished
85 * editing, and the widget may now be destroyed.
87 * Implementations of #GtkCellEditable are responsible for
88 * emitting this signal when they are done editing. It must
89 * be emitted after the #GtkCellEditable::editing-done signal,
90 * to give the cell renderer a chance to update the cell's value
91 * before the widget is removed.
93 * gtk_cell_editable_remove_widget() is a convenience method
94 * for emitting #GtkCellEditable::remove-widget.
96 g_signal_new (I_("remove-widget"),
97 GTK_TYPE_CELL_EDITABLE,
99 G_STRUCT_OFFSET (GtkCellEditableIface, remove_widget),
101 _gtk_marshal_VOID__VOID,
106 * gtk_cell_editable_start_editing:
107 * @cell_editable: A #GtkCellEditable
108 * @event: (allow-none): A #GdkEvent, or %NULL
110 * Begins editing on a @cell_editable. @event is the #GdkEvent that began
111 * the editing process. It may be %NULL, in the instance that editing was
112 * initiated through programatic means.
115 gtk_cell_editable_start_editing (GtkCellEditable *cell_editable,
118 g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
120 (* GTK_CELL_EDITABLE_GET_IFACE (cell_editable)->start_editing) (cell_editable, event);
124 * gtk_cell_editable_editing_done:
125 * @cell_editable: A #GtkTreeEditable
127 * Emits the #GtkCellEditable::editing-done signal.
130 gtk_cell_editable_editing_done (GtkCellEditable *cell_editable)
132 g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
134 g_signal_emit_by_name (cell_editable, "editing-done");
138 * gtk_cell_editable_remove_widget:
139 * @cell_editable: A #GtkTreeEditable
141 * Emits the #GtkCellEditable::remove-widget signal.
144 gtk_cell_editable_remove_widget (GtkCellEditable *cell_editable)
146 g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
148 g_signal_emit_by_name (cell_editable, "remove-widget");