/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2002 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome Team Members:
 *   Jean Van Wyk <jeanvanwyk@iname.com>
 *   Jeffrey S. Morgan <jeffrey.morgan@bristolwest.com>
 *   Dan Bornstein <danfuzz@milk.com>
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 *
 * This file was orriginally generated by the Java-GNOME Code Generator
 * Please do not modify the code that is identified as generated.  Also,
 * please insert your code above the generated code.
 *
 * Generation date: 2002-08-02 09:42:26 EDT
 */

#include <jni.h>
#include <sys/types.h>
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" 
{
#endif

/*
 * Class:     org.gnu.gtk.RadioButton
 * Method:    gtk_radio_button_get_type
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1get_1type (JNIEnv *env, 
    jclass cls) 
{
	return (jint)gtk_radio_button_get_type ();
}

                                                                                                  
/*
 * Class:     org_gnu_gtk_RadioButton
 * Method:    gtk_radio_button_new
 * Signature: ([I)I
 */
JNIEXPORT jint JNICALL Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1new
  (JNIEnv *env, jclass cls, jintArray group)
{
	GSList* list = NULL;
	jint* array;
	jsize len;
	int index;
	jint value;
	
	if (group != NULL) {
		len = (*env)->GetArrayLength(env, group);
		array = (*env)->GetIntArrayElements(env, group, NULL);
		list = g_slist_alloc();
		for (index = 0; index < len; index++)
			list = g_slist_append(list, (GtkRadioButton*)array[index]);
	}
	value = (jint)gtk_radio_button_new(list);
    return value;
}
                                                                                                  
/*
 * Class:     org.gnu.gtk.RadioButton
 * Method:    gtk_radio_button_new_from_widget
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1new_1from_1widget
    (JNIEnv *env, jclass cls, jint group) 
{
    return (jint)gtk_radio_button_new_from_widget((GtkRadioButton *)group);
}

/*
 * Class:     org_gnu_gtk_RadioButton
 * Method:    gtk_radio_button_new_with_label
 * Signature: ([ILjava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1new_1with_1label
    (JNIEnv *env, jclass cls, jintArray group, jstring label) 
{
	GSList* list = NULL;
	jint* array;
	jsize len;
	int index;
	jint value;
	const gchar* label_g;
	
	if (group != NULL) {
		len = (*env)->GetArrayLength(env, group);
		array = (*env)->GetIntArrayElements(env, group, NULL);
		list = g_slist_alloc();
		for (index = 0; index < len; index++)
			list = g_slist_append(list, (GtkRadioButton*)array[index]);
	}
    label_g = (*env)->GetStringUTFChars(env, label, NULL);
	value = (jint)gtk_radio_button_new_with_label(list, label_g);
	(*env)->ReleaseStringUTFChars(env, label, label_g);
    return value;
}
                                                                                                  
/*
 * Class:     org.gnu.gtk.RadioButton
 * Method:    gtk_radio_button_new_with_label_from_widget
 * Signature: (I[B)I
 */
JNIEXPORT jint JNICALL 
Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1new_1with_1label_1from_1widget
	(JNIEnv *env, jclass cls, jint group, jstring label) 
{
    const gchar* label_g = (*env)->GetStringUTFChars(env, label, NULL);
	jint retval =  (jint)gtk_radio_button_new_with_label_from_widget((GtkRadioButton*)group, label_g);
	(*env)->ReleaseStringUTFChars(env, label, label_g );
	return retval;
}

/*
 * Class:     org_gnu_gtk_RadioButton
 * Method:    gtk_radio_button_new_with_mnemonic
 * Signature: ([ILjava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1new_1with_1mnemonic
    (JNIEnv *env, jclass cls, jintArray group, jstring label) 
{
	GSList* list = NULL;
	jint* array;
	jsize len;
	int index;
	jint value;
	const gchar* label_g;
	
	if (group != NULL) {
		len = (*env)->GetArrayLength(env, group);
		array = (*env)->GetIntArrayElements(env, group, NULL);
		list = g_slist_alloc();
		for (index = 0; index < len; index++)
			list = g_slist_append(list, (GtkRadioButton*)array[index]);
	}
    label_g = (*env)->GetStringUTFChars(env, label, NULL);
	value = (jint)gtk_radio_button_new_with_mnemonic(list, label_g);
	(*env)->ReleaseStringUTFChars(env, label, label_g);
    return value;
}
                                                                                                  
/*
 * Class:     org.gnu.gtk.RadioButton
 * Method:    gtk_radio_button_new_with_mnemonic_from_widget
 * Signature: (I[B)I
 */
JNIEXPORT jint JNICALL 
Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1new_1with_1mnemonic_1from_1widget (JNIEnv 
    *env, jclass cls, jint group, jstring label) 
{
    const gchar* label_g = (*env)->GetStringUTFChars(env, label, NULL);
	jint retval =  (jint)gtk_radio_button_new_with_mnemonic_from_widget((GtkRadioButton*)group, label_g);
	(*env)->ReleaseStringUTFChars( env, label, label_g );
	return retval;
}

/*
 * Class:     org_gnu_gtk_RadioButton
 * Method:    gtk_radio_button_get_group
 * Signature: (I)[I
 */
JNIEXPORT jintArray JNICALL Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1get_1group
  (JNIEnv *env, jclass cls, jint button)
{
	GSList* list;
	GSList* item;
	jintArray array;
	guint len;
	guint index;
	
	list = gtk_radio_button_get_group((GtkRadioButton*)button);
	if (NULL == list)
		return NULL;
	len = g_slist_length(list);
	array = (*env)->NewIntArray(env, len);
	for (index = 0; index < len; index++) {
		item = g_slist_nth(list, index);
		(*env)->SetIntArrayRegion(env, array, index, len, (jint*)(GtkRadioButton*)item->data);
	}
	return array;
}
                                                                                
/*
 * Class:     org_gnu_gtk_RadioButton
 * Method:    gtk_radio_button_set_group
 * Signature: (I[I)V
 */
JNIEXPORT void JNICALL Java_org_gnu_gtk_RadioButton_gtk_1radio_1button_1set_1group
  (JNIEnv *env, jclass cls, jint button, jintArray group)
{
	GSList* list;
	jint* array;
	jsize len;
	int index;
	
	len = (*env)->GetArrayLength(env, group);
	array = (*env)->GetIntArrayElements(env, group, NULL);
	list = g_slist_alloc();
	for (index = 0; index < len; index++) {
		list = g_slist_append(list, (GtkRadioButton*)array[index]);
	}
	gtk_radio_button_set_group((GtkRadioButton*)button, list);
}
                                                                                

#ifdef __cplusplus
}

#endif
