예제 #1
0
파일: Widget.c 프로젝트: JavaGtk/JavaGtk
/*
 * Class:     org_java_gtk_gtk_Widget
 * Method:    gtk_widget_set_accel_path
 * Signature: (JLjava/lang/String;J)V
 */
JNIEXPORT void JNICALL Java_org_java_1gtk_gtk_Widget_gtk_1widget_1set_1accel_1path
  (JNIEnv *env, jclass cls, jlong widget, jstring path, jlong accel_group)
{
	const char* strPath;

	strPath = getJavaString(env, path);
	gtk_widget_set_accel_path((GtkWidget*)widget, strPath, (GtkAccelGroup*)accel_group);
	releaseJavaString(env, path, strPath);
}
예제 #2
0
/*
 * Gets the text.
 */
JNIEXPORT jstring JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_getText
(JNIEnv *env, jobject obj)
{
  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
  assert( line );
  QString text = line->text();

  return getJavaString(env, &text);
}
예제 #3
0
파일: Widget.c 프로젝트: JavaGtk/JavaGtk
/*
 * Class:     org_java_gtk_gtk_Widget
 * Method:    gtk_widget_set_name
 * Signature: (JLjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_java_1gtk_gtk_Widget_gtk_1widget_1set_1name
  (JNIEnv *env, jclass cls, jlong widget, jstring name)
{
	const char* strName;

	strName = getJavaString(env, name);
	if (strName == NULL) return;
	gtk_widget_set_name((GtkWidget*)widget, (gchar*)strName);
	releaseJavaString(env, name, strName);
}
예제 #4
0
/*
 * Class:     org_java_gtk_gtk_AboutDialog
 * Method:    gtk_about_dialog_set_version
 * Signature: (JLjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_java_1gtk_gtk_AboutDialog_gtk_1about_1dialog_1set_1version
  (JNIEnv *env, jclass cls, jlong dialog, jstring version)
{
	const char* strVersion;

	strVersion = getJavaString(env, version);
	if (strVersion == NULL) return;
	gtk_about_dialog_set_version((GtkAboutDialog*)dialog, (gchar*)strVersion);
	releaseJavaString(env, version, strVersion);
}
예제 #5
0
/*
 * Class:     org_java_gtk_gtk_AboutDialog
 * Method:    gtk_about_dialog_set_program_name
 * Signature: (JLjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_java_1gtk_gtk_AboutDialog_gtk_1about_1dialog_1set_1program_1name
  (JNIEnv *env, jclass cls, jlong dialog, jstring name)
{
	const char* strName;

	strName = getJavaString(env, name);
	if (strName == NULL) return;
	gtk_about_dialog_set_program_name((GtkAboutDialog*)dialog, (gchar*)strName);
	releaseJavaString(env, name, strName);
}
예제 #6
0
/*
 * Class:     org_java_gtk_gtk_AboutDialog
 * Method:    gtk_about_dialog_set_website
 * Signature: (JLjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_java_1gtk_gtk_AboutDialog_gtk_1about_1dialog_1set_1website
  (JNIEnv *env, jclass cls, jlong dialog, jstring website)
{
	const char* strWebsite;

	strWebsite = getJavaString(env, website);
	if (strWebsite == NULL) return;
	gtk_about_dialog_set_website((GtkAboutDialog*)dialog, (gchar*)strWebsite);
	releaseJavaString(env, website, strWebsite);
}
예제 #7
0
/*
 * Class:     org_java_gtk_gtk_AboutDialog
 * Method:    gtk_about_dialog_set_comments
 * Signature: (JLjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_java_1gtk_gtk_AboutDialog_gtk_1about_1dialog_1set_1comments
  (JNIEnv *env, jclass cls, jlong dialog, jstring comments)
{
	const char* strComments;

	strComments = getJavaString(env, comments);
	if (strComments == NULL) return;
	gtk_about_dialog_set_comments((GtkAboutDialog*)dialog, (gchar*)strComments);
	releaseJavaString(env, comments, strComments);
}
예제 #8
0
/*
 * Class:     org_java_gtk_cairo_CairoContext
 * Method:    cairo_show_text
 * Signature: (JLjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_java_1gtk_cairo_CairoContext_cairo_1show_1text
  (JNIEnv *env, jclass cls, jlong context, jstring text)
{
	const char* strText;

	strText = getJavaString(env, text);
	if (strText == NULL) return;
	cairo_show_text((cairo_t*)context, strText);
	(*env)->ReleaseStringUTFChars(env, text, strText);
}
예제 #9
0
/*
 * Class:     org_java_gtk_gtk_MessageDialog
 * Method:    gtk_message_dialog_new
 * Signature: (JIIILjava/lang/String;)J
 */
JNIEXPORT jlong JNICALL Java_org_java_1gtk_gtk_MessageDialog_gtk_1message_1dialog_1new
  (JNIEnv *env, jclass cls, jlong parent, jint flags, jint type, jint buttons, jstring message)
{
	const char* strMessage;

	strMessage = getJavaString(env, message);
	GtkWidget* widget = gtk_message_dialog_new((GtkWindow*)parent, (GtkDialogFlags)flags, (GtkMessageType)type, (GtkButtonsType)buttons, (gchar*)strMessage);
	releaseJavaString(env, message, strMessage);
	return (jlong)widget;
}
예제 #10
0
파일: StatusBar.c 프로젝트: JavaGtk/JavaGtk
/*
 * Class:     org_java_gtk_gtk_StatusBar
 * Method:    gtk_statusbar_get_context_id
 * Signature: (JLjava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_org_java_1gtk_gtk_StatusBar_gtk_1statusbar_1get_1context_1id
  (JNIEnv *env, jclass cls, jlong statusbar, jstring text)
{
	const char* strText;
	guint context_id;

	strText = getJavaString(env, text);
	context_id = gtk_statusbar_get_context_id((GtkStatusbar*)statusbar, (const gchar*)strText);
	releaseJavaString(env, text, strText);
	return (jint)context_id;
}
예제 #11
0
파일: Image.c 프로젝트: JavaGtk/JavaGtk
/*
 * Class:     org_java_gtk_gtk_Image
 * Method:    gtk_image_new_from_file
 * Signature: (Ljava/lang/String;)J
 */
JNIEXPORT jlong JNICALL Java_org_java_1gtk_gtk_Image_gtk_1image_1new_1from_1file
(JNIEnv *env, jclass cls, jstring filename)
{
	const char* strFilename;
	GtkWidget* widget;

	strFilename = getJavaString(env, filename);
	widget = gtk_image_new_from_file(strFilename);
	releaseJavaString(env, filename, strFilename);

	return (jlong)widget;
}
예제 #12
0
파일: qttoolkit.cpp 프로젝트: 0day-ci/gcc
/*
 * Returns the available fonts
 */
JNIEXPORT jobjectArray JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_nativeFontFamilies
(JNIEnv *env, jobject obj)
{
  jobjectArray result_array;
  jobject *result_array_ptr;
  QFontDatabase db;
  QStringList fonts = db.families();

  result_array = env->NewObjectArray(fonts.size(), 
				     env->FindClass("java/lang/String"),
				     env->NewStringUTF(""));
  for (int i = 0; i < fonts.size(); i++)
    {
      QString qstr = fonts.at(i);
      jstring jstr = getJavaString(env, &qstr);
      env->SetObjectArrayElement( result_array, i, jstr );
    }
  return result_array;
}
예제 #13
0
파일: jni_util.c 프로젝트: JavaGtk/JavaGtk
void printClassName(JNIEnv *env, jobject obj) {
	jclass obj_cls = (*env)->GetObjectClass(env, obj);

	// First get the class object
	jmethodID mid = (*env)->GetMethodID(env, obj_cls, "getClass", "()Ljava/lang/Class;");
	jobject clsObj = (*env)->CallObjectMethod(env, obj, mid);

	// Now get the class object's class descriptor
	jclass cls = (*env)->GetObjectClass(env, clsObj);

	// Find the getName() method on the class object
	mid = (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;");

	// Call the getName() to get a jstring object back
	jstring strObj = (jstring)(*env)->CallObjectMethod(env, clsObj, mid);

	const char* cstr = getJavaString(env, strObj);

	printf("class: %s", cstr);

	releaseJavaString(env, strObj, cstr);

}