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.
26 #include "gtkprogressbaraccessible.h"
29 static void atk_value_interface_init (AtkValueIface *iface);
31 G_DEFINE_TYPE_WITH_CODE (GtkProgressBarAccessible, gtk_progress_bar_accessible, GAIL_TYPE_WIDGET,
32 G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
35 gtk_progress_bar_accessible_initialize (AtkObject *obj,
38 ATK_OBJECT_CLASS (gtk_progress_bar_accessible_parent_class)->initialize (obj, data);
40 obj->role = ATK_ROLE_PROGRESS_BAR;
44 gtk_progress_bar_accessible_notify_gtk (GObject *obj,
47 GtkWidget *widget = GTK_WIDGET (obj);
48 AtkObject *accessible;
50 accessible = gtk_widget_get_accessible (widget);
52 if (strcmp (pspec->name, "fraction") == 0)
53 g_object_notify (G_OBJECT (accessible), "accessible-value");
55 GAIL_WIDGET_CLASS (gtk_progress_bar_accessible_parent_class)->notify_gtk (obj, pspec);
58 gtk_progress_bar_accessible_class_init (GtkProgressBarAccessibleClass *klass)
60 AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
61 GailWidgetClass *widget_class;
63 widget_class = (GailWidgetClass*)klass;
65 widget_class->notify_gtk = gtk_progress_bar_accessible_notify_gtk;
67 class->initialize = gtk_progress_bar_accessible_initialize;
71 gtk_progress_bar_accessible_init (GtkProgressBarAccessible *bar)
76 gtk_progress_bar_accessible_get_current_value (AtkValue *obj,
81 widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
83 memset (value, 0, sizeof (GValue));
84 g_value_init (value, G_TYPE_DOUBLE);
85 g_value_set_double (value, gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget)));
89 gtk_progress_bar_accessible_get_maximum_value (AtkValue *obj,
92 memset (value, 0, sizeof (GValue));
93 g_value_init (value, G_TYPE_DOUBLE);
94 g_value_set_double (value, 1.0);
98 gtk_progress_bar_accessible_get_minimum_value (AtkValue *obj,
101 memset (value, 0, sizeof (GValue));
102 g_value_init (value, G_TYPE_DOUBLE);
103 g_value_set_double (value, 0.0);
107 atk_value_interface_init (AtkValueIface *iface)
109 iface->get_current_value = gtk_progress_bar_accessible_get_current_value;
110 iface->get_maximum_value = gtk_progress_bar_accessible_get_maximum_value;
111 iface->get_minimum_value = gtk_progress_bar_accessible_get_minimum_value;