diff --git a/gtk/gtk.h b/gtk/gtk.h index bc689f2e2b..2277e1136d 100644 --- a/gtk/gtk.h +++ b/gtk/gtk.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c new file mode 100644 index 0000000000..d8187b60c0 --- /dev/null +++ b/gtk/gtkaccessible.c @@ -0,0 +1,30 @@ +/* gtkaccessible.c: Accessible interface + * + * Copyright 2020 GNOME Foundation + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "config.h" + +#include "gtkaccessible.h" + +G_DEFINE_INTERFACE (GtkAccessible, gtk_accessible, G_TYPE_OBJECT) + +static void +gtk_accessible_default_init (GtkAccessibleInterface *iface) +{ +} diff --git a/gtk/gtkaccessible.h b/gtk/gtkaccessible.h new file mode 100644 index 0000000000..d54d21a2d0 --- /dev/null +++ b/gtk/gtkaccessible.h @@ -0,0 +1,39 @@ +/* gtkaccessible.h: Accessible interface + * + * Copyright 2020 GNOME Foundation + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#pragma once + +#include +#include +#include + +G_BEGIN_DECLS + +#define GTK_TYPE_ACCESSIBLE (gtk_accessible_get_type()) + +GDK_AVAILABLE_IN_ALL +G_DECLARE_INTERFACE (GtkAccessible, gtk_accessible, GTK, ACCESSIBLE, GObject) + +struct _GtkAccessibleInterface +{ + GTypeInterface g_iface; +}; + +G_END_DECLS diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 56104548f2..9013ad6661 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -27,6 +27,7 @@ #include "gtkwidgetprivate.h" #include "gtkaccelgroupprivate.h" +#include "gtkaccessible.h" #include "gtkactionobserverprivate.h" #include "gtkapplicationprivate.h" #include "gtkbuildable.h" @@ -599,6 +600,8 @@ static void gtk_widget_real_measure (GtkWidget static void gtk_widget_real_state_flags_changed (GtkWidget *widget, GtkStateFlags old_state); +static void gtk_widget_accessible_interface_init (GtkAccessibleInterface *iface); + static void gtk_widget_buildable_interface_init (GtkBuildableIface *iface); static void gtk_widget_buildable_set_name (GtkBuildable *buildable, const char *name); @@ -680,6 +683,13 @@ gtk_widget_get_type (void) NULL, /* value_table */ }; + const GInterfaceInfo accessible_info = + { + (GInterfaceInitFunc) gtk_widget_accessible_interface_init, + (GInterfaceFinalizeFunc) NULL, + NULL, + }; + const GInterfaceInfo buildable_info = { (GInterfaceInitFunc) gtk_widget_buildable_interface_init, @@ -702,10 +712,12 @@ gtk_widget_get_type (void) GtkWidget_private_offset = g_type_add_instance_private (widget_type, sizeof (GtkWidgetPrivate)); + g_type_add_interface_static (widget_type, GTK_TYPE_ACCESSIBLE, + &accessible_info); g_type_add_interface_static (widget_type, GTK_TYPE_BUILDABLE, - &buildable_info) ; + &buildable_info); g_type_add_interface_static (widget_type, GTK_TYPE_CONSTRAINT_TARGET, - &constraint_target_info) ; + &constraint_target_info); } return widget_type; @@ -8038,6 +8050,14 @@ gtk_widget_set_vexpand_set (GtkWidget *widget, gtk_widget_set_expand_set (widget, GTK_ORIENTATION_VERTICAL, set); } +/* + * GtkAccessible implementation + */ +static void +gtk_widget_accessible_interface_init (GtkAccessibleInterface *iface) +{ +} + /* * GtkBuildable implementation */ diff --git a/gtk/meson.build b/gtk/meson.build index 4ad1796e62..db3f8c178f 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -149,6 +149,7 @@ gtk_public_sources = files([ 'gtkaboutdialog.c', 'gtkaccelgroup.c', 'gtkaccellabel.c', + 'gtkaccessible.c', 'gtkactionable.c', 'gtkactionbar.c', 'gtkadjustment.c', @@ -436,6 +437,7 @@ gtk_public_headers = files([ 'gtkaboutdialog.h', 'gtkaccelgroup.h', 'gtkaccellabel.h', + 'gtkaccessible.h', 'gtkactionable.h', 'gtkactionbar.h', 'gtkadjustment.h',