[gtk/ebassi/a11y/accessible-range: 8/14] Implement GtkAccessibleRange for GtkScaleButton




commit 76a5354ad7d9d39f74633b620500122c4d775447
Author: Lukáš Tyrychtr <lukastyrychtr gmail com>
Date:   Fri Sep 16 10:21:32 2022 +0200

    Implement GtkAccessibleRange for GtkScaleButton

 gtk/gtkscalebutton.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 67d919c657..b97af7c4e8 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -36,6 +36,7 @@
 
 #include "gtkscalebutton.h"
 
+#include "gtkaccessiblerange.h"
 #include "gtkadjustment.h"
 #include "gtkbox.h"
 #include "gtkbuttonprivate.h"
@@ -158,13 +159,38 @@ static gboolean gtk_scale_button_scroll_controller_scroll (GtkEventControllerScr
                                                            double                    dx,
                                                            double                    dy,
                                                            GtkScaleButton           *button);
+static void gtk_scale_button_accessible_range_init(GtkAccessibleRangeInterface *iface);
+
 
 G_DEFINE_TYPE_WITH_CODE (GtkScaleButton, gtk_scale_button, GTK_TYPE_WIDGET,
                          G_ADD_PRIVATE (GtkScaleButton)
+                         G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE_RANGE,
+                                                gtk_scale_button_accessible_range_init)
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
 
 static guint signals[LAST_SIGNAL] = { 0, };
 
+static double
+gtk_scale_button_accessible_range_get_minimum_increment(GtkAccessibleRange *accessible_range)
+{
+  GtkScaleButton *button = GTK_SCALE_BUTTON (accessible_range);
+  return gtk_adjustment_get_minimum_increment (gtk_scale_button_get_adjustment (button));
+}
+
+static void
+gtk_scale_button_accessible_range_set_current_value (GtkAccessibleRange *accessible_range, double value)
+{
+  GtkScaleButton *button = GTK_SCALE_BUTTON (accessible_range);
+  gtk_scale_button_set_value (button, value);
+}
+
+static void
+gtk_scale_button_accessible_range_init(GtkAccessibleRangeInterface *iface)
+{
+  iface->get_minimum_increment = gtk_scale_button_accessible_range_get_minimum_increment;
+  iface->set_current_value = gtk_scale_button_accessible_range_set_current_value;
+}
+
 static void
 gtk_scale_button_class_init (GtkScaleButtonClass *klass)
 {


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