]> Pileus Git - ~andy/gtk/blob - modules/other/gail/gailframe.c
7806837e28a94873363c48d60e9e190b5761d01b
[~andy/gtk] / modules / other / gail / gailframe.c
1 /* GAIL - The GNOME Accessibility Implementation Library
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
22 #include <string.h>
23 #include <gtk/gtk.h>
24 #include "gailframe.h"
25
26 static void                  gail_frame_class_init       (GailFrameClass  *klass);
27 static void                  gail_frame_init             (GailFrame       *frame);
28 static void                  gail_frame_initialize       (AtkObject       *accessible,
29                                                           gpointer         data);
30 static const gchar* gail_frame_get_name         (AtkObject       *obj);
31
32 G_DEFINE_TYPE (GailFrame, gail_frame, GAIL_TYPE_CONTAINER)
33
34 static void
35 gail_frame_class_init (GailFrameClass *klass)
36 {
37   AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
38
39   class->initialize = gail_frame_initialize;
40   class->get_name = gail_frame_get_name;
41 }
42
43 static void
44 gail_frame_init (GailFrame       *frame)
45 {
46 }
47
48 static void
49 gail_frame_initialize (AtkObject *accessible,
50                        gpointer  data)
51 {
52   ATK_OBJECT_CLASS (gail_frame_parent_class)->initialize (accessible, data);
53
54   accessible->role = ATK_ROLE_PANEL;
55 }
56
57 static const gchar*
58 gail_frame_get_name (AtkObject *obj)
59 {
60   const gchar *name;
61   g_return_val_if_fail (GAIL_IS_FRAME (obj), NULL);
62
63   name = ATK_OBJECT_CLASS (gail_frame_parent_class)->get_name (obj);
64   if (name != NULL)
65   {
66     return name;
67   }
68   else
69   {
70     /*
71      * Get the text on the label
72      */
73     GtkWidget *widget;
74
75     widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
76     if (widget == NULL)
77     {
78       /*
79        * State is defunct
80        */
81       return NULL;
82     }
83     return gtk_frame_get_label (GTK_FRAME (widget));
84   }
85 }