]> Pileus Git - ~andy/gtk/blob - gtk/a11y/gtkcellaccessibleparent.c
a11y: Don't duplicate information anymore
[~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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #include "config.h"
22
23 #include <gtk/gtk.h>
24 #include "gtkcellaccessibleparent.h"
25
26 GType
27 _gtk_cell_accessible_parent_get_type (void)
28 {
29   static volatile gsize g_define_type_id__volatile = 0;
30
31   if (g_once_init_enter (&g_define_type_id__volatile))
32     {
33       GType g_define_type_id =
34         g_type_register_static_simple (G_TYPE_INTERFACE,
35                                        "GtkCellAccessibleParent",
36                                        sizeof (GtkCellAccessibleParentIface),
37                                        NULL,
38                                        0,
39                                        NULL,
40                                        0);
41
42       g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
43     }
44
45   return g_define_type_id__volatile;
46 }
47
48 void
49 _gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent,
50                                               GtkCellAccessible       *cell,
51                                               gint                    *x,
52                                               gint                    *y,
53                                               gint                    *width,
54                                               gint                    *height,
55                                               AtkCoordType             coord_type)
56 {
57   GtkCellAccessibleParentIface *iface;
58
59   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
60
61   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
62
63   if (iface->get_cell_extents)
64     (iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type);
65 }
66
67 void
68 _gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent,
69                                            GtkCellAccessible       *cell,
70                                            GdkRectangle            *cell_rect)
71 {
72   GtkCellAccessibleParentIface *iface;
73
74   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
75   g_return_if_fail (cell_rect);
76
77   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
78
79   if (iface->get_cell_area)
80     (iface->get_cell_area) (parent, cell, cell_rect);
81 }
82
83 gboolean
84 _gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent,
85                                         GtkCellAccessible       *cell)
86 {
87   GtkCellAccessibleParentIface *iface;
88
89   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE);
90
91   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
92
93   if (iface->grab_focus)
94     return (iface->grab_focus) (parent, cell);
95   else
96     return FALSE;
97 }
98
99 int
100 _gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent,
101                                              GtkCellAccessible       *cell)
102 {
103   GtkCellAccessibleParentIface *iface;
104
105   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE);
106
107   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
108
109   if (iface->get_child_index)
110     return (iface->get_child_index) (parent, cell);
111   else
112     return -1;
113 }
114
115 GtkCellRendererState
116 _gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent,
117                                                 GtkCellAccessible       *cell)
118 {
119   GtkCellAccessibleParentIface *iface;
120
121   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), 0);
122   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0);
123
124   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
125
126   if (iface->get_renderer_state)
127     return (iface->get_renderer_state) (parent, cell);
128   else
129     return 0;
130 }
131
132 void
133 _gtk_cell_accessible_parent_set_cell_data (GtkCellAccessibleParent *parent,
134                                            GtkCellAccessible       *cell)
135 {
136   GtkCellAccessibleParentIface *iface;
137
138   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
139   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
140
141   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
142
143   if (iface->set_cell_data)
144     (iface->set_cell_data) (parent, cell);
145 }
146