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 "gailprogressbar.h"
27 #include "gailadjustment.h"
29 static void gail_progress_bar_class_init (GailProgressBarClass *klass);
30 static void gail_progress_bar_init (GailProgressBar *bar);
31 static void gail_progress_bar_real_initialize (AtkObject *obj,
34 static void atk_value_interface_init (AtkValueIface *iface);
37 static void gail_progress_bar_real_notify_gtk (GObject *obj,
40 static void gail_progress_bar_get_current_value (AtkValue *obj,
42 static void gail_progress_bar_get_maximum_value (AtkValue *obj,
44 static void gail_progress_bar_get_minimum_value (AtkValue *obj,
47 G_DEFINE_TYPE_WITH_CODE (GailProgressBar, gail_progress_bar, GAIL_TYPE_WIDGET,
48 G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
51 gail_progress_bar_class_init (GailProgressBarClass *klass)
53 AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
54 GailWidgetClass *widget_class;
56 widget_class = (GailWidgetClass*)klass;
58 widget_class->notify_gtk = gail_progress_bar_real_notify_gtk;
60 class->initialize = gail_progress_bar_real_initialize;
64 gail_progress_bar_init (GailProgressBar *bar)
69 gail_progress_bar_real_initialize (AtkObject *obj,
72 ATK_OBJECT_CLASS (gail_progress_bar_parent_class)->initialize (obj, data);
74 obj->role = ATK_ROLE_PROGRESS_BAR;
78 atk_value_interface_init (AtkValueIface *iface)
80 iface->get_current_value = gail_progress_bar_get_current_value;
81 iface->get_maximum_value = gail_progress_bar_get_maximum_value;
82 iface->get_minimum_value = gail_progress_bar_get_minimum_value;
86 gail_progress_bar_get_current_value (AtkValue *obj,
91 g_return_if_fail (GAIL_IS_PROGRESS_BAR (obj));
93 widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
95 g_value_set_double (value, gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget)));
99 gail_progress_bar_get_maximum_value (AtkValue *obj,
102 g_return_if_fail (GAIL_IS_PROGRESS_BAR (obj));
104 g_value_set_double (value, 1.0);
108 gail_progress_bar_get_minimum_value (AtkValue *obj,
111 g_return_if_fail (GAIL_IS_PROGRESS_BAR (obj));
113 g_value_set_double (value, 0.0);
117 gail_progress_bar_real_notify_gtk (GObject *obj,
120 GtkWidget *widget = GTK_WIDGET (obj);
121 GailProgressBar *progress_bar = GAIL_PROGRESS_BAR (gtk_widget_get_accessible (widget));
123 if (strcmp (pspec->name, "fraction") == 0)
124 g_object_notify (G_OBJECT (progress_bar), "accessible-value");
126 GAIL_WIDGET_CLASS (gail_progress_bar_parent_class)->notify_gtk (obj, pspec);