summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Tyrychtr <lukastyrychtr@gmail.com>2022-09-14 16:49:32 +0200
committerLukáš Tyrychtr <lukastyrychtr@gmail.com>2022-09-29 09:36:08 +0200
commit485ffcde38f91fbf9c9c8586f9000dd86d036898 (patch)
tree9696e27dfc06089432f5bdb333915691ee98c1a0
parent0304eaec94c96aeffa0ad83ce209fd1b26d4b972 (diff)
downloadgtk+-485ffcde38f91fbf9c9c8586f9000dd86d036898.tar.gz
Implement GtkAccessibleRange for GtkSpinButton
-rw-r--r--gtk/gtkspinbutton.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 8506f7aa26..f9eb4a2f45 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -32,6 +32,7 @@
#include "gtkspinbuttonprivate.h"
#include "gtkaccessibleprivate.h"
+#include "gtkaccessiblerange.h"
#include "gtkadjustment.h"
#include "gtkbox.h"
#include "gtkbutton.h"
@@ -308,6 +309,8 @@ static void gtk_spin_button_update_width_chars (GtkSpinButton *spin_button);
static void gtk_spin_button_accessible_init (GtkAccessibleInterface *iface);
+static void gtk_spin_button_accessible_range_init (GtkAccessibleRangeInterface *iface);
+
static guint spinbutton_signals[LAST_SIGNAL] = {0};
static GParamSpec *spinbutton_props[NUM_SPINBUTTON_PROPS] = {NULL, };
@@ -315,6 +318,8 @@ G_DEFINE_TYPE_WITH_CODE (GtkSpinButton, gtk_spin_button, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE,
gtk_spin_button_accessible_init)
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE_RANGE,
+ gtk_spin_button_accessible_range_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
gtk_spin_button_editable_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE,
@@ -632,6 +637,27 @@ gtk_spin_button_accessible_init (GtkAccessibleInterface *iface)
iface->get_platform_state = gtk_spin_button_accessible_get_platform_state;
}
+static double
+gtk_spin_button_accessible_range_get_minimum_increment (GtkAccessibleRange *accessible_range)
+{
+ GtkSpinButton *button = GTK_SPIN_BUTTON (accessible_range);
+ return gtk_adjustment_get_minimum_increment (gtk_spin_button_get_adjustment (button));
+}
+
+static void
+gtk_spin_button_accessible_range_set_current_value (GtkAccessibleRange *accessible_range, double value)
+{
+ GtkSpinButton *button = GTK_SPIN_BUTTON (accessible_range);
+ gtk_spin_button_set_value (button, value);
+}
+
+static void
+gtk_spin_button_accessible_range_init (GtkAccessibleRangeInterface *iface)
+{
+ iface->get_minimum_increment = gtk_spin_button_accessible_range_get_minimum_increment;
+ iface->set_current_value = gtk_spin_button_accessible_range_set_current_value;
+}
+
static void
gtk_cell_editable_spin_button_activated (GtkText *text, GtkSpinButton *spin)
{