/***************************************************************************
                            KShortcut.cpp -  description
                             -------------------
    begin                : Fri Nov 15 11:45:52 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Nov 15 11:45:52 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library 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/KShortcut.h>

class KShortcutJBridge : public KShortcut
{
public:
	KShortcutJBridge() : KShortcut() {}
	KShortcutJBridge(int keyQt) : KShortcut(keyQt) {}
	KShortcutJBridge(const QKeySequence& keySeq) : KShortcut(keySeq) {}
	KShortcutJBridge(const KKey& key) : KShortcut(key) {}
	KShortcutJBridge(const KKeySequence& keySeq) : KShortcut(keySeq) {}
	KShortcutJBridge(const KShortcut& shortcut) : KShortcut(shortcut) {}
	KShortcutJBridge(const char* shortcut) : KShortcut(shortcut) {}
	KShortcutJBridge(const QString& shortcut) : KShortcut(shortcut) {}
	~KShortcutJBridge() {QtSupport::qtKeyDeleted(this);}
};


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

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

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KShortcut_newKShortcut__Lorg_kde_koala_KKeySequence_2(JNIEnv *env, jobject obj, jobject keySeq)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KShortcutJBridge((KKeySequence&) *(KKeySequence *) QtSupport::getQt(env, keySeq)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KShortcut_newKShortcut__Lorg_kde_koala_KShortcut_2(JNIEnv *env, jobject obj, jobject shortcut)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KShortcutJBridge((KShortcut&) *(KShortcut *) QtSupport::getQt(env, shortcut)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KShortcut_newKShortcut__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring shortcut)
{
static QCString * _qstring_shortcut = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KShortcutJBridge((char*) QtSupport::toCharString(env, shortcut, &_qstring_shortcut)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KShortcut_newKShortcut__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring shortcut)
//{
//static QString * _qstring_shortcut = 0;
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new KShortcutJBridge((QString&) * (QString *) QtSupport::toQString(env, shortcut, &_qstring_shortcut)));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KShortcut_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KShortcut_finalize(env, obj);
	return;
}

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

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

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

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_init__Lorg_kde_qt_QKeySequence_2(JNIEnv *env, jobject obj, jobject keySeq)
{
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->init((QKeySequence&) *(QKeySequence *) QtSupport::getQt(env, keySeq));
}

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

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_init__Lorg_kde_koala_KKeySequence_2(JNIEnv *env, jobject obj, jobject keySeq)
{
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->init((KKeySequence&) *(KKeySequence *) QtSupport::getQt(env, keySeq));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_init__Lorg_kde_koala_KShortcut_2(JNIEnv *env, jobject obj, jobject shortcut)
{
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->init((KShortcut&) *(KShortcut *) QtSupport::getQt(env, shortcut));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_init__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring shortcut)
{
static QString * _qstring_shortcut = 0;
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->init((QString&) * (QString *) QtSupport::toQString(env, shortcut, &_qstring_shortcut));
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KShortcut_count(JNIEnv *env, jobject obj)
{
	return (jint) ((KShortcut*) QtSupport::getQt(env, obj))->count();
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KShortcut_seq(JNIEnv *env, jobject obj, jint i)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)(KKeySequence *) &((KShortcut*) QtSupport::getQt(env, obj))->seq((uint) i), "org.kde.koala.KKeySequence");
}

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

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

JNIEXPORT jint JNICALL
Java_org_kde_koala_KShortcut_compare(JNIEnv *env, jobject obj, jobject shortcut)
{
	return (jint) ((KShortcut*) QtSupport::getQt(env, obj))->compare((KShortcut&) *(KShortcut *) QtSupport::getQt(env, shortcut));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_contains__Lorg_kde_koala_KKey_2(JNIEnv *env, jobject obj, jobject key)
{
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->contains((KKey&) *(KKey *) QtSupport::getQt(env, key));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_contains__Lorg_kde_koala_KKeyNative_2(JNIEnv *env, jobject obj, jobject key)
{
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->contains((KKeyNative&) *(KKeyNative *) QtSupport::getQt(env, key));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_contains__Lorg_kde_koala_KKeySequence_2(JNIEnv *env, jobject obj, jobject keySeq)
{
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->contains((KKeySequence&) *(KKeySequence *) QtSupport::getQt(env, keySeq));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_setSeq(JNIEnv *env, jobject obj, jint i, jobject keySeq)
{
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->setSeq((uint) i, (KKeySequence&) *(KKeySequence *) QtSupport::getQt(env, keySeq));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KShortcut_append(JNIEnv *env, jobject obj, jobject keySeq)
{
	return (jboolean) ((KShortcut*) QtSupport::getQt(env, obj))->append((KKeySequence&) *(KKeySequence *) QtSupport::getQt(env, keySeq));
}

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

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

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

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

