]> Pileus Git - ~andy/gtk/blob - gtk/a11y/gailscale.c
tests: Update range tests for slider value in description
[~andy/gtk] / gtk / a11y / gailscale.c
1 /* GAIL - The GNOME Accessibility Implementation Library
2  * Copyright 2004 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 <gtk/gtk.h>
23 #include "gailscale.h"
24
25 static const char * gail_scale_get_description   (AtkObject     *object);
26
27 G_DEFINE_TYPE (GailScale, gail_scale, GAIL_TYPE_RANGE)
28
29 static void      
30 gail_scale_class_init (GailScaleClass *klass)
31 {
32   AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
33
34   class->get_description = gail_scale_get_description;
35 }
36
37 static void
38 gail_scale_init (GailScale      *scale)
39 {
40 }
41
42 static const char *
43 gail_scale_get_description (AtkObject *object)
44 {
45   GtkWidget *widget;
46   PangoLayout *layout;
47
48   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
49   if (widget == NULL)
50     /* State is defunct */
51     return NULL;
52
53   layout = gtk_scale_get_layout (GTK_SCALE (widget));
54   if (layout)
55     return pango_layout_get_text (layout);
56
57   return ATK_OBJECT_CLASS (gail_scale_parent_class)->get_description (object);
58 }