/***************************************************************************
                            QCursor.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 <qcursor.h>
#include <qstring.h>
#include <qcstring.h>

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

class QCursorJBridge : public QCursor
{
public:
	QCursorJBridge() : QCursor() {}
	QCursorJBridge(int shape) : QCursor(shape) {}
	QCursorJBridge(const QBitmap& bitmap, const QBitmap& mask, int hotX, int hotY) : QCursor(bitmap, mask, hotX, hotY) {}
	QCursorJBridge(const QPixmap& pixmap, int hotX, int hotY) : QCursor(pixmap, hotX, hotY) {}
	QCursorJBridge(const QCursor& arg1) : QCursor(arg1) {}
	~QCursorJBridge() {QtSupport::qtKeyDeleted(this);}
//	QCursorJBridge(HCURSOR arg1) : QCursor(arg1) {}
};


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

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_newQCursor__I(JNIEnv *env, jobject obj, jint shape)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCursorJBridge((int) shape));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_newQCursor__Lorg_kde_qt_QBitmap_2Lorg_kde_qt_QBitmap_2II(JNIEnv *env, jobject obj, jobject bitmap, jobject mask, jint hotX, jint hotY)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCursorJBridge((QBitmap&) *(QBitmap *) QtSupport::getQt(env, bitmap), (QBitmap&) *(QBitmap *) QtSupport::getQt(env, mask), (int) hotX, (int) hotY));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_newQCursor__Lorg_kde_qt_QBitmap_2Lorg_kde_qt_QBitmap_2(JNIEnv *env, jobject obj, jobject bitmap, jobject mask)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCursorJBridge((QBitmap&) *(QBitmap *) QtSupport::getQt(env, bitmap), (QBitmap&) *(QBitmap *) QtSupport::getQt(env, mask), -1, -1));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_newQCursor__Lorg_kde_qt_QPixmap_2II(JNIEnv *env, jobject obj, jobject pixmap, jint hotX, jint hotY)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCursorJBridge((QPixmap&) *(QPixmap *) QtSupport::getQt(env, pixmap), (int) hotX, (int) hotY));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_newQCursor__Lorg_kde_qt_QPixmap_2(JNIEnv *env, jobject obj, jobject pixmap)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCursorJBridge((QPixmap&) *(QPixmap *) QtSupport::getQt(env, pixmap), -1, -1));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

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

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCursor_shape(JNIEnv *env, jobject obj)
{
	return (jint) ((QCursorJBridge*) QtSupport::getQt(env, obj))->shape();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_setShape(JNIEnv *env, jobject obj, jint arg1)
{
	((QCursorJBridge*) QtSupport::getQt(env, obj))->setShape((int) arg1);
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCursor_bitmap(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QCursorJBridge*) QtSupport::getQt(env, obj))->bitmap(), "org.kde.qt.QBitmap");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCursor_mask(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QCursorJBridge*) QtSupport::getQt(env, obj))->mask(), "org.kde.qt.QBitmap");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCursor_hotSpot(JNIEnv *env, jobject obj)
{
	QPoint _p= ((QCursorJBridge*) QtSupport::getQt(env, obj))->hotSpot();
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QPoint(_p.x(),_p.y()), "org.kde.qt.QPoint", TRUE);
}

//JNIEXPORT jint JNICALL
//Java_org_kde_qt_QCursor_handle__(JNIEnv *env, jobject obj)
//{
//	return (jint) ((QCursorJBridge*) QtSupport::getQt(env, obj))->handle();
//}

//JNIEXPORT void JNICALL
//Java_org_kde_qt_QCursor_newQCursor__I(JNIEnv *env, jobject obj, jint arg1)
//{
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new QCursorJBridge((HCURSOR) arg1));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

//JNIEXPORT jint JNICALL
//Java_org_kde_qt_QCursor_handle__(JNIEnv *env, jobject obj)
//{
//	return (jint) ((QCursorJBridge*) QtSupport::getQt(env, obj))->handle();
//}

//JNIEXPORT jint JNICALL
//Java_org_kde_qt_QCursor_handle__(JNIEnv *env, jobject obj)
//{
//	return (jint) ((QCursorJBridge*) QtSupport::getQt(env, obj))->handle();
//}

//JNIEXPORT jint JNICALL
//Java_org_kde_qt_QCursor_handle__(JNIEnv *env, jobject obj)
//{
//	return (jint) ((QCursorJBridge*) QtSupport::getQt(env, obj))->handle();
//}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCursor_pos(JNIEnv *env, jclass obj)
{
	QPoint _p= QCursorJBridge::pos();
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QPoint(_p.x(),_p.y()), "org.kde.qt.QPoint", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_setPos__II(JNIEnv *env, jclass obj, jint x, jint y)
{
	QCursorJBridge::setPos((int) x, (int) y);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_setPos__Lorg_kde_qt_QPoint_2(JNIEnv *env, jclass obj, jobject arg1)
{
	QCursorJBridge::setPos((QPoint&) *(QPoint *) QtSupport::getQt(env, arg1));
	return;
}

//JNIEXPORT jobject JNICALL
//Java_org_kde_qt_QCursor_pos__(JNIEnv *env, jclass obj)
//{
//	QPoint _p= QCursorJBridge::pos();
//	return (jobject) QtSupport::objectForQtKey(env, (void *)new QPoint(_p.x(),_p.y()), "org.kde.qt.QPoint", TRUE);
//}

//JNIEXPORT void JNICALL
//Java_org_kde_qt_QCursor_setPos__II(JNIEnv *env, jclass obj, jint x, jint y)
//{
//	QCursorJBridge::setPos((int) x, (int) y);
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_qt_QCursor_setPos__Lorg_kde_qt_QPoint_2(JNIEnv *env, jclass obj, jobject arg1)
//{
//	QCursorJBridge::setPos((QPoint&) *(QPoint *) QtSupport::getQt(env, arg1));
//	return;
//}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_initialize(JNIEnv *env, jclass obj)
{
	QCursorJBridge::initialize();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCursor_cleanup(JNIEnv *env, jclass obj)
{
	QCursorJBridge::cleanup();
	return;
}

//JNIEXPORT jint JNICALL
//Java_org_kde_qt_QCursor_x11Screen(JNIEnv *env, jclass obj)
//{
//	return (jint) QCursorJBridge::x11Screen();
//}

