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, see <http://www.gnu.org/licenses/>.
19 * SECTION:gtkcelleditable
20 * @Short_description: Interface for widgets which can are used for editing
22 * @Title: GtkCellEditable
23 * @See_also: #GtkEntry, #GtkCellRenderer
25 * The #GtkCellEditable interface must be implemented for widgets to be usable
26 * when editing the contents of a #GtkTreeView cell.
30 #include "gtkcelleditable.h"
31 #include "gtkmarshalers.h"
32 #include "gtkprivate.h"
36 typedef GtkCellEditableIface GtkCellEditableInterface;
37 G_DEFINE_INTERFACE(GtkCellEditable, gtk_cell_editable, GTK_TYPE_WIDGET)
40 gtk_cell_editable_default_init (GtkCellEditableInterface *iface)
43 * GtkCellEditable:editing-canceled:
45 * Indicates whether editing on the cell has been canceled.
49 g_object_interface_install_property (iface,
50 g_param_spec_boolean ("editing-canceled",
51 P_("Editing Canceled"),
52 P_("Indicates that editing has been canceled"),
54 GTK_PARAM_READWRITE));
57 * GtkCellEditable::editing-done:
58 * @cell_editable: the object on which the signal was emitted
60 * This signal is a sign for the cell renderer to update its
61 * value from the @cell_editable.
63 * Implementations of #GtkCellEditable are responsible for
64 * emitting this signal when they are done editing, e.g.
65 * #GtkEntry is emitting it when the user presses Enter.
67 * gtk_cell_editable_editing_done() is a convenience method
68 * for emitting #GtkCellEditable::editing-done.
70 g_signal_new (I_("editing-done"),
71 GTK_TYPE_CELL_EDITABLE,
73 G_STRUCT_OFFSET (GtkCellEditableIface, editing_done),
75 _gtk_marshal_VOID__VOID,
79 * GtkCellEditable::remove-widget:
80 * @cell_editable: the object on which the signal was emitted
82 * This signal is meant to indicate that the cell is finished
83 * editing, and the widget may now be destroyed.
85 * Implementations of #GtkCellEditable are responsible for
86 * emitting this signal when they are done editing. It must
87 * be emitted after the #GtkCellEditable::editing-done signal,
88 * to give the cell renderer a chance to update the cell's value
89 * before the widget is removed.
91 * gtk_cell_editable_remove_widget() is a convenience method
92 * for emitting #GtkCellEditable::remove-widget.
94 g_signal_new (I_("remove-widget"),
95 GTK_TYPE_CELL_EDITABLE,
97 G_STRUCT_OFFSET (GtkCellEditableIface, remove_widget),
99 _gtk_marshal_VOID__VOID,
104 * gtk_cell_editable_start_editing:
105 * @cell_editable: A #GtkCellEditable
106 * @event: (allow-none): A #GdkEvent, or %NULL
108 * Begins editing on a @cell_editable. @event is the #GdkEvent that began
109 * the editing process. It may be %NULL, in the instance that editing was
110 * initiated through programatic means.
113 gtk_cell_editable_start_editing (GtkCellEditable *cell_editable,
116 g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
118 (* GTK_CELL_EDITABLE_GET_IFACE (cell_editable)->start_editing) (cell_editable, event);
122 * gtk_cell_editable_editing_done:
123 * @cell_editable: A #GtkCellEditable
125 * Emits the #GtkCellEditable::editing-done signal.
128 gtk_cell_editable_editing_done (GtkCellEditable *cell_editable)
130 g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
132 g_signal_emit_by_name (cell_editable, "editing-done");
136 * gtk_cell_editable_remove_widget:
137 * @cell_editable: A #GtkCellEditable
139 * Emits the #GtkCellEditable::remove-widget signal.
142 gtk_cell_editable_remove_widget (GtkCellEditable *cell_editable)
144 g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
146 g_signal_emit_by_name (cell_editable, "remove-widget");