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

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

class QSignalJBridge : public QSignal
{
public:
	QSignalJBridge(QObject* parent, const char* name) : QSignal(parent, name) {}
	~QSignalJBridge() {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_QSignal_newQSignal__Lorg_kde_qt_QObject_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject parent, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QSignalJBridge((QObject*) QtSupport::getQt(env, parent), (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

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

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QSignal_connect(JNIEnv *env, jobject obj, jobject receiver, jstring member)
{
static QCString * _qstring_member = 0;
	return (jboolean) ((QSignalJBridge*) QtSupport::getQt(env, obj))->connect((QObject*) QtSupport::getQt(env, receiver), (char*) QtSupport::toCharString(env, member, &_qstring_member));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QSignal_disconnect__Lorg_kde_qt_QObject_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject receiver, jstring member)
{
static QCString * _qstring_member = 0;
	return (jboolean) ((QSignalJBridge*) QtSupport::getQt(env, obj))->disconnect((QObject*) QtSupport::getQt(env, receiver), (char*) QtSupport::toCharString(env, member, &_qstring_member));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QSignal_disconnect__Lorg_kde_qt_QObject_2(JNIEnv *env, jobject obj, jobject receiver)
{
	return (jboolean) ((QSignalJBridge*) QtSupport::getQt(env, obj))->disconnect((QObject*) QtSupport::getQt(env, receiver), 0);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSignal_activate(JNIEnv *env, jobject obj)
{
	((QSignalJBridge*) QtSupport::getQt(env, obj))->activate();
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QSignal_isBlocked(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QSignalJBridge*) QtSupport::getQt(env, obj))->isBlocked();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSignal_block(JNIEnv *env, jobject obj, jboolean b)
{
	((QSignalJBridge*) QtSupport::getQt(env, obj))->block((bool) b);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSignal_setParameter(JNIEnv *env, jobject obj, jint value)
{
	((QSignalJBridge*) QtSupport::getQt(env, obj))->setParameter((int) value);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QSignal_parameter(JNIEnv *env, jobject obj)
{
	return (jint) ((QSignalJBridge*) QtSupport::getQt(env, obj))->parameter();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSignal_setValue(JNIEnv *env, jobject obj, jobject value)
{
	((QSignalJBridge*) QtSupport::getQt(env, obj))->setValue((QVariant&) *(QVariant *) QtSupport::getQt(env, value));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QSignal_value(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QVariant (((QSignalJBridge*) QtSupport::getQt(env, obj))->value()), "org.kde.qt.QVariant", TRUE);
}

