/*
 * 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:25 EDT
 */

#include <jni.h>
#include <sys/types.h>
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" 
{
#endif
    /****************************************
     * BEGINNING OF GENERATED CODE
     ****************************************/
    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_get_type
     * Signature: ()I
     */
    JNIEXPORT jint JNICALL Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1get_1type (JNIEnv 
        *env, jclass cls) 
    {
        {
            return (jint)gtk_color_selection_get_type ();
        }
    }

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

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_get_has_opacity_control
     * Signature: (I)Z
     */
    JNIEXPORT jboolean JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1get_1has_1opacity_1control (JNIEnv *env, 
        jclass cls, jint colorsel) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        {
            jboolean result_j = (jboolean) (gtk_color_selection_get_has_opacity_control (colorsel_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_set_has_opacity_control
     * Signature: (IZ)V
     */
    JNIEXPORT void JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1set_1has_1opacity_1control (JNIEnv *env, 
        jclass cls, jint colorsel, jboolean hasOpacity) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        gboolean hasOpacity_g = (gboolean) hasOpacity;
        {
            gtk_color_selection_set_has_opacity_control (colorsel_g, hasOpacity_g);
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_get_has_palette
     * Signature: (I)Z
     */
    JNIEXPORT jboolean JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1get_1has_1palette (JNIEnv *env, jclass 
        cls, jint colorsel) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        {
            jboolean result_j = (jboolean) (gtk_color_selection_get_has_palette (colorsel_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_set_has_palette
     * Signature: (IZ)V
     */
    JNIEXPORT void JNICALL Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1set_1has_1palette (
        JNIEnv *env, jclass cls, jint colorsel, jboolean hasPalette) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        gboolean hasPalette_g = (gboolean) hasPalette;
        {
            gtk_color_selection_set_has_palette (colorsel_g, hasPalette_g);
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_set_current_color
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1set_1current_1color (JNIEnv *env, jclass 
        cls, jint colorsel, jint color) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        GdkColor *color_g = (GdkColor *)color;
        {
            gtk_color_selection_set_current_color (colorsel_g, color_g);
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_set_current_alpha
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1set_1current_1alpha (JNIEnv *env, jclass 
        cls, jint colorsel, jint alpha) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        gint32 alpha_g = (gint32) alpha;
        {
            gtk_color_selection_set_current_alpha (colorsel_g, alpha_g);
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_get_current_color
     * Signature: (I)I
     */
    JNIEXPORT jint JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1get_1current_1color (JNIEnv *env, jclass 
        cls, jint colorsel) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        GdkColor color;
	gtk_color_selection_get_current_color (colorsel_g, &color);

	// Use gdk_color_copy so that Color.finalize will release it properly.
	return (jint)gdk_color_copy (&color);
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_get_current_alpha
     * Signature: (I)I
     */
    JNIEXPORT jint JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1get_1current_1alpha (JNIEnv *env, jclass 
        cls, jint colorsel) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        {
            jint result_j = (jint) (gtk_color_selection_get_current_alpha (colorsel_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_set_previous_color
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1set_1previous_1color (JNIEnv *env, 
        jclass cls, jint colorsel, jint color) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        GdkColor *color_g = (GdkColor *)color;
        {
            gtk_color_selection_set_previous_color (colorsel_g, color_g);
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_set_previous_alpha
     * Signature: (II)V
     */
    JNIEXPORT void JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1set_1previous_1alpha (JNIEnv *env, 
        jclass cls, jint colorsel, jint alpha) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        gint32 alpha_g = (gint32) alpha;
        {
            gtk_color_selection_set_previous_alpha (colorsel_g, alpha_g);
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_get_previous_color
     * Signature: (I[Lint ;)V
     */
    JNIEXPORT void JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1get_1previous_1color (JNIEnv *env, 
        jclass cls, jint colorsel, jintArray color) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        gint *color_g_g = (gint *) (*env)->GetIntArrayElements (env, color, NULL);
        GdkColor *color_g = (GdkColor *)color_g_g;
        {
            gtk_color_selection_get_previous_color (colorsel_g, color_g);
            (*env)->ReleaseIntArrayElements (env, color, (jint*)color_g_g, 0);
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_get_previous_alpha
     * Signature: (I)I
     */
    JNIEXPORT jint JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1get_1previous_1alpha (JNIEnv *env, 
        jclass cls, jint colorsel) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        {
            jint result_j = (jint) (gtk_color_selection_get_previous_alpha (colorsel_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_is_adjusting
     * Signature: (I)Z
     */
    JNIEXPORT jboolean JNICALL Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1is_1adjusting (
        JNIEnv *env, jclass cls, jint colorsel) 
    {
        GtkColorSelection *colorsel_g = (GtkColorSelection *)colorsel;
        {
            jboolean result_j = (jboolean) (gtk_color_selection_is_adjusting (colorsel_g));
            return result_j;
        }
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_palette_from_string
     * Signature: (java.lang.String;[Lint ;I)Z
     *
     * TODO:  This method isn't implemented right, as it assumes that
     *        the passed in array and length are already allocated, when
     *        it appears that gtk_color_selection_palette_from_string
     *        allocates the array itself.  One clue is the pointer to
     *        the array length, as normally that means that the length
     *        will be set by the routine.
     *        
     *        Anyway, currently no Java code calls this method, so it
     *        can stay broken until needed.  (tball)
     */
    JNIEXPORT jboolean JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1palette_1from_1string (JNIEnv *env, 
        jclass cls, jstring str, jintArray color, jint nColors) 
    {
        gchar* str_g = (gchar*)(*env)->GetStringUTFChars(env, str, 0);
        gint **color_g = (gint **) (*env)->GetIntArrayElements (env, color, NULL);
        jboolean result_j = (jboolean) gtk_color_selection_palette_from_string (str_g, 
                    (GdkColor**)color_g, (gint32*)&nColors);
       	(*env)->ReleaseStringUTFChars(env, str, str_g);
        (*env)->ReleaseIntArrayElements (env, color, (jint*)color_g, 0);
        return result_j;
    }

    /*
     * Class:     org.gnu.gtk.ColorSelection
     * Method:    gtk_color_selection_palette_to_string
     * Signature: (II)java.lang.String;
     */
    JNIEXPORT jstring JNICALL 
    Java_org_gnu_gtk_ColorSelection_gtk_1color_1selection_1palette_1to_1string (JNIEnv *env, jclass 
        cls, jint color, jint nColors) 
    {
        gchar *result_g = gtk_color_selection_palette_to_string ((GdkColor*)color, (gint32)nColors);
        return (*env)->NewStringUTF(env, result_g);
    }

    /****************************************
     * END OF GENERATED CODE
     ****************************************/
#ifdef __cplusplus
}

#endif
