/***************************************************************************
                            QGLColormap.cpp -  description
                             -------------------
    begin                : Wed Nov 21 17:05:56 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 17:05:56 2001, 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 <qglcolormap.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <qtjava/QGLColormap.h>

class QGLColormapJBridge : public QGLColormap
{
public:
	QGLColormapJBridge() : QGLColormap() {}
	QGLColormapJBridge(const QGLColormap& arg1) : QGLColormap(arg1) {}
	~QGLColormapJBridge() {QtSupport::qtKeyDeleted(this);}
};


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

JNIEXPORT void JNICALL
Java_org_kde_qt_QGLColormap_newQGLColormap__Lorg_kde_qt_QGLColormap_2(JNIEnv *env, jobject obj, jobject arg1)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QGLColormapJBridge((QGLColormap&) *(QGLColormap *) QtSupport::getQt(env, arg1)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGLColormap_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (QGLColormap*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QGLColormap_isEmpty(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QGLColormapJBridge*) QtSupport::getQt(env, obj))->isEmpty();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGLColormap_size(JNIEnv *env, jobject obj)
{
	return (jint) ((QGLColormapJBridge*) QtSupport::getQt(env, obj))->size();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGLColormap_detach(JNIEnv *env, jobject obj)
{
	((QGLColormapJBridge*) QtSupport::getQt(env, obj))->detach();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGLColormap_setEntries__I_3II(JNIEnv *env, jobject obj, jint count, jintArray colors, jint base)
{
	((QGLColormapJBridge*) QtSupport::getQt(env, obj))->setEntries((int) count,  (QRgb*) QtSupport::toIntPtr(env, colors), (int) base);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGLColormap_setEntries__I_3I(JNIEnv *env, jobject obj, jint count, jintArray colors)
{
	((QGLColormapJBridge*) QtSupport::getQt(env, obj))->setEntries((int) count,  (QRgb*) QtSupport::toIntPtr(env, colors), 0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGLColormap_setEntry__II(JNIEnv *env, jobject obj, jint idx, jint color)
{
	((QGLColormapJBridge*) QtSupport::getQt(env, obj))->setEntry((int) idx, (QRgb) color);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGLColormap_setEntry__ILorg_kde_qt_QColor_2(JNIEnv *env, jobject obj, jint idx, jobject color)
{
	((QGLColormapJBridge*) QtSupport::getQt(env, obj))->setEntry((int) idx, (QColor&) *(QColor *) QtSupport::getQt(env, color));
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGLColormap_entryRgb(JNIEnv *env, jobject obj, jint idx)
{
	return (jint) ((QGLColormapJBridge*) QtSupport::getQt(env, obj))->entryRgb((int) idx);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QGLColormap_entryColor(JNIEnv *env, jobject obj, jint idx)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QColor (((QGLColormapJBridge*) QtSupport::getQt(env, obj))->entryColor((int) idx)), "org.kde.qt.QColor", TRUE);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGLColormap_find(JNIEnv *env, jobject obj, jint color)
{
	return (jint) ((QGLColormapJBridge*) QtSupport::getQt(env, obj))->find((QRgb) color);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGLColormap_findNearest(JNIEnv *env, jobject obj, jint color)
{
	return (jint) ((QGLColormapJBridge*) QtSupport::getQt(env, obj))->findNearest((QRgb) color);
}

