1 /* GAIL - The GNOME Accessibility Implementation Library
2 * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
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.
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.
14 * You should have received a copy of the GNU Lesser 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.
24 #include "gtkstatusbaraccessible.h"
27 G_DEFINE_TYPE (GtkStatusbarAccessible, _gtk_statusbar_accessible, GTK_TYPE_BOX_ACCESSIBLE)
30 text_changed (GtkStatusbar *statusbar,
36 g_object_notify (G_OBJECT (obj), "accessible-name");
37 g_signal_emit_by_name (obj, "visible-data-changed");
41 gtk_statusbar_accessible_initialize (AtkObject *obj,
44 GtkWidget *statusbar = data;
46 ATK_OBJECT_CLASS (_gtk_statusbar_accessible_parent_class)->initialize (obj, data);
48 g_signal_connect_after (statusbar, "text-pushed",
49 G_CALLBACK (text_changed), obj);
50 g_signal_connect_after (statusbar, "text-popped",
51 G_CALLBACK (text_changed), obj);
53 obj->role = ATK_ROLE_STATUSBAR;
57 find_label_child (GtkContainer *container)
59 GList *children, *tmp_list;
62 children = gtk_container_get_children (container);
65 for (tmp_list = children; tmp_list != NULL; tmp_list = tmp_list->next)
67 if (GTK_IS_LABEL (tmp_list->data))
69 child = GTK_WIDGET (tmp_list->data);
72 else if (GTK_IS_CONTAINER (tmp_list->data))
74 child = find_label_child (GTK_CONTAINER (tmp_list->data));
79 g_list_free (children);
85 get_label_from_statusbar (GtkStatusbar *statusbar)
89 box = gtk_statusbar_get_message_area (statusbar);
91 return find_label_child (GTK_CONTAINER (box));
95 gtk_statusbar_accessible_get_name (AtkObject *obj)
101 widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
105 name = ATK_OBJECT_CLASS (_gtk_statusbar_accessible_parent_class)->get_name (obj);
109 label = get_label_from_statusbar (GTK_STATUSBAR (widget));
110 if (GTK_IS_LABEL (label))
111 return gtk_label_get_label (GTK_LABEL (label));
117 gtk_statusbar_accessible_get_n_children (AtkObject *obj)
123 gtk_statusbar_accessible_ref_child (AtkObject *obj,
130 _gtk_statusbar_accessible_class_init (GtkStatusbarAccessibleClass *klass)
132 AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
133 GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass;
135 class->get_name = gtk_statusbar_accessible_get_name;
136 class->get_n_children = gtk_statusbar_accessible_get_n_children;
137 class->ref_child = gtk_statusbar_accessible_ref_child;
138 class->initialize = gtk_statusbar_accessible_initialize;
140 * As we report the statusbar as having no children
141 * we are not interested in add and remove signals
143 container_class->add_gtk = NULL;
144 container_class->remove_gtk = NULL;
148 _gtk_statusbar_accessible_init (GtkStatusbarAccessible *bar)