[gtk/ebassi/a11y/accessible-range: 9/14] Implement also for GtkPaned




commit ce761122b20e775d5febfdd04ad22304632547d8
Author: Lukáš Tyrychtr <lukastyrychtr gmail com>
Date:   Fri Sep 16 10:22:05 2022 +0200

    Implement also for GtkPaned

 gtk/gtkpaned.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 4360050c43..c0ff043d2f 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -26,6 +26,7 @@
 
 #include "gtkpaned.h"
 
+#include "gtkaccessiblerange.h"
 #include "gtkcssboxesprivate.h"
 #include "gtkeventcontrollermotion.h"
 #include "gtkgesturepan.h"
@@ -246,8 +247,12 @@ static void     update_drag                     (GtkPaned         *paned,
 
 static void gtk_paned_buildable_iface_init (GtkBuildableIface *iface);
 
+static void gtk_paned_accessible_range_init (GtkAccessibleRangeInterface *iface);
+
 G_DEFINE_TYPE_WITH_CODE (GtkPaned, gtk_paned, GTK_TYPE_WIDGET,
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
+                         G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE_RANGE,
+                                                gtk_paned_accessible_range_init)
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
                                                 gtk_paned_buildable_iface_init))
 
@@ -804,6 +809,26 @@ gtk_paned_buildable_iface_init (GtkBuildableIface *iface)
   iface->add_child = gtk_paned_buildable_add_child;
 }
 
+static double
+gtk_paned_accessible_range_get_minimum_increment (GtkAccessibleRange *accessible_range)
+{
+  return 1.0;
+}
+
+static void
+gtk_paned_accessible_range_set_current_value (GtkAccessibleRange *accessible_range, double value)
+{
+  GtkPaned *paned = GTK_PANED (accessible_range);
+  gtk_paned_set_position (paned, (int) value + 0.5);
+}
+
+static void
+gtk_paned_accessible_range_init (GtkAccessibleRangeInterface *iface)
+{
+  iface->get_minimum_increment = gtk_paned_accessible_range_get_minimum_increment;
+  iface->set_current_value = gtk_paned_accessible_range_set_current_value;
+}
+
 static gboolean
 initiates_touch_drag (GtkPaned *paned,
                       double    start_x,


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