/***************************************************************************
                            KKey.cpp -  description
                             -------------------
    begin                : Tue Feb 19 22:58:09 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : kde3@crappy on Tue Feb 19 22:58:09 2002, 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 <kshortcut.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/KKey.h>

class KKeyJBridge : public KKey
{
public:
	KKeyJBridge() : KKey() {}
	KKeyJBridge(int keyQt) : KKey(keyQt) {}
	KKeyJBridge(const QKeySequence& arg1) : KKey(arg1) {}
	KKeyJBridge(const QKeyEvent* arg1) : KKey(arg1) {}
	KKeyJBridge(const KKey& arg1) : KKey(arg1) {}
	KKeyJBridge(const QString& arg1) : KKey(arg1) {}
	KKeyJBridge(uint key, uint mod) : KKey(key, mod) {}
	~KKeyJBridge() {QtSupport::qtKeyDeleted(this);}
};


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

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

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

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KKey_newKKey__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KKeyJBridge((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KKey_newKKey__II(JNIEnv *env, jobject obj, jint key, jint mod)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KKeyJBridge((uint) key, (uint) mod));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KKey_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KKey_finalize(env, obj);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KKey_isDisposed(JNIEnv *env, jobject obj)
{
	return (QtSupport::getQt(env, obj) == 0);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KKey_clear(JNIEnv *env, jobject obj)
{
	((KKey*) QtSupport::getQt(env, obj))->clear();
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KKey_init__I(JNIEnv *env, jobject obj, jint keyQt)
{
	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->init((int) keyQt);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KKey_init__Lorg_kde_qt_QKeySequence_2(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->init((QKeySequence&) *(QKeySequence *) QtSupport::getQt(env, arg1));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KKey_init__Lorg_kde_qt_QKeyEvent_2(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->init((QKeyEvent*) QtSupport::getQt(env, arg1));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KKey_init__Lorg_kde_koala_KKey_2(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->init((KKey&) *(KKey *) QtSupport::getQt(env, arg1));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KKey_init__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->init((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KKey_init__II(JNIEnv *env, jobject obj, jint key, jint mod)
{
	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->init((uint) key, (uint) mod);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KKey_isNull(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->isNull();
}

//JNIEXPORT jboolean JNICALL
//Java_org_kde_koala_KKey_isValidQt(JNIEnv *env, jobject obj)
//{
//	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->isValidQt();
//}

//JNIEXPORT jboolean JNICALL
//Java_org_kde_koala_KKey_isValidNative(JNIEnv *env, jobject obj)
//{
//	return (jboolean) ((KKey*) QtSupport::getQt(env, obj))->isValidNative();
//}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KKey_sym(JNIEnv *env, jobject obj)
{
	return (jint) ((KKey*) QtSupport::getQt(env, obj))->sym();
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KKey_modFlags(JNIEnv *env, jobject obj)
{
	return (jint) ((KKey*) QtSupport::getQt(env, obj))->modFlags();
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KKey_compare(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jint) ((KKey*) QtSupport::getQt(env, obj))->compare((KKey&) *(KKey *) QtSupport::getQt(env, arg1));
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KKey_keyCodeQt(JNIEnv *env, jobject obj)
{
	return (jint) ((KKey*) QtSupport::getQt(env, obj))->keyCodeQt();
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KKey_toString(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KKey*) QtSupport::getQt(env, obj))->toString();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KKey_toStringInternal(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KKey*) QtSupport::getQt(env, obj))->toStringInternal();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KKey_simplify(JNIEnv *env, jobject obj)
{
	((KKey*) QtSupport::getQt(env, obj))->simplify();
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KKey_null(JNIEnv *env, jclass obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)(KKey *) &KKeyJBridge::null(), "org.kde.koala.KKey");
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KKey_modFlagLabel(JNIEnv *env, jclass obj, jint arg1)
{
	QString  _qstring;
	_qstring = KKeyJBridge::modFlagLabel((KKey::ModFlag) arg1);
	return QtSupport::fromQString(env, &_qstring);
}

