diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-05-02 20:47:16 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-05-02 20:47:16 -0400 |
commit | 9d7f7ddadfd680c0eddec9c99363ba430e7ae388 (patch) | |
tree | 83dfad616181fcde590b8cd576f35f573d20c62b /gtk/a11y | |
parent | fc7e7495a6a4f3bb7335f48cd64a7648a21ffea7 (diff) | |
download | gtk+-9d7f7ddadfd680c0eddec9c99363ba430e7ae388.tar.gz |
GtkSpinButton: Implement new AtkValue interface
The AtkValue interface has been replaced in ATK 2.12.
Implement the new one in addition to the old one.
Diffstat (limited to 'gtk/a11y')
-rw-r--r-- | gtk/a11y/gtkspinbuttonaccessible.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gtk/a11y/gtkspinbuttonaccessible.c b/gtk/a11y/gtkspinbuttonaccessible.c index 75a5881c18..8eea704bc5 100644 --- a/gtk/a11y/gtkspinbuttonaccessible.c +++ b/gtk/a11y/gtkspinbuttonaccessible.c @@ -206,6 +206,68 @@ gtk_spin_button_accessible_set_current_value (AtkValue *obj, } static void +gtk_spin_button_accessible_get_value_and_text (AtkValue *obj, + gdouble *value, + gchar **text) +{ + GtkWidget *widget; + GtkAdjustment *adjustment; + + widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); + adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); + if (adjustment == NULL) + return; + + *value = gtk_adjustment_get_value (adjustment); + *text = NULL; +} + +static AtkRange * +gtk_spin_button_accessible_get_range (AtkValue *obj) +{ + GtkWidget *widget; + GtkAdjustment *adjustment; + + widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); + adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); + if (adjustment == NULL) + return NULL; + + return atk_range_new (gtk_adjustment_get_lower (adjustment), + gtk_adjustment_get_upper (adjustment), + NULL); +} + +static void +gtk_spin_button_accessible_set_value (AtkValue *obj, + const gdouble value) +{ + GtkWidget *widget; + GtkAdjustment *adjustment; + + widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); + adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); + if (adjustment == NULL) + return; + + gtk_adjustment_set_value (adjustment, value); +} + +static gdouble +gtk_spin_button_accessible_get_increment (AtkValue *obj) +{ + GtkWidget *widget; + GtkAdjustment *adjustment; + + widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); + adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); + if (adjustment == NULL) + return 0; + + return gtk_adjustment_get_minimum_increment (adjustment); +} + +static void atk_value_interface_init (AtkValueIface *iface) { iface->get_current_value = gtk_spin_button_accessible_get_current_value; @@ -213,4 +275,9 @@ atk_value_interface_init (AtkValueIface *iface) iface->get_minimum_value = gtk_spin_button_accessible_get_minimum_value; iface->get_minimum_increment = gtk_spin_button_accessible_get_minimum_increment; iface->set_current_value = gtk_spin_button_accessible_set_current_value; + + iface->get_value_and_text = gtk_spin_button_accessible_get_value_and_text; + iface->get_range = gtk_spin_button_accessible_get_range; + iface->set_value = gtk_spin_button_accessible_set_value; + iface->get_increment = gtk_spin_button_accessible_get_increment; } |