[gtk/ebassi/new-a11y: 3/14] Introduce GtkAccessible
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/new-a11y: 3/14] Introduce GtkAccessible
- Date: Mon, 13 Jul 2020 14:54:48 +0000 (UTC)
commit 546de93d7c6446cf042b0a1f2ab7a975d29f5ca8
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Jun 16 17:40:14 2020 +0100
Introduce GtkAccessible
GtkAccessible is an interface for accessible UI elements.
Currently, it doesn't do much except exist as a type; in the future, it
will be the entry point for all accessible state in GTK.
gtk/gtk.h | 1 +
gtk/gtkaccessible.c | 30 ++++++++++++++++++++++++++++++
gtk/gtkaccessible.h | 39 +++++++++++++++++++++++++++++++++++++++
gtk/gtkwidget.c | 24 ++++++++++++++++++++++--
gtk/meson.build | 2 ++
5 files changed, 94 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtk.h b/gtk/gtk.h
index c401443118..50c23caf26 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -34,6 +34,7 @@
#include <gtk/gtkaboutdialog.h>
#include <gtk/gtkaccelgroup.h>
#include <gtk/gtkaccellabel.h>
+#include <gtk/gtkaccessible.h>
#include <gtk/gtkactionable.h>
#include <gtk/gtkactionbar.h>
#include <gtk/gtkadjustment.h>
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 <http://www.gnu.org/licenses/>.
+ */
+
+#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 <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+#include <gtk/gtktypes.h>
+#include <gtk/gtkenums.h>
+
+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 e3da5273b9..00c7b8144b 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -27,6 +27,7 @@
#include "gtkwidgetprivate.h"
#include "gtkaccelgroupprivate.h"
+#include "gtkaccessible.h"
#include "gtkapplicationprivate.h"
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
@@ -598,6 +599,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 gchar *name);
@@ -679,6 +682,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,
@@ -701,10 +711,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;
@@ -8046,6 +8058,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 e427d2b41f..9fadea55e0 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -147,6 +147,7 @@ gtk_public_sources = files([
'gtkaboutdialog.c',
'gtkaccelgroup.c',
'gtkaccellabel.c',
+ 'gtkaccessible.c',
'gtkactionable.c',
'gtkactionbar.c',
'gtkadjustment.c',
@@ -433,6 +434,7 @@ gtk_public_headers = files([
'gtkaboutdialog.h',
'gtkaccelgroup.h',
'gtkaccellabel.h',
+ 'gtkaccessible.h',
'gtkactionable.h',
'gtkactionbar.h',
'gtkadjustment.h',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]