| 1 |
/* GTK+ - accessibility implementations |
| 2 |
* Copyright 2001 Sun Microsystems Inc. |
| 3 |
* |
| 4 |
* This library is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU Lesser 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 |
* Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public |
| 15 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
#include "config.h" |
| 19 |
|
| 20 |
#include <gtk/gtk.h> |
| 21 |
#include "gtkcellaccessibleparent.h" |
| 22 |
|
| 23 |
GType |
| 24 |
gtk_cell_accessible_parent_get_type (void) |
| 25 |
{ |
| 26 |
static gsize g_define_type_id__volatile = 0; |
| 27 |
|
| 28 |
if (g_once_init_enter (&g_define_type_id__volatile)) |
| 29 |
{ |
| 30 |
GType g_define_type_id = |
| 31 |
g_type_register_static_simple (G_TYPE_INTERFACE, |
| 32 |
"GtkCellAccessibleParent", |
| 33 |
sizeof (GtkCellAccessibleParentIface), |
| 34 |
NULL, |
| 35 |
0, |
| 36 |
NULL, |
| 37 |
0); |
| 38 |
|
| 39 |
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); |
| 40 |
} |
| 41 |
|
| 42 |
return g_define_type_id__volatile; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* gtk_cell_accessible_parent_get_cell_extents: |
| 47 |
* @x: (out): |
| 48 |
* @y: (out): |
| 49 |
* @width: (out): |
| 50 |
* @height: (out): |
| 51 |
*/ |
| 52 |
void |
| 53 |
gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent, |
| 54 |
GtkCellAccessible *cell, |
| 55 |
gint *x, |
| 56 |
gint *y, |
| 57 |
gint *width, |
| 58 |
gint *height, |
| 59 |
AtkCoordType coord_type) |
| 60 |
{ |
| 61 |
GtkCellAccessibleParentIface *iface; |
| 62 |
|
| 63 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); |
| 64 |
|
| 65 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 66 |
|
| 67 |
if (iface->get_cell_extents) |
| 68 |
(iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type); |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* gtk_cell_accessible_parent_get_cell_area: |
| 73 |
* @cell_rect: (out): |
| 74 |
*/ |
| 75 |
void |
| 76 |
gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent, |
| 77 |
GtkCellAccessible *cell, |
| 78 |
GdkRectangle *cell_rect) |
| 79 |
{ |
| 80 |
GtkCellAccessibleParentIface *iface; |
| 81 |
|
| 82 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); |
| 83 |
g_return_if_fail (cell_rect); |
| 84 |
|
| 85 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 86 |
|
| 87 |
if (iface->get_cell_area) |
| 88 |
(iface->get_cell_area) (parent, cell, cell_rect); |
| 89 |
} |
| 90 |
|
| 91 |
gboolean |
| 92 |
gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent, |
| 93 |
GtkCellAccessible *cell) |
| 94 |
{ |
| 95 |
GtkCellAccessibleParentIface *iface; |
| 96 |
|
| 97 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE); |
| 98 |
|
| 99 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 100 |
|
| 101 |
if (iface->grab_focus) |
| 102 |
return (iface->grab_focus) (parent, cell); |
| 103 |
else |
| 104 |
return FALSE; |
| 105 |
} |
| 106 |
|
| 107 |
int |
| 108 |
gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent, |
| 109 |
GtkCellAccessible *cell) |
| 110 |
{ |
| 111 |
GtkCellAccessibleParentIface *iface; |
| 112 |
|
| 113 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE); |
| 114 |
|
| 115 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 116 |
|
| 117 |
if (iface->get_child_index) |
| 118 |
return (iface->get_child_index) (parent, cell); |
| 119 |
else |
| 120 |
return -1; |
| 121 |
} |
| 122 |
|
| 123 |
GtkCellRendererState |
| 124 |
gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent, |
| 125 |
GtkCellAccessible *cell) |
| 126 |
{ |
| 127 |
GtkCellAccessibleParentIface *iface; |
| 128 |
|
| 129 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), 0); |
| 130 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0); |
| 131 |
|
| 132 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 133 |
|
| 134 |
if (iface->get_renderer_state) |
| 135 |
return (iface->get_renderer_state) (parent, cell); |
| 136 |
else |
| 137 |
return 0; |
| 138 |
} |
| 139 |
|
| 140 |
void |
| 141 |
gtk_cell_accessible_parent_expand_collapse (GtkCellAccessibleParent *parent, |
| 142 |
GtkCellAccessible *cell) |
| 143 |
{ |
| 144 |
GtkCellAccessibleParentIface *iface; |
| 145 |
|
| 146 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); |
| 147 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); |
| 148 |
|
| 149 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 150 |
|
| 151 |
if (iface->expand_collapse) |
| 152 |
(iface->expand_collapse) (parent, cell); |
| 153 |
} |
| 154 |
|
| 155 |
void |
| 156 |
gtk_cell_accessible_parent_activate (GtkCellAccessibleParent *parent, |
| 157 |
GtkCellAccessible *cell) |
| 158 |
{ |
| 159 |
GtkCellAccessibleParentIface *iface; |
| 160 |
|
| 161 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); |
| 162 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); |
| 163 |
|
| 164 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 165 |
|
| 166 |
if (iface->activate) |
| 167 |
(iface->activate) (parent, cell); |
| 168 |
} |
| 169 |
|
| 170 |
void |
| 171 |
gtk_cell_accessible_parent_edit (GtkCellAccessibleParent *parent, |
| 172 |
GtkCellAccessible *cell) |
| 173 |
{ |
| 174 |
GtkCellAccessibleParentIface *iface; |
| 175 |
|
| 176 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); |
| 177 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); |
| 178 |
|
| 179 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 180 |
|
| 181 |
if (iface->edit) |
| 182 |
(iface->edit) (parent, cell); |
| 183 |
} |
| 184 |
|
| 185 |
void |
| 186 |
gtk_cell_accessible_parent_update_relationset (GtkCellAccessibleParent *parent, |
| 187 |
GtkCellAccessible *cell, |
| 188 |
AtkRelationSet *relationset) |
| 189 |
{ |
| 190 |
GtkCellAccessibleParentIface *iface; |
| 191 |
|
| 192 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); |
| 193 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); |
| 194 |
g_return_if_fail (ATK_IS_RELATION_SET (relationset)); |
| 195 |
|
| 196 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 197 |
|
| 198 |
if (iface->update_relationset) |
| 199 |
(iface->update_relationset) (parent, cell, relationset); |
| 200 |
} |
| 201 |
|
| 202 |
/** |
| 203 |
* gtk_cell_accessible_parent_get_cell_position: |
| 204 |
* @row: (out): |
| 205 |
* @column: (out): |
| 206 |
*/ |
| 207 |
void |
| 208 |
gtk_cell_accessible_parent_get_cell_position (GtkCellAccessibleParent *parent, |
| 209 |
GtkCellAccessible *cell, |
| 210 |
gint *row, |
| 211 |
gint *column) |
| 212 |
{ |
| 213 |
GtkCellAccessibleParentIface *iface; |
| 214 |
|
| 215 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); |
| 216 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); |
| 217 |
|
| 218 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 219 |
|
| 220 |
if (iface->get_cell_position) |
| 221 |
(iface->get_cell_position) (parent, cell, row, column); |
| 222 |
else |
| 223 |
{ |
| 224 |
if (row) |
| 225 |
*row = -1; |
| 226 |
if (column) |
| 227 |
*column = -1; |
| 228 |
} |
| 229 |
} |
| 230 |
|
| 231 |
/** |
| 232 |
* gtk_cell_accessible_parent_get_column_header_cells: |
| 233 |
* Returns: (transfer full) (element-type AtkObject) |
| 234 |
*/ |
| 235 |
GPtrArray * |
| 236 |
gtk_cell_accessible_parent_get_column_header_cells (GtkCellAccessibleParent *parent, |
| 237 |
GtkCellAccessible *cell) |
| 238 |
{ |
| 239 |
GtkCellAccessibleParentIface *iface; |
| 240 |
|
| 241 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), NULL); |
| 242 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), NULL); |
| 243 |
|
| 244 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 245 |
|
| 246 |
if (iface->get_column_header_cells) |
| 247 |
return (iface->get_column_header_cells) (parent, cell); |
| 248 |
else |
| 249 |
return NULL; |
| 250 |
} |
| 251 |
|
| 252 |
/** |
| 253 |
* gtk_cell_accessible_parent_get_row_header_cells: |
| 254 |
* Returns: (transfer full) (element-type AtkObject) |
| 255 |
*/ |
| 256 |
GPtrArray * |
| 257 |
gtk_cell_accessible_parent_get_row_header_cells (GtkCellAccessibleParent *parent, |
| 258 |
GtkCellAccessible *cell) |
| 259 |
{ |
| 260 |
GtkCellAccessibleParentIface *iface; |
| 261 |
|
| 262 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), NULL); |
| 263 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), NULL); |
| 264 |
|
| 265 |
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); |
| 266 |
|
| 267 |
if (iface->get_row_header_cells) |
| 268 |
return (iface->get_row_header_cells) (parent, cell); |
| 269 |
else |
| 270 |
return NULL; |
| 271 |
} |