]> Pileus Git - ~andy/gtk/blob - gtk/gtkcelleditable.c
Fix numerous misspellings of possessive "its". (#110027, Doug Quale)
[~andy/gtk] / gtk / gtkcelleditable.c
1 /* gtkcelleditable.c
2  * Copyright (C) 2000  Red Hat, Inc.,  Jonathan Blandford <jrb@redhat.com>
3  *
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.
8  *
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.
13  *
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.
18  */
19
20
21 #include "gtkcelleditable.h"
22 #include "gtkmarshalers.h"
23
24 static void gtk_cell_editable_base_init (gpointer g_class);
25
26 GType
27 gtk_cell_editable_get_type (void)
28 {
29   static GType cell_editable_type = 0;
30
31   if (! cell_editable_type)
32     {
33       static const GTypeInfo cell_editable_info =
34       {
35         sizeof (GtkCellEditableIface), /* class_size */
36         gtk_cell_editable_base_init,   /* base_init */
37         NULL,           /* base_finalize */
38         NULL,
39         NULL,           /* class_finalize */
40         NULL,           /* class_data */
41         0,
42         0,
43         NULL
44       };
45
46       cell_editable_type =
47         g_type_register_static (G_TYPE_INTERFACE, "GtkCellEditable",
48                                 &cell_editable_info, 0);
49
50       g_type_interface_add_prerequisite (cell_editable_type, GTK_TYPE_WIDGET);
51     }
52
53   return cell_editable_type;
54 }
55
56 static void
57 gtk_cell_editable_base_init (gpointer g_class)
58 {
59   static gboolean initialized = FALSE;
60
61   if (! initialized)
62     {
63       g_signal_new ("editing_done",
64                     GTK_TYPE_CELL_EDITABLE,
65                     G_SIGNAL_RUN_LAST,
66                     G_STRUCT_OFFSET (GtkCellEditableIface, editing_done),
67                     NULL, NULL,
68                     _gtk_marshal_VOID__VOID,
69                     G_TYPE_NONE, 0);
70       g_signal_new ("remove_widget",
71                     GTK_TYPE_CELL_EDITABLE,
72                     G_SIGNAL_RUN_LAST,
73                     G_STRUCT_OFFSET (GtkCellEditableIface, remove_widget),
74                     NULL, NULL,
75                     _gtk_marshal_VOID__VOID,
76                     G_TYPE_NONE, 0);
77       initialized = TRUE;
78     }
79 }
80
81 /**
82  * gtk_cell_editable_start_editing:
83  * @cell_editable: A #GtkCellEditable
84  * @event: A #GdkEvent, or %NULL
85  * 
86  * Begins editing on a @cell_editable.  @event is the #GdkEvent that began the
87  * editing process.  It may be %NULL, in the instance that editing was initiated
88  * through programatic means.
89  **/
90 void
91 gtk_cell_editable_start_editing (GtkCellEditable *cell_editable,
92                                  GdkEvent        *event)
93 {
94   g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
95   g_return_if_fail (GTK_CELL_EDITABLE_GET_IFACE (cell_editable)->start_editing != NULL);
96
97   (* GTK_CELL_EDITABLE_GET_IFACE (cell_editable)->start_editing) (cell_editable, event);
98 }
99
100 /**
101  * gtk_cell_editable_editing_done:
102  * @cell_editable: A #GtkTreeEditable
103  * 
104  * Emits the "editing_done" signal.  This signal is a sign for the cell renderer
105  * to update its value from the cell.
106  **/
107 void
108 gtk_cell_editable_editing_done (GtkCellEditable *cell_editable)
109 {
110   g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
111
112   g_signal_emit_by_name (cell_editable, "editing_done");
113 }
114
115 /**
116  * gtk_cell_editable_remove_widget:
117  * @cell_editable: A #GtkTreeEditable
118  * 
119  * Emits the "remove_widget" signal.  This signal is meant to indicate that the
120  * cell is finished editing, and the widget may now be destroyed.
121  **/
122 void
123 gtk_cell_editable_remove_widget (GtkCellEditable *cell_editable)
124 {
125   g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
126
127   g_signal_emit_by_name (cell_editable, "remove_widget");
128 }