forked from AuroraMiddleware/gtk
Merge branch 'a11y/editable' into 'master'
Improve the accessible support for editables See merge request GNOME/gtk!2719
This commit is contained in:
commit
e58e6a0fbe
@ -116,6 +116,7 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
gtk_widget_class_set_css_name (widget_class, "entry");
|
||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_TEXT_BOX);
|
||||
}
|
||||
|
||||
static GtkEditable *
|
||||
|
@ -971,6 +971,7 @@ gtk_editable_get_enable_undo
|
||||
gtk_editable_set_enable_undo
|
||||
<SUBSECTION>
|
||||
gtk_editable_install_properties
|
||||
gtk_editable_get_delegate
|
||||
gtk_editable_init_delegate
|
||||
gtk_editable_finish_delegate
|
||||
gtk_editable_delegate_set_property
|
||||
|
@ -59,14 +59,14 @@ text_received (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
entry_handle_method (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *method_name,
|
||||
GVariant *parameters,
|
||||
GDBusMethodInvocation *invocation,
|
||||
gpointer user_data)
|
||||
editable_handle_method (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *method_name,
|
||||
GVariant *parameters,
|
||||
GDBusMethodInvocation *invocation,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkATContext *self = user_data;
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
||||
@ -175,8 +175,8 @@ entry_handle_method (GDBusConnection *connection,
|
||||
}
|
||||
}
|
||||
|
||||
static const GDBusInterfaceVTable entry_vtable = {
|
||||
entry_handle_method,
|
||||
static const GDBusInterfaceVTable editable_vtable = {
|
||||
editable_handle_method,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -348,11 +348,8 @@ static const GDBusInterfaceVTable text_view_vtable = {
|
||||
const GDBusInterfaceVTable *
|
||||
gtk_atspi_get_editable_text_vtable (GtkAccessible *accessible)
|
||||
{
|
||||
if (GTK_IS_ENTRY (accessible) ||
|
||||
GTK_IS_SEARCH_ENTRY (accessible) ||
|
||||
GTK_IS_PASSWORD_ENTRY (accessible) ||
|
||||
GTK_IS_SPIN_BUTTON (accessible))
|
||||
return &entry_vtable;
|
||||
if (GTK_IS_EDITABLE (accessible))
|
||||
return &editable_vtable;
|
||||
else if (GTK_IS_TEXT_VIEW (accessible))
|
||||
return &text_view_vtable;
|
||||
|
||||
|
@ -412,27 +412,28 @@ static const GDBusInterfaceVTable label_vtable = {
|
||||
static GtkText *
|
||||
gtk_editable_get_text_widget (GtkWidget *widget)
|
||||
{
|
||||
if (GTK_IS_ENTRY (widget))
|
||||
return gtk_entry_get_text_widget (GTK_ENTRY (widget));
|
||||
else if (GTK_IS_SEARCH_ENTRY (widget))
|
||||
return gtk_search_entry_get_text_widget (GTK_SEARCH_ENTRY (widget));
|
||||
else if (GTK_IS_PASSWORD_ENTRY (widget))
|
||||
return gtk_password_entry_get_text_widget (GTK_PASSWORD_ENTRY (widget));
|
||||
else if (GTK_IS_SPIN_BUTTON (widget))
|
||||
return gtk_spin_button_get_text_widget (GTK_SPIN_BUTTON (widget));
|
||||
if (GTK_IS_EDITABLE (widget))
|
||||
{
|
||||
GtkEditable *delegate;
|
||||
|
||||
delegate = gtk_editable_get_delegate (GTK_EDITABLE (widget));
|
||||
|
||||
if (GTK_IS_TEXT (delegate))
|
||||
return GTK_TEXT (delegate);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
entry_handle_method (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *method_name,
|
||||
GVariant *parameters,
|
||||
GDBusMethodInvocation *invocation,
|
||||
gpointer user_data)
|
||||
editable_handle_method (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *method_name,
|
||||
GVariant *parameters,
|
||||
GDBusMethodInvocation *invocation,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkATContext *self = user_data;
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
||||
@ -742,13 +743,13 @@ entry_handle_method (GDBusConnection *connection,
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
entry_get_property (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *property_name,
|
||||
GError **error,
|
||||
gpointer user_data)
|
||||
editable_get_property (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *property_name,
|
||||
GError **error,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkATContext *self = user_data;
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
||||
@ -776,9 +777,9 @@ entry_get_property (GDBusConnection *connection,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const GDBusInterfaceVTable entry_vtable = {
|
||||
entry_handle_method,
|
||||
entry_get_property,
|
||||
static const GDBusInterfaceVTable editable_vtable = {
|
||||
editable_handle_method,
|
||||
editable_get_property,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -1169,11 +1170,9 @@ gtk_atspi_get_text_vtable (GtkAccessible *accessible)
|
||||
{
|
||||
if (GTK_IS_LABEL (accessible))
|
||||
return &label_vtable;
|
||||
else if (GTK_IS_ENTRY (accessible) ||
|
||||
GTK_IS_SEARCH_ENTRY (accessible) ||
|
||||
GTK_IS_PASSWORD_ENTRY (accessible) ||
|
||||
GTK_IS_SPIN_BUTTON (accessible))
|
||||
return &entry_vtable;
|
||||
else if (GTK_IS_EDITABLE (accessible) &&
|
||||
GTK_IS_TEXT (gtk_editable_get_delegate (GTK_EDITABLE (accessible))))
|
||||
return &editable_vtable;
|
||||
else if (GTK_IS_TEXT_VIEW (accessible))
|
||||
return &text_view_vtable;
|
||||
|
||||
|
@ -941,6 +941,21 @@ delegate_notify (GObject *object,
|
||||
g_object_notify (data, pspec->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_editable_get_delegate:
|
||||
* @editable: a #GtkEditable
|
||||
*
|
||||
* Gets the #GtkEditable that @editable is delegating its
|
||||
* implementation to. Typically, the delegate is a #GtkText widget.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the delegate #GtkEditable
|
||||
*/
|
||||
GtkEditable *
|
||||
gtk_editable_get_delegate (GtkEditable *editable)
|
||||
{
|
||||
return get_delegate (editable);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_editable_init_delegate:
|
||||
* @editable: a #GtkEditable
|
||||
|
@ -162,6 +162,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
guint gtk_editable_install_properties (GObjectClass *object_class,
|
||||
guint first_prop);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkEditable *gtk_editable_get_delegate (GtkEditable *editable);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_editable_init_delegate (GtkEditable *editable);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_editable_finish_delegate (GtkEditable *editable);
|
||||
|
Loading…
Reference in New Issue
Block a user