[gtk+] GtkPaned: Implement new AtkValue interface



commit 98affc6829443cde30540c9feee20f9df76bd59b
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 2 20:46:17 2014 -0400

    GtkPaned: Implement new AtkValue interface
    
    The AtkValue interface has been replaced in ATK 2.12.
    Implement the new one in addition to the old one.

 gtk/a11y/gtkpanedaccessible.c |   49 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/gtk/a11y/gtkpanedaccessible.c b/gtk/a11y/gtkpanedaccessible.c
index b9c3cec..48dc9e4 100644
--- a/gtk/a11y/gtkpanedaccessible.c
+++ b/gtk/a11y/gtkpanedaccessible.c
@@ -143,10 +143,59 @@ gtk_paned_accessible_set_current_value (AtkValue     *obj,
 }
 
 static void
+gtk_paned_accessible_get_value_and_text (AtkValue  *obj,
+                                         gdouble   *value,
+                                         gchar    **text)
+{
+  GtkWidget *widget;
+  GtkPaned *paned;
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+  paned = GTK_PANED (widget);
+
+  *value = gtk_paned_get_position (paned);
+  *text = NULL;
+}
+
+static AtkRange *
+gtk_paned_accessible_get_range (AtkValue *obj)
+{
+  GtkWidget *widget;
+  gint minimum_value;
+  gint maximum_value;
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+
+  g_object_get (widget,
+                "min-position", &minimum_value,
+                "max-position", &maximum_value,
+                NULL);
+
+  return atk_range_new (minimum_value, maximum_value, NULL);
+}
+
+static void
+gtk_paned_accessible_set_value (AtkValue      *obj,
+                                const gdouble  value)
+{
+  GtkWidget *widget;
+  GtkPaned *paned;
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+  paned = GTK_PANED (widget);
+
+  gtk_paned_set_position (paned, (gint)(value + 0.5));
+}
+
+static void
 atk_value_interface_init (AtkValueIface *iface)
 {
   iface->get_current_value = gtk_paned_accessible_get_current_value;
   iface->get_maximum_value = gtk_paned_accessible_get_maximum_value;
   iface->get_minimum_value = gtk_paned_accessible_get_minimum_value;
   iface->set_current_value = gtk_paned_accessible_set_current_value;
+
+  iface->get_value_and_text = gtk_paned_accessible_get_value_and_text;
+  iface->get_range = gtk_paned_accessible_get_range;
+  iface->set_value = gtk_paned_accessible_set_value;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]