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

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

class QDoubleValidatorJBridge : public QDoubleValidator
{
public:
	QDoubleValidatorJBridge(QObject* parent, const char* name) : QDoubleValidator(parent, name) {}
	QDoubleValidatorJBridge(double bottom, double top, int decimals, QObject* parent, const char* name) : QDoubleValidator(bottom, top, decimals, parent, name) {}
	~QDoubleValidatorJBridge() {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_QDoubleValidator_newQDoubleValidator__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 QDoubleValidatorJBridge((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_QDoubleValidator_newQDoubleValidator__Lorg_kde_qt_QObject_2(JNIEnv *env, jobject obj, jobject parent)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QDoubleValidatorJBridge((QObject*) QtSupport::getQt(env, parent), 0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDoubleValidator_newQDoubleValidator__DDILorg_kde_qt_QObject_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jdouble bottom, jdouble top, jint decimals, jobject parent, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QDoubleValidatorJBridge((double) bottom, (double) top, (int) decimals, (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_QDoubleValidator_newQDoubleValidator__DDILorg_kde_qt_QObject_2(JNIEnv *env, jobject obj, jdouble bottom, jdouble top, jint decimals, jobject parent)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QDoubleValidatorJBridge((double) bottom, (double) top, (int) decimals, (QObject*) QtSupport::getQt(env, parent), 0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT jint JNICALL
Java_org_kde_qt_QDoubleValidator_validate(JNIEnv *env, jobject obj, jobject arg1, jintArray arg2)
{
static QString * _qstring_arg1 = 0;
	int pos;
	jint result = (jint) ((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->validate((QString&) * (QString *) QtSupport::toQStringFromStringBuffer(env, arg1, &_qstring_arg1), pos);
	env->SetIntArrayRegion(arg2, 0, 1, (jint*) &pos);
	QtSupport::fromQStringToStringBuffer(env, _qstring_arg1, arg1);
	return result;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDoubleValidator_setRange__DDI(JNIEnv *env, jobject obj, jdouble bottom, jdouble top, jint decimals)
{
	((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->setRange((double) bottom, (double) top, (int) decimals);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDoubleValidator_setRange__DD(JNIEnv *env, jobject obj, jdouble bottom, jdouble top)
{
	((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->setRange((double) bottom, (double) top, 0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDoubleValidator_setBottom(JNIEnv *env, jobject obj, jdouble arg1)
{
	((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->setBottom((double) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDoubleValidator_setTop(JNIEnv *env, jobject obj, jdouble arg1)
{
	((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->setTop((double) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDoubleValidator_setDecimals(JNIEnv *env, jobject obj, jint arg1)
{
	((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->setDecimals((int) arg1);
	return;
}

JNIEXPORT jdouble JNICALL
Java_org_kde_qt_QDoubleValidator_bottom(JNIEnv *env, jobject obj)
{
	return (jdouble) ((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->bottom();
}

JNIEXPORT jdouble JNICALL
Java_org_kde_qt_QDoubleValidator_top(JNIEnv *env, jobject obj)
{
	return (jdouble) ((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->top();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QDoubleValidator_decimals(JNIEnv *env, jobject obj)
{
	return (jint) ((QDoubleValidatorJBridge*) QtSupport::getQt(env, obj))->decimals();
}

