]> Pileus Git - ~andy/gtk/blob - gtk/gtkaccessible.c
e39d382f1201e3eeff4e8834dc77109fd4b057a5
[~andy/gtk] / gtk / gtkaccessible.c
1 /* GTK - The GIMP Toolkit
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include <config.h>
21 #include <string.h>
22
23 #include "gtkwidget.h"
24 #include "gtkaccessible.h"
25 #include "gtkalias.h"
26
27 static void gtk_accessible_class_init (GtkAccessibleClass *klass);
28
29 static void gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible);
30
31 GType
32 gtk_accessible_get_type (void)
33 {
34   static GType accessible_type = 0;
35
36   if (!accessible_type)
37     {
38       static const GTypeInfo accessible_info =
39       {
40         sizeof (GtkAccessibleClass),
41         NULL,           /* base_init */
42         NULL,           /* base_finalize */
43         (GClassInitFunc) gtk_accessible_class_init,
44         NULL,           /* class_finalize */
45         NULL,           /* class_data */
46         sizeof (GtkAccessible),
47         16,             /* n_preallocs */
48         (GInstanceInitFunc) NULL,
49       };
50
51       accessible_type =
52         g_type_register_static (ATK_TYPE_OBJECT, g_intern_static_string ("GtkAccessible"),
53                                 &accessible_info, 0);
54     }
55
56   return accessible_type;
57 }
58
59 static void
60 gtk_accessible_class_init (GtkAccessibleClass *klass)
61 {
62   klass->connect_widget_destroyed = gtk_accessible_real_connect_widget_destroyed;
63 }
64
65 /**
66  * gtk_accessible_connect_widget_destroyed
67  * @accessible: a #GtkAccessible
68  *
69  * This function specifies the callback function to be called when the widget
70  * corresponding to a GtkAccessible is destroyed.
71  */
72 void
73 gtk_accessible_connect_widget_destroyed (GtkAccessible *accessible)
74 {
75   GtkAccessibleClass *class;
76
77   g_return_if_fail (GTK_IS_ACCESSIBLE (accessible));
78
79   class = GTK_ACCESSIBLE_GET_CLASS (accessible);
80
81   if (class->connect_widget_destroyed)
82     class->connect_widget_destroyed (accessible);
83 }
84
85 static void
86 gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible)
87 {
88   if (accessible->widget)
89   {
90     g_signal_connect (accessible->widget,
91                       "destroy",
92                       G_CALLBACK (gtk_widget_destroyed),
93                       &accessible->widget);
94   }
95 }
96
97 #define __GTK_ACCESSIBLE_C__
98 #include "gtkaliasdef.c"