[java-atk-wrapper] Create JawTableCellIface and AtkTableCell
- From: Magdalen Berns <mberns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper] Create JawTableCellIface and AtkTableCell
- Date: Wed, 17 Jun 2015 15:02:13 +0000 (UTC)
commit 75a675c56f0a7ac19b785876a4432f91ca86ccbc
Author: Magdalen Berns <m berns thismagpie com>
Date: Wed Jun 17 15:58:48 2015 +0100
Create JawTableCellIface and AtkTableCell
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=751111
jni/src/Makefile.am | 1 +
jni/src/jawimpl.c | 24 +++++
jni/src/jawtablecell.c | 100 +++++++++++++++++++++
jni/src/jawutil.c | 10 ++
jni/src/jawutil.h | 7 +-
wrapper/org/GNOME/Accessibility/AtkTableCell.java | 39 ++++++++
6 files changed, 178 insertions(+), 3 deletions(-)
---
diff --git a/jni/src/Makefile.am b/jni/src/Makefile.am
index 91c7b0d..b4f0902 100644
--- a/jni/src/Makefile.am
+++ b/jni/src/Makefile.am
@@ -15,6 +15,7 @@ libatk_wrapper_la_SOURCES = AtkWrapper.c \
jawselection.c \
jawvalue.c \
jawtable.c \
+ jawtablecell.c \
jawwindow.c
noinst_HEADERS = jawimpl.h \
diff --git a/jni/src/jawimpl.c b/jni/src/jawimpl.c
index 76090b1..2cc8ed6 100644
--- a/jni/src/jawimpl.c
+++ b/jni/src/jawimpl.c
@@ -79,6 +79,10 @@ extern void jaw_table_interface_init (AtkTableIface*);
extern gpointer jaw_table_data_init (jobject);
extern void jaw_table_data_finalize (gpointer);
+extern void jaw_table_cell_interface_init (AtkTableCellIface*);
+extern gpointer jaw_table_cell_data_init (jobject);
+extern void jaw_table_cell_data_finalize (gpointer);
+
extern void jaw_window_interface_init (AtkWindowIface*);
extern gpointer jaw_window_data_init (jobject);
extern void jaw_window_data_finalize (gpointer);
@@ -237,6 +241,16 @@ aggregate_interface(JNIEnv *jniEnv, JawObject *jaw_obj, guint tflag)
(gpointer)info);
}
+ if (tflag & INTERFACE_TABLE_CELL)
+ {
+ JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1);
+ info->data = jaw_table_cell_data_init(ac);
+ info->finalize = jaw_table_cell_data_finalize;
+ g_hash_table_insert(jaw_impl->ifaceTable,
+ (gpointer)INTERFACE_TABLE_CELL,
+ (gpointer)info);
+ }
+
if (tflag & INTERFACE_WINDOW)
{
JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1);
@@ -396,6 +410,13 @@ jaw_impl_get_type (guint tflag)
NULL
};
+ static const GInterfaceInfo atk_table_cell_info =
+ {
+ (GInterfaceInitFunc) jaw_table_cell_interface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
static const GInterfaceInfo atk_window_info =
{
(GInterfaceInitFunc) jaw_window_interface_init,
@@ -454,6 +475,9 @@ jaw_impl_get_type (guint tflag)
if (tflag & INTERFACE_TABLE)
g_type_add_interface_static (type, ATK_TYPE_TABLE, &atk_table_info);
+ if (tflag & INTERFACE_TABLE_CELL)
+ g_type_add_interface_static (type, ATK_TYPE_TABLE_CELL, &atk_table_cell_info);
+
if (tflag & INTERFACE_WINDOW)
g_type_add_interface_static (type, ATK_TYPE_WINDOW, &atk_window_info);
diff --git a/jni/src/jawtablecell.c b/jni/src/jawtablecell.c
new file mode 100644
index 0000000..f9b989e
--- /dev/null
+++ b/jni/src/jawtablecell.c
@@ -0,0 +1,100 @@
+/*
+ * Java ATK Wrapper for GNOME
+ * Copyright (C) 2015 Magdalen Berns <m berns thismagpie com>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <atk/atk.h>
+#include <glib.h>
+#include "jawimpl.h"
+#include "jawutil.h"
+
+extern void jaw_table_cell_interface_init (AtkTableCellIface*);
+extern gpointer jaw_table_cell_data_init (jobject ac);
+extern void jaw_table_cell_data_finalize (gpointer);
+
+static AtkObject *jaw_table_cell_get_table (AtkTableCell *cell);
+
+typedef struct _TableCellData {
+ jobject atk_table_cell;
+ gchar* description;
+ jstring jstrDescription;
+} TableCellData;
+
+void
+jaw_table_cell_interface_init (AtkTableCellIface *iface)
+{
+ iface->get_table = jaw_table_cell_get_table;
+}
+
+gpointer
+jaw_table_cell_data_init (jobject ac)
+{
+ TableCellData *data = g_new0(TableCellData, 1);
+
+ JNIEnv *jniEnv = jaw_util_get_jni_env();
+ jclass classTableCell = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTableCell");
+ jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classTableCell, "<init>",
"(Ljavax/accessibility/AccessibleContext;)V");
+ jobject jatk_table_cell = (*jniEnv)->NewObject(jniEnv, classTableCell, jmid, ac);
+ data->atk_table_cell = (*jniEnv)->NewGlobalRef(jniEnv, jatk_table_cell);
+
+ return data;
+}
+
+void
+jaw_table_cell_data_finalize (gpointer p)
+{
+ TableCellData *data = (TableCellData*)p;
+ JNIEnv *jniEnv = jaw_util_get_jni_env();
+
+ if (data && data->atk_table_cell)
+ {
+ if (data->description != NULL)
+ {
+ (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrDescription, data->description);
+ (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrDescription);
+ data->jstrDescription = NULL;
+ data->description = NULL;
+ }
+
+ (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_table_cell);
+ data->atk_table_cell = NULL;
+ }
+}
+
+static AtkObject*
+jaw_table_cell_get_table(AtkTableCell *cell)
+{
+ JawObject *jaw_obj = JAW_OBJECT(cell);
+ TableCellData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE_CELL);
+ jobject jatk_table_cell = data->atk_table_cell;
+
+ JNIEnv *jniEnv = jaw_util_get_jni_env();
+ jclass classAtkTableCell = (*jniEnv)->FindClass(jniEnv,
+ "org/GNOME/Accessibility/AtkTableCell");
+ jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
+ classAtkTableCell,
+ "getTableCell",
+ "(II)Ljavax/accessibility/AccessibleContext;");
+ jobject jac = (*jniEnv)->CallObjectMethod(jniEnv, jatk_table_cell, jmid);
+
+ if (!jac)
+ return NULL;
+
+ JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, jac);
+
+ return ATK_OBJECT(jaw_impl);
+}
diff --git a/jni/src/jawutil.c b/jni/src/jawutil.c
index 0ea36b1..d148267 100644
--- a/jni/src/jawutil.c
+++ b/jni/src/jawutil.c
@@ -415,6 +415,16 @@ jaw_util_get_tflag_from_jobj(JNIEnv *jniEnv, jobject jObj)
jmid = (*jniEnv)->GetMethodID(jniEnv,
classAccessibleContext,
+ "getAccessibleTable",
+ "()Ljavax/accessibility/AccessibleTableModelChange;");
+ iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid);
+ if (iface != NULL)
+ {
+ tflag |= INTERFACE_TABLE_CELL;
+ }
+
+ jmid = (*jniEnv)->GetMethodID(jniEnv,
+ classAccessibleContext,
"getAccessibleValue",
"()Ljavax/accessibility/AccessibleValue;");
iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid);
diff --git a/jni/src/jawutil.h b/jni/src/jawutil.h
index 7266c6a..3095383 100644
--- a/jni/src/jawutil.h
+++ b/jni/src/jawutil.h
@@ -35,9 +35,10 @@ G_BEGIN_DECLS
#define INTERFACE_SELECTION 0x00000080
#define INTERFACE_STREAMABLE_CONTENT 0x00000100
#define INTERFACE_TABLE 0x00000200
-#define INTERFACE_TEXT 0x00000400
-#define INTERFACE_VALUE 0x00000800
-#define INTERFACE_WINDOW 0x00001000
+#define INTERFACE_TABLE_CELL 0x00000400
+#define INTERFACE_TEXT 0x00000800
+#define INTERFACE_VALUE 0x00001000
+#define INTERFACE_WINDOW 0x00002000
#define JAW_TYPE_UTIL (jaw_util_get_type())
#define JAW_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JAW_TYPE_UTIL, JawUtil))
diff --git a/wrapper/org/GNOME/Accessibility/AtkTableCell.java
b/wrapper/org/GNOME/Accessibility/AtkTableCell.java
new file mode 100644
index 0000000..9d6cad7
--- /dev/null
+++ b/wrapper/org/GNOME/Accessibility/AtkTableCell.java
@@ -0,0 +1,39 @@
+/*
+ * Java ATK Wrapper for GNOME
+ * Copyright (C) 2015 Magdalen Berns <m berns thismagpie com>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.GNOME.Accessibility;
+
+import javax.accessibility.*;
+
+public class AtkTableCell {
+
+ AccessibleContext ac;
+ AccessibleTable acc_table_cell;
+
+ public AtkTableCell(AccessibleContext ac) {
+ super();
+ this.ac = ac;
+ this.acc_table_cell = ac.getAccessibleTable();
+ }
+
+ public AccessibleTable getTable() {
+ return acc_table_cell;
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]