Debian Codegraph @

gtk/a11y/gtkflowboxchildaccessible.c

raw
1 /*
2 * Copyright (C) 2013 Red Hat, 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 "gtkflowboxchildaccessible.h"
21
22 #include "gtk/gtkflowbox.h"
23
24
25 G_DEFINE_TYPE (GtkFlowBoxChildAccessible, gtk_flow_box_child_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
26
27 static void
28 gtk_flow_box_child_accessible_init (GtkFlowBoxChildAccessible *accessible)
29 {
30 }
31
32 static void
33 gtk_flow_box_child_accessible_initialize (AtkObject *obj,
34 gpointer data)
35 {
36 ATK_OBJECT_CLASS (gtk_flow_box_child_accessible_parent_class)->initialize (obj, data);
37
38 obj->role = ATK_ROLE_TABLE_CELL;
39 }
40
41 static AtkStateSet *
42 gtk_flow_box_child_accessible_ref_state_set (AtkObject *obj)
43 {
44 AtkStateSet *state_set;
45 GtkWidget *widget, *parent;
46
47 state_set = ATK_OBJECT_CLASS (gtk_flow_box_child_accessible_parent_class)->ref_state_set (obj);
48
49 widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
50 if (widget != NULL)
51 {
52 parent = gtk_widget_get_parent (widget);
53 if (gtk_flow_box_get_selection_mode (GTK_FLOW_BOX (parent)) != GTK_SELECTION_NONE)
54 atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
55
56 if (gtk_flow_box_child_is_selected (GTK_FLOW_BOX_CHILD (widget)))
57 atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
58 }
59
60 return state_set;
61 }
62
63 static void
64 gtk_flow_box_child_accessible_class_init (GtkFlowBoxChildAccessibleClass *klass)
65 {
66 AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass);
67
68 object_class->initialize = gtk_flow_box_child_accessible_initialize;
69 object_class->ref_state_set = gtk_flow_box_child_accessible_ref_state_set;
70 }