]> Pileus Git - ~andy/gtk/blob - gtk/a11y/gtkcellaccessibleparent.c
a11y: Solved leak on gtk_widget_accessible_get_description
[~andy/gtk] / gtk / a11y / gtkcellaccessibleparent.c
1 /* GAIL - The GNOME Accessibility Implementation Library
2
3  * Copyright 2001 Sun Microsystems Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #include "config.h"
20
21 #include <gtk/gtk.h>
22 #include "gtkcellaccessibleparent.h"
23
24 GType
25 _gtk_cell_accessible_parent_get_type (void)
26 {
27   static volatile gsize g_define_type_id__volatile = 0;
28
29   if (g_once_init_enter (&g_define_type_id__volatile))
30     {
31       GType g_define_type_id =
32         g_type_register_static_simple (G_TYPE_INTERFACE,
33                                        "GtkCellAccessibleParent",
34                                        sizeof (GtkCellAccessibleParentIface),
35                                        NULL,
36                                        0,
37                                        NULL,
38                                        0);
39
40       g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
41     }
42
43   return g_define_type_id__volatile;
44 }
45
46 void
47 _gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent,
48                                               GtkCellAccessible       *cell,
49                                               gint                    *x,
50                                               gint                    *y,
51                                               gint                    *width,
52                                               gint                    *height,
53                                               AtkCoordType             coord_type)
54 {
55   GtkCellAccessibleParentIface *iface;
56
57   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
58
59   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
60
61   if (iface->get_cell_extents)
62     (iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type);
63 }
64
65 void
66 _gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent,
67                                            GtkCellAccessible       *cell,
68                                            GdkRectangle            *cell_rect)
69 {
70   GtkCellAccessibleParentIface *iface;
71
72   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
73   g_return_if_fail (cell_rect);
74
75   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
76
77   if (iface->get_cell_area)
78     (iface->get_cell_area) (parent, cell, cell_rect);
79 }
80
81 gboolean
82 _gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent,
83                                         GtkCellAccessible       *cell)
84 {
85   GtkCellAccessibleParentIface *iface;
86
87   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE);
88
89   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
90
91   if (iface->grab_focus)
92     return (iface->grab_focus) (parent, cell);
93   else
94     return FALSE;
95 }
96
97 int
98 _gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent,
99                                              GtkCellAccessible       *cell)
100 {
101   GtkCellAccessibleParentIface *iface;
102
103   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE);
104
105   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
106
107   if (iface->get_child_index)
108     return (iface->get_child_index) (parent, cell);
109   else
110     return -1;
111 }
112
113 GtkCellRendererState
114 _gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent,
115                                                 GtkCellAccessible       *cell)
116 {
117   GtkCellAccessibleParentIface *iface;
118
119   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), 0);
120   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0);
121
122   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
123
124   if (iface->get_renderer_state)
125     return (iface->get_renderer_state) (parent, cell);
126   else
127     return 0;
128 }
129
130 void
131 _gtk_cell_accessible_parent_expand_collapse (GtkCellAccessibleParent *parent,
132                                              GtkCellAccessible       *cell)
133 {
134   GtkCellAccessibleParentIface *iface;
135
136   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
137   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
138
139   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
140
141   if (iface->expand_collapse)
142     (iface->expand_collapse) (parent, cell);
143 }
144
145 void
146 _gtk_cell_accessible_parent_activate (GtkCellAccessibleParent *parent,
147                                       GtkCellAccessible       *cell)
148 {
149   GtkCellAccessibleParentIface *iface;
150
151   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
152   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
153
154   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
155
156   if (iface->activate)
157     (iface->activate) (parent, cell);
158 }
159
160 void
161 _gtk_cell_accessible_parent_edit (GtkCellAccessibleParent *parent,
162                                   GtkCellAccessible       *cell)
163 {
164   GtkCellAccessibleParentIface *iface;
165
166   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
167   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
168
169   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
170
171   if (iface->edit)
172     (iface->edit) (parent, cell);
173 }