Esempio n. 1
0
static void
jaw_value_get_current_value (AtkValue *obj, GValue *value)
{
  if (!value)
  {
    return;
  }

  JawObject *jaw_obj = JAW_OBJECT(obj);
  ValueData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_VALUE);
  jobject atk_value = data->atk_value;

  JNIEnv *jniEnv = jaw_util_get_jni_env();
  jclass classAtkValue = (*jniEnv)->FindClass(jniEnv,
                                              "org/GNOME/Accessibility/AtkValue");
  jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
                                          classAtkValue,
                                          "get_current_value",
                                          "()Ljava/lang/Number;");
  jobject jnumber = (*jniEnv)->CallObjectMethod(jniEnv,
                                                atk_value,
                                                jmid);

  if (!jnumber)
  {
    return;
  }

  get_g_value_from_java_number(jniEnv, jnumber, value);
}
Esempio n. 2
0
static gint
jaw_table_get_selected_rows (AtkTable *table, gint **selected)
{
	JawObject *jaw_obj = JAW_OBJECT(table);
	TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE);
	jobject atk_table = data->atk_table;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkTable = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTable");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTable, "get_selected_rows", "()[I");
	jintArray jrowArray = (*jniEnv)->CallObjectMethod(jniEnv, atk_table, jmid);

	if (!jrowArray) {
		return 0;
	}

	jsize length = (*jniEnv)->GetArrayLength(jniEnv, jrowArray);
	jint *jrows = (*jniEnv)->GetIntArrayElements(jniEnv, jrowArray, NULL);
	gint *rows = g_new(gint, length);

	gint i;
	for (i = 0; i < length; i++) {
		rows[i] = (gint)jrows[i];
	}

	(*jniEnv)->ReleaseIntArrayElements(jniEnv, jrowArray, jrows, JNI_ABORT);

	return (gint)length;
}
Esempio n. 3
0
static gchar*
jaw_text_get_selection (AtkText *text,
		gint selection_num,
		gint *start_offset, gint *end_offset)
{
	JawObject *jaw_obj = JAW_OBJECT(text);
	TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT);
	jobject atk_text = data->atk_text;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_selection", "()Lorg/GNOME/Accessibility/AtkText$StringSequence;");
	jobject jStrSeq = (*jniEnv)->CallObjectMethod(jniEnv, atk_text, jmid);

	if (jStrSeq == NULL) {
		return NULL;
	}
	
	jclass classStringSeq = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText$StringSequence");
	jfieldID jfidStr = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "str", "Ljava/lang/String;");
	jfieldID jfidStart = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "start_offset", "I");
	jfieldID jfidEnd = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "end_offset", "I");

	jstring jStr = (*jniEnv)->GetObjectField(jniEnv, jStrSeq, jfidStr);
	*start_offset = (gint)(*jniEnv)->GetIntField(jniEnv, jStrSeq, jfidStart);
	*end_offset = (gint)(*jniEnv)->GetIntField(jniEnv, jStrSeq, jfidEnd);
	
	return jaw_text_get_gtext_from_jstr(jniEnv, data, jStr);
}
Esempio n. 4
0
static gdouble
jaw_value_get_increment (AtkValue *obj)
{
  JawObject *jaw_obj = JAW_OBJECT(obj);
  ValueData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_VALUE);
  jobject atk_value = data->atk_value;
  JNIEnv *env = jaw_util_get_jni_env();
  jclass classAtkValue = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkValue");
  jmethodID jmid = (*env)->GetMethodID(env, classAtkValue, "getIncrement", "()D");
  return (*env)->CallDoubleMethod(env, atk_value, jmid);
}
Esempio n. 5
0
static gint
jaw_text_get_n_selections (AtkText *text)
{
	JawObject *jaw_obj = JAW_OBJECT(text);
	TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT);
	jobject atk_text = data->atk_text;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_n_selections", "()I");
	jint jselections = (*jniEnv)->CallIntMethod(jniEnv, atk_text, jmid);

	return (gint)jselections;
}
Esempio n. 6
0
static gint
jaw_table_get_row_extent_at (AtkTable *table, gint row, gint column)
{
	JawObject *jaw_obj = JAW_OBJECT(table);
	TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE);
	jobject atk_table = data->atk_table;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkTable = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTable");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTable, "get_row_extent_at", "(II)I");
	jint jextent = (*jniEnv)->CallIntMethod(jniEnv, atk_table, jmid, (jint)row, (jint)column);

	return (gint)jextent;
}
Esempio n. 7
0
static gint
jaw_table_get_n_rows (AtkTable *table)
{
	JawObject *jaw_obj = JAW_OBJECT(table);
	TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE);
	jobject atk_table = data->atk_table;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkTable = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTable");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTable, "get_n_rows", "()I");
	jint jrows = (*jniEnv)->CallIntMethod(jniEnv, atk_table, jmid);

	return (gint)jrows;
}
Esempio n. 8
0
static gunichar
jaw_text_get_character_at_offset (AtkText *text,
				gint offset)
{
	JawObject *jaw_obj = JAW_OBJECT(text);
	TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT);
	jobject atk_text = data->atk_text;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_character_at_offset", "(I)C");
	jchar jcharacter = (*jniEnv)->CallCharMethod( jniEnv, atk_text, jmid, (jint)offset );

	return (gunichar)jcharacter;
}
Esempio n. 9
0
static gchar*
jaw_text_get_text (AtkText *text,
		gint start_offset, gint end_offset)
{
	JawObject *jaw_obj = JAW_OBJECT(text);
	TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT);
	jobject atk_text = data->atk_text;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_text", "(II)Ljava/lang/String;");
	jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, atk_text, jmid, (jint)start_offset, (jint)end_offset );

	return jaw_text_get_gtext_from_jstr(jniEnv, data, jstr);
}
Esempio n. 10
0
static gint
jaw_text_get_offset_at_point (AtkText *text,
		gint x, gint y, AtkCoordType coords)
{
	JawObject *jaw_obj = JAW_OBJECT(text);
	TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT);
	jobject atk_text = data->atk_text;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_offset_at_point", "(III)I");
	jint joffset = (*jniEnv)->CallIntMethod(jniEnv, atk_text, jmid, (jint)x, (jint)y, (jint)coords);

	return (gint)joffset;
}
Esempio n. 11
0
static AtkRange*
jaw_value_get_range(AtkValue *obj)
{

  JawObject *jaw_obj = JAW_OBJECT(obj);
  ValueData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_VALUE);
  jobject atk_value = data->atk_value;

  JNIEnv *env = jaw_util_get_jni_env();
  jclass classAtkValue = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkValue");
  jmethodID jmidMin = (*env)->GetMethodID(env, classAtkValue, "getMinimumValue", "()D");
  jmethodID jmidMax = (*env)->GetMethodID(env, classAtkValue, "getMaximumValue", "()D");
  return atk_range_new((gdouble)(*env)->CallDoubleMethod(env, atk_value, jmidMin),
                       (gdouble)(*env)->CallDoubleMethod(env, atk_value, jmidMax),
                       NULL); // NULL description
}
Esempio n. 12
0
static void
jaw_value_set_value(AtkValue *obj, const gdouble value)
{
  if (!value)
    return;

  JawObject *jaw_obj = JAW_OBJECT(obj);
  ValueData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_VALUE);
  jobject atk_value = data->atk_value;

  JNIEnv *env = jaw_util_get_jni_env();
  jclass classAtkValue = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkValue");
  jmethodID jmid = (*env)->GetMethodID(env,
                                       classAtkValue,
                                          "setValue",
                                          "(Ljava/lang/Number;)V");
  (*env)->CallVoidMethod(env, atk_value, jmid,(jdouble)value);
}
Esempio n. 13
0
static gboolean
jaw_table_is_selected (AtkTable *table, gint row, gint column)
{
	JawObject *jaw_obj = JAW_OBJECT(table);
	TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE);
	jobject atk_table = data->atk_table;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkTable = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTable");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTable, "is_selected", "(II)Z");
	jboolean jselected = (*jniEnv)->CallBooleanMethod(jniEnv, atk_table, jmid, (jint)row, (jint)column);

	if (jselected == JNI_TRUE) {
		return TRUE;
	}

	return FALSE;
}
Esempio n. 14
0
static gboolean
jaw_text_set_caret_offset (AtkText *text,
			gint offset)
{
	JawObject *jaw_obj = JAW_OBJECT(text);
	TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT);
	jobject atk_text = data->atk_text;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "set_caret_offset", "(I)Z");
	jboolean jresult = (*jniEnv)->CallBooleanMethod(jniEnv, atk_text, jmid, (jint)offset);

	if (jresult == JNI_TRUE) {
		return TRUE;
	} else {
		return FALSE;
	}
}
Esempio n. 15
0
static AtkObject*
jaw_table_get_summary (AtkTable *table)
{
	JawObject *jaw_obj = JAW_OBJECT(table);
	TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE);
	jobject atk_table = data->atk_table;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkTable = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTable");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTable, "get_summary", "()Ljavax/accessibility/AccessibleContext;");
	jobject jac = (*jniEnv)->CallObjectMethod(jniEnv, atk_table, jmid);

	if (!jac) {
		return NULL;
	}

	JawImpl* jaw_impl = jaw_impl_get_instance( jniEnv, jac );

	return ATK_OBJECT(jaw_impl);
}
Esempio n. 16
0
static void
jaw_text_get_character_extents (AtkText *text,
		gint offset, gint *x, gint *y,
		gint *width, gint *height,
		AtkCoordType coords)
{
	JawObject *jaw_obj = JAW_OBJECT(text);
	TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT);
	jobject atk_text = data->atk_text;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_character_extents", "(II)Ljava/awt/Rectangle;");
	jobject jrect = (*jniEnv)->CallObjectMethod(jniEnv, atk_text, jmid, (jint)offset, (jint)coords);

	if (jrect == NULL) {
		return;
	}

	jaw_util_get_rect_info(jniEnv, jrect, x, y, width, height);
}
Esempio n. 17
0
static const gchar*
jaw_table_get_row_description (AtkTable *table, gint row)
{
	JawObject *jaw_obj = JAW_OBJECT(table);
	TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE);
	jobject atk_table = data->atk_table;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkTable = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTable");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTable, "get_row_description", "(I)Ljava/lang/String;");
	jstring jstr = (*jniEnv)->CallObjectMethod(jniEnv, atk_table, jmid, (jint)row);

	if (data->description != NULL) {
		(*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrDescription, data->description);
		(*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrDescription);
	}
	
	data->jstrDescription = (*jniEnv)->NewGlobalRef(jniEnv, jstr);
	data->description = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, data->jstrDescription, NULL);

	return data->description;
}
Esempio n. 18
0
static void
jaw_text_get_range_extents (AtkText *text,
		gint start_offset, gint end_offset,
		AtkCoordType coord_type, AtkTextRectangle *rect)
{
	if (rect == NULL) {
		return;
	}

	JawObject *jaw_obj = JAW_OBJECT(text);
	TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT);
	jobject atk_text = data->atk_text;

	JNIEnv *jniEnv = jaw_util_get_jni_env();
	jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText");
	jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_range_extents", "(III)Ljava/awt/Rectangle;");
	jobject jrect = (*jniEnv)->CallObjectMethod(jniEnv, atk_text, jmid, (jint)start_offset, (jint)end_offset, (jint)coord_type);

	if (!jrect) {
		return;
	}

	jaw_util_get_rect_info(jniEnv, jrect, &(rect->x), &(rect->y), &(rect->width), &(rect->height));
}