1 /* GTK - The GIMP Toolkit
2 * Copyright 2001 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.
23 #include "gtkwidget.h"
25 #include "gtkaccessible.h"
28 * SECTION:gtkaccessible
29 * @Short_description: Accessibility support for widgets
30 * @Title: GtkAccessible
35 * @widget: The GtkWidget whose properties and features are exported via this
38 struct _GtkAccessiblePrivate
43 static void gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible);
45 G_DEFINE_TYPE (GtkAccessible, gtk_accessible, ATK_TYPE_OBJECT)
48 gtk_accessible_init (GtkAccessible *accesible)
50 accesible->priv = G_TYPE_INSTANCE_GET_PRIVATE (accesible,
52 GtkAccessiblePrivate);
56 gtk_accessible_class_init (GtkAccessibleClass *klass)
58 klass->connect_widget_destroyed = gtk_accessible_real_connect_widget_destroyed;
60 g_type_class_add_private (klass, sizeof (GtkAccessiblePrivate));
64 * gtk_accessible_set_widget:
65 * @accessible: a #GtkAccessible
66 * @widget: a #GtkWidget
68 * Sets the #GtkWidget corresponding to the #GtkAccessible.
73 gtk_accessible_set_widget (GtkAccessible *accessible,
76 g_return_if_fail (GTK_IS_ACCESSIBLE (accessible));
78 accessible->priv->widget = widget;
82 * gtk_accessible_get_widget:
83 * @accessible: a #GtkAccessible
85 * Gets the #GtkWidget corresponding to the #GtkAccessible. The returned widget
86 * does not have a reference added, so you do not need to unref it.
88 * Returns: (transfer none): pointer to the #GtkWidget corresponding to
89 * the #GtkAccessible, or %NULL.
94 gtk_accessible_get_widget (GtkAccessible *accessible)
96 g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), NULL);
98 return accessible->priv->widget;
102 * gtk_accessible_connect_widget_destroyed
103 * @accessible: a #GtkAccessible
105 * This function specifies the callback function to be called when the widget
106 * corresponding to a GtkAccessible is destroyed.
109 gtk_accessible_connect_widget_destroyed (GtkAccessible *accessible)
111 GtkAccessibleClass *class;
113 g_return_if_fail (GTK_IS_ACCESSIBLE (accessible));
115 class = GTK_ACCESSIBLE_GET_CLASS (accessible);
117 if (class->connect_widget_destroyed)
118 class->connect_widget_destroyed (accessible);
122 gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible)
124 GtkAccessiblePrivate *priv = accessible->priv;
128 g_signal_connect (priv->widget,
130 G_CALLBACK (gtk_widget_destroyed),