/***************************************************************************
                            KColor.cpp -  description
                             -------------------
    begin                : Sun Jan 27 16:22:17 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Jan 27 16:22:17 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <kcolordialog.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/KColor.h>

class KColorJBridge : public KColor
{
public:
	KColorJBridge() : KColor() {}
	KColorJBridge(const KColor& col) : KColor(col) {}
	KColorJBridge(const QColor& col) : KColor(col) {}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KColor_newKColor__(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KColorJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KColor_newKColor__Lorg_kde_koala_KColor_2(JNIEnv *env, jobject obj, jobject col)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KColorJBridge((KColor&) *(KColor *) QtSupport::getQt(env, col)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KColor_newKColor__Lorg_kde_qt_QColor_2(JNIEnv *env, jobject obj, jobject col)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KColorJBridge((QColor&) *(QColor *) QtSupport::getQt(env, col)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KColor_setHsv(JNIEnv *env, jobject obj, jint _h, jint _s, jint _v)
{
	((KColor*) QtSupport::getQt(env, obj))->setHsv((int) _h, (int) _s, (int) _v);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KColor_setRgb(JNIEnv *env, jobject obj, jint _r, jint _g, jint _b)
{
	((KColor*) QtSupport::getQt(env, obj))->setRgb((int) _r, (int) _g, (int) _b);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KColor_rgb(JNIEnv *env, jobject obj, jintArray _r, jintArray _g, jintArray _b)
{
	((KColor*) QtSupport::getQt(env, obj))->rgb( (int*) QtSupport::toIntPtr(env, _r),  (int*) QtSupport::toIntPtr(env, _g),  (int*) QtSupport::toIntPtr(env, _b));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KColor_hsv(JNIEnv *env, jobject obj, jintArray _h, jintArray _s, jintArray _v)
{
	((KColor*) QtSupport::getQt(env, obj))->hsv( (int*) QtSupport::toIntPtr(env, _h),  (int*) QtSupport::toIntPtr(env, _s),  (int*) QtSupport::toIntPtr(env, _v));
	return;
}

