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

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

class QImageDragJBridge : public QImageDrag
{
public:
	QImageDragJBridge(QImage image, QWidget* dragSource, const char* name) : QImageDrag(image, dragSource, name) {}
	QImageDragJBridge(QWidget* dragSource, const char* name) : QImageDrag(dragSource, name) {}
	~QImageDragJBridge() {QtSupport::qtKeyDeleted(this);}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(arg1);
		}
		return;
	}
	void customEvent(QCustomEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "customEvent", arg1, "org.kde.qt.QCustomEvent")) {
			QObject::customEvent(arg1);
		}
		return;
	}
	void timerEvent(QTimerEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "timerEvent", arg1, "org.kde.qt.QTimerEvent")) {
			QObject::timerEvent(arg1);
		}
		return;
	}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QImageDrag_newQImageDrag__Lorg_kde_qt_QImage_2Lorg_kde_qt_QWidget_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject image, jobject dragSource, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QImageDragJBridge((QImage) *(QImage *) QtSupport::getQt(env, image), (QWidget*) QtSupport::getQt(env, dragSource), (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QImageDrag_newQImageDrag__Lorg_kde_qt_QWidget_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject dragSource, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QImageDragJBridge((QWidget*) QtSupport::getQt(env, dragSource), (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QImageDrag_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj) && ((QImageDrag*)QtSupport::getQt(env, obj))->parent() == (QObject *) 0) {
		delete (QImageDrag*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QImageDrag_setImage(JNIEnv *env, jobject obj, jobject image)
{
	((QImageDragJBridge*) QtSupport::getQt(env, obj))->setImage((QImage) *(QImage *) QtSupport::getQt(env, image));
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QImageDrag_format(JNIEnv *env, jobject obj, jint i)
{
	const char *  _qcstring;
	_qcstring = (const char *)((QImageDragJBridge*) QtSupport::getQt(env, obj))->format((int) i);
	return QtSupport::fromCharString(env, (char *) _qcstring);
}

JNIEXPORT jbyteArray JNICALL
Java_org_kde_qt_QImageDrag_encodedData(JNIEnv *env, jobject obj, jstring arg1)
{
	QByteArray  _qbyteArray;
static QCString * _qstring_arg1 = 0;
	_qbyteArray = ((QImageDragJBridge*) QtSupport::getQt(env, obj))->encodedData((char*) QtSupport::toCharString(env, arg1, &_qstring_arg1));
	return QtSupport::fromQByteArray(env, &_qbyteArray);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QImageDrag_canDecode(JNIEnv *env, jclass obj, jobject e)
{
	return (jboolean) QImageDragJBridge::canDecode(QtSupport::mimeSource(env, e));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QImageDrag_decode__Lorg_kde_qt_QMimeSourceInterface_2Lorg_kde_qt_QImage_2(JNIEnv *env, jclass obj, jobject e, jobject i)
{
	return (jboolean) QImageDragJBridge::decode(QtSupport::mimeSource(env, e), (QImage&) *(QImage *) QtSupport::getQt(env, i));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QImageDrag_decode__Lorg_kde_qt_QMimeSourceInterface_2Lorg_kde_qt_QPixmap_2(JNIEnv *env, jclass obj, jobject e, jobject i)
{
	return (jboolean) QImageDragJBridge::decode(QtSupport::mimeSource(env, e), (QPixmap&) *(QPixmap *) QtSupport::getQt(env, i));
}

