forked from AuroraMiddleware/gtk
Merge branch 'accessible_range_interface' into 'main'
Introduce GtkAccessibleRange See merge request GNOME/gtk!5066
This commit is contained in:
commit
d4dd0dcd79
@ -1,14 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<node name="/node">
|
||||
<interface name="org.a11y.atspi.Value">
|
||||
|
||||
<property name="MinimumValue" type="d" access="read"/>
|
||||
|
||||
<property name="MaximumValue" type="d" access="read"/>
|
||||
|
||||
<property name="MinimumIncrement" type="d" access="read"/>
|
||||
|
||||
<property name="CurrentValue" type="d" access="readwrite"/>
|
||||
|
||||
</interface>
|
||||
<interface name="org.a11y.atspi.Value">
|
||||
<property name="MinimumValue" type="d" access="read"/>
|
||||
<property name="MaximumValue" type="d" access="read"/>
|
||||
<property name="MinimumIncrement" type="d" access="read"/>
|
||||
<property name="CurrentValue" type="d" access="readwrite"/>
|
||||
<property name="Text" type="s" access="read"/>
|
||||
</interface>
|
||||
</node>
|
||||
|
@ -24,14 +24,9 @@
|
||||
|
||||
#include "a11y/atspi/atspi-value.h"
|
||||
|
||||
#include "gtkaccessiblerangeprivate.h"
|
||||
#include "gtkatcontextprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtklevelbar.h"
|
||||
#include "gtkpaned.h"
|
||||
#include "gtkprogressbar.h"
|
||||
#include "gtkrange.h"
|
||||
#include "gtkscalebutton.h"
|
||||
#include "gtkspinbutton.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
@ -45,31 +40,58 @@ handle_value_get_property (GDBusConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkATContext *ctx = GTK_AT_CONTEXT (user_data);
|
||||
|
||||
/* Numeric attributes */
|
||||
struct {
|
||||
const char *name;
|
||||
GtkAccessibleProperty property;
|
||||
} properties[] = {
|
||||
} num_properties[] = {
|
||||
{ "MinimumValue", GTK_ACCESSIBLE_PROPERTY_VALUE_MIN },
|
||||
{ "MaximumValue", GTK_ACCESSIBLE_PROPERTY_VALUE_MAX },
|
||||
{ "CurrentValue", GTK_ACCESSIBLE_PROPERTY_VALUE_NOW },
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (properties); i++)
|
||||
/* String attributes */
|
||||
struct {
|
||||
const char *name;
|
||||
GtkAccessibleProperty property;
|
||||
} str_properties[] = {
|
||||
{ "Text", GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT },
|
||||
};
|
||||
|
||||
for (int i = 0; i < G_N_ELEMENTS (num_properties); i++)
|
||||
{
|
||||
if (g_strcmp0 (property_name, properties[i].name) == 0)
|
||||
if (g_strcmp0 (property_name, num_properties[i].name) == 0)
|
||||
{
|
||||
if (gtk_at_context_has_accessible_property (ctx, properties[i].property))
|
||||
if (gtk_at_context_has_accessible_property (ctx, num_properties[i].property))
|
||||
{
|
||||
GtkAccessibleValue *value;
|
||||
GtkAccessibleValue *value =
|
||||
gtk_at_context_get_accessible_property (ctx, num_properties[i].property);
|
||||
|
||||
value = gtk_at_context_get_accessible_property (ctx, properties[i].property);
|
||||
return g_variant_new_double (gtk_number_accessible_value_get (value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* fall back for a) MinimumIncrement b) widgets that should have the
|
||||
for (int i = 0; i < G_N_ELEMENTS (str_properties); i++)
|
||||
{
|
||||
if (g_strcmp0 (property_name, str_properties[i].name) == 0)
|
||||
{
|
||||
if (gtk_at_context_has_accessible_property (ctx, str_properties[i].property))
|
||||
{
|
||||
GtkAccessibleValue *value =
|
||||
gtk_at_context_get_accessible_property (ctx, str_properties[i].property);
|
||||
|
||||
return g_variant_new_string (gtk_string_accessible_value_get (value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Special-case MinimumIncrement as it does not have an ARIA counterpart */
|
||||
if (g_strcmp0 (property_name, "MinimumIncrement") == 0)
|
||||
return g_variant_new_double (0.0);
|
||||
|
||||
/* fall back for widgets that should have the
|
||||
* properties but don't
|
||||
*/
|
||||
return g_variant_new_double (0.0);
|
||||
@ -86,23 +108,10 @@ handle_value_set_property (GDBusConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkATContext *self = user_data;
|
||||
GtkWidget *widget = GTK_WIDGET (gtk_at_context_get_accessible (self));
|
||||
GtkAccessibleRange *range = GTK_ACCESSIBLE_RANGE (gtk_at_context_get_accessible (self));
|
||||
|
||||
if (g_strcmp0 (property_name, "CurrentValue") == 0)
|
||||
{
|
||||
/* we only allow setting values if that is part of the user-exposed
|
||||
* functionality of the widget.
|
||||
*/
|
||||
if (GTK_IS_RANGE (widget))
|
||||
gtk_range_set_value (GTK_RANGE (widget), g_variant_get_double (value));
|
||||
else if (GTK_IS_PANED (widget))
|
||||
gtk_paned_set_position (GTK_PANED (widget), (int)(g_variant_get_double (value) + 0.5));
|
||||
else if (GTK_IS_SPIN_BUTTON (widget))
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), g_variant_get_double (value));
|
||||
else if (GTK_IS_SCALE_BUTTON (widget))
|
||||
gtk_scale_button_set_value (GTK_SCALE_BUTTON (widget), g_variant_get_double (value));
|
||||
return TRUE;
|
||||
}
|
||||
return gtk_accessible_range_set_current_value (range, g_variant_get_double (value));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -116,14 +125,8 @@ static const GDBusInterfaceVTable value_vtable = {
|
||||
const GDBusInterfaceVTable *
|
||||
gtk_atspi_get_value_vtable (GtkAccessible *accessible)
|
||||
{
|
||||
if (GTK_IS_LEVEL_BAR (accessible) ||
|
||||
GTK_IS_PANED (accessible) ||
|
||||
GTK_IS_PROGRESS_BAR (accessible) ||
|
||||
GTK_IS_RANGE (accessible) ||
|
||||
GTK_IS_SCALE_BUTTON (accessible) ||
|
||||
GTK_IS_SPIN_BUTTON (accessible))
|
||||
if (GTK_IS_ACCESSIBLE_RANGE (accessible))
|
||||
return &value_vtable;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <gtk/gtkaboutdialog.h>
|
||||
#include <gtk/gtkaccelgroup.h>
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gtk/gtkaccessiblerange.h>
|
||||
#include <gtk/gtkactionable.h>
|
||||
#include <gtk/gtkactionbar.h>
|
||||
#include <gtk/gtkadjustment.h>
|
||||
|
@ -656,6 +656,33 @@ gtk_accessible_role_to_name (GtkAccessibleRole role,
|
||||
return role_names[role];
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_accessible_role_is_range_subclass:
|
||||
* @role: a `GtkAccessibleRole`
|
||||
*
|
||||
* Checks if @role is considered to be a subclass of %GTK_ACCESSIBLE_ROLE_RANGE
|
||||
* according to the WAI-ARIA specification.
|
||||
*
|
||||
* Returns: whether the @role is range-like
|
||||
*/
|
||||
gboolean
|
||||
gtk_accessible_role_is_range_subclass (GtkAccessibleRole role)
|
||||
{
|
||||
/* Same trick as in gtkatcontext.c */
|
||||
switch ((int) role)
|
||||
{
|
||||
case GTK_ACCESSIBLE_ROLE_METER:
|
||||
case GTK_ACCESSIBLE_ROLE_PROGRESS_BAR:
|
||||
case GTK_ACCESSIBLE_ROLE_SCROLLBAR:
|
||||
case GTK_ACCESSIBLE_ROLE_SLIDER:
|
||||
case GTK_ACCESSIBLE_ROLE_SPIN_BUTTON:
|
||||
return TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*<private>
|
||||
* gtk_accessible_platform_changed:
|
||||
* @self: a `GtkAccessible`
|
||||
|
@ -40,6 +40,8 @@ GtkATContext * gtk_accessible_get_at_context (GtkAccessible *self);
|
||||
const char * gtk_accessible_role_to_name (GtkAccessibleRole role,
|
||||
const char *domain);
|
||||
|
||||
gboolean gtk_accessible_role_is_range_subclass (GtkAccessibleRole role);
|
||||
|
||||
gboolean gtk_accessible_should_present (GtkAccessible *self);
|
||||
|
||||
void gtk_accessible_platform_changed (GtkAccessible *self,
|
||||
|
78
gtk/gtkaccessiblerange.c
Normal file
78
gtk/gtkaccessiblerange.c
Normal file
@ -0,0 +1,78 @@
|
||||
/* gtkaccessiblerange.c: Accessible range interface
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2022 Red Hat Inc.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
/**
|
||||
* GtkAccessibleRange:
|
||||
*
|
||||
* This interface describes ranged controls, e.g. controls which have a single
|
||||
* value within an allowed range and that can optionally be changed by the user.
|
||||
*
|
||||
* This interface is expected to be implemented by controls using the following
|
||||
* roles:
|
||||
*
|
||||
* - `GTK_ACCESSIBLE_ROLE_METER`
|
||||
* - `GTK_ACCESSIBLE_ROLE_PROGRESS_BAR`
|
||||
* - `GTK_ACCESSIBLE_ROLE_SCROLLBAR`
|
||||
* - `GTK_ACCESSIBLE_ROLE_SLIDER`
|
||||
* - `GTK_ACCESSIBLE_ROLE_SPIN_BUTTON`
|
||||
*
|
||||
* If that is not the case, a warning will be issued at run time.
|
||||
*
|
||||
* In addition to this interface, its implementors are expected to provide the
|
||||
* correct values for the following properties:
|
||||
*
|
||||
* - `GTK_ACCESSIBLE_PROPERTY_VALUE_MAX`
|
||||
* - `GTK_ACCESSIBLE_PROPERTY_VALUE_MIN`
|
||||
* - `GTK_ACCESSIBLE_PROPERTY_VALUE_NOW`
|
||||
* - `GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT`
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkaccessiblerangeprivate.h"
|
||||
|
||||
#include "gtkaccessibleprivate.h"
|
||||
#include "gtkatcontextprivate.h"
|
||||
#include "gtkaccessiblevalueprivate.h"
|
||||
|
||||
G_DEFINE_INTERFACE (GtkAccessibleRange, gtk_accessible_range, GTK_TYPE_ACCESSIBLE)
|
||||
|
||||
static gboolean
|
||||
gtk_accessible_range_default_set_current_value (GtkAccessibleRange *accessible_range,
|
||||
double value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_accessible_range_default_init (GtkAccessibleRangeInterface *iface)
|
||||
{
|
||||
iface->set_current_value = gtk_accessible_range_default_set_current_value;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_accessible_range_set_current_value:
|
||||
* @self: a `GtkAccessibleRange`
|
||||
*
|
||||
* Sets the current value of this `GtkAccessibleRange` to the given value
|
||||
*
|
||||
* Note that for some widgets implementing this interface, setting a value
|
||||
* through the accessibility API makes no sense, so calling this function
|
||||
* may in some cases do nothing
|
||||
*
|
||||
* Returns: true if the call changed the value, and false otherwise
|
||||
*/
|
||||
gboolean
|
||||
gtk_accessible_range_set_current_value (GtkAccessibleRange *self, double value)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ACCESSIBLE_RANGE (self), FALSE);
|
||||
|
||||
GtkAccessibleRangeInterface *iface = GTK_ACCESSIBLE_RANGE_GET_IFACE (self);
|
||||
|
||||
return iface->set_current_value (self, value);
|
||||
}
|
43
gtk/gtkaccessiblerange.h
Normal file
43
gtk/gtkaccessiblerange.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* gtkaccessiblerange.h: Accessible range interface
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2022 Red Hat Inc.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define GTK_TYPE_ACCESSIBLE_RANGE (gtk_accessible_range_get_type())
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
G_DECLARE_INTERFACE (GtkAccessibleRange, gtk_accessible_range, GTK, ACCESSIBLE_RANGE, GtkAccessible)
|
||||
|
||||
struct _GtkAccessibleRangeInterface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/**
|
||||
* GtkAccessibleRangeInterface::set_current_value:
|
||||
* @self: a `GtkAccessibleRange`
|
||||
* @value: the value to set
|
||||
*
|
||||
* Sets the current value of the accessible range.
|
||||
*
|
||||
* This operation should behave similarly as if the user performed the
|
||||
* action.
|
||||
*
|
||||
* Returns: true if the operation was performed, false otherwise
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
gboolean (* set_current_value) (GtkAccessibleRange *self,
|
||||
double value);
|
||||
};
|
||||
|
||||
G_END_DECLS
|
18
gtk/gtkaccessiblerangeprivate.h
Normal file
18
gtk/gtkaccessiblerangeprivate.h
Normal file
@ -0,0 +1,18 @@
|
||||
/* gtkaccessiblerangeprivate.h: Accessible range private API
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2022 Emmanuele Bassi
|
||||
* SPDX-FileCopyrightText: 2022 Red Hat Inc
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtkaccessiblerange.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean
|
||||
gtk_accessible_range_set_current_value (GtkAccessibleRange *self,
|
||||
double value);
|
||||
|
||||
G_END_DECLS
|
@ -121,6 +121,7 @@
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkaccessiblerange.h"
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkbuilderprivate.h"
|
||||
@ -195,6 +196,7 @@ static void gtk_level_bar_buildable_init (GtkBuildableIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkLevelBar, gtk_level_bar, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE_RANGE, NULL)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
gtk_level_bar_buildable_init))
|
||||
|
||||
|
@ -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,20 @@ gtk_paned_buildable_iface_init (GtkBuildableIface *iface)
|
||||
iface->add_child = gtk_paned_buildable_add_child;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
accessible_range_set_current_value (GtkAccessibleRange *accessible_range,
|
||||
double value)
|
||||
{
|
||||
gtk_paned_set_position (GTK_PANED (accessible_range), (int) value + 0.5);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_range_init (GtkAccessibleRangeInterface *iface)
|
||||
{
|
||||
iface->set_current_value = accessible_range_set_current_value;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
initiates_touch_drag (GtkPaned *paned,
|
||||
double start_x,
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "gtkprogressbar.h"
|
||||
|
||||
#include "gtkaccessiblerange.h"
|
||||
#include "gtkboxlayout.h"
|
||||
#include "gtkgizmoprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
@ -158,7 +159,8 @@ static void gtk_progress_bar_direction_changed (GtkWidget *widget,
|
||||
GtkTextDirection previous_dir);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkProgressBar, gtk_progress_bar, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE_RANGE, NULL))
|
||||
|
||||
static void
|
||||
gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "gtkrangeprivate.h"
|
||||
|
||||
#include "gtkaccessible.h"
|
||||
#include "gtkaccessiblerange.h"
|
||||
#include "gtkadjustmentprivate.h"
|
||||
#include "gtkcolorscaleprivate.h"
|
||||
#include "gtkcssboxesprivate.h"
|
||||
@ -246,8 +247,12 @@ static gboolean gtk_range_scroll_controller_scroll (GtkEventControllerScrol
|
||||
static void gtk_range_set_orientation (GtkRange *range,
|
||||
GtkOrientation orientation);
|
||||
|
||||
static void gtk_range_accessible_range_init (GtkAccessibleRangeInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkRange, gtk_range, GTK_TYPE_WIDGET,
|
||||
G_ADD_PRIVATE (GtkRange)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE_RANGE,
|
||||
gtk_range_accessible_range_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
|
||||
NULL))
|
||||
|
||||
@ -435,6 +440,21 @@ gtk_range_class_init (GtkRangeClass *class)
|
||||
gtk_widget_class_set_css_name (widget_class, I_("range"));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
accessible_range_set_current_value (GtkAccessibleRange *accessible_range,
|
||||
double value)
|
||||
{
|
||||
gtk_range_set_value (GTK_RANGE (accessible_range), value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_range_init (GtkAccessibleRangeInterface *iface)
|
||||
{
|
||||
iface->set_current_value = accessible_range_set_current_value;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "gtkscalebutton.h"
|
||||
|
||||
#include "gtkaccessiblerange.h"
|
||||
#include "gtkadjustment.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkbuttonprivate.h"
|
||||
@ -159,12 +160,32 @@ static gboolean gtk_scale_button_scroll_controller_scroll (GtkEventControllerScr
|
||||
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 gboolean
|
||||
accessible_range_set_current_value (GtkAccessibleRange *accessible_range,
|
||||
double value)
|
||||
{
|
||||
gtk_scale_button_set_value (GTK_SCALE_BUTTON (accessible_range), value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_range_init (GtkAccessibleRangeInterface *iface)
|
||||
{
|
||||
iface->set_current_value = accessible_range_set_current_value;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_class_init (GtkScaleButtonClass *klass)
|
||||
{
|
||||
|
@ -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,20 @@ gtk_spin_button_accessible_init (GtkAccessibleInterface *iface)
|
||||
iface->get_platform_state = gtk_spin_button_accessible_get_platform_state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
accessible_range_set_current_value (GtkAccessibleRange *accessible_range,
|
||||
double value)
|
||||
{
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (accessible_range), value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_spin_button_accessible_range_init (GtkAccessibleRangeInterface *iface)
|
||||
{
|
||||
iface->set_current_value = accessible_range_set_current_value;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_editable_spin_button_activated (GtkText *text, GtkSpinButton *spin)
|
||||
{
|
||||
|
@ -156,6 +156,7 @@ gtk_public_sources = files([
|
||||
'gtkaboutdialog.c',
|
||||
'gtkaccelgroup.c',
|
||||
'gtkaccessible.c',
|
||||
'gtkaccessiblerange.c',
|
||||
'gtkactionable.c',
|
||||
'gtkactionbar.c',
|
||||
'gtkadjustment.c',
|
||||
@ -443,6 +444,7 @@ gtk_public_headers = files([
|
||||
'gtkaboutdialog.h',
|
||||
'gtkaccelgroup.h',
|
||||
'gtkaccessible.h',
|
||||
'gtkaccessiblerange.h',
|
||||
'gtkactionable.h',
|
||||
'gtkactionbar.h',
|
||||
'gtkadjustment.h',
|
||||
|
Loading…
Reference in New Issue
Block a user