/***************************************************************************
                            KCompletion.cpp -  description
                             -------------------
    begin                : Sun Jan 27 16:22:17 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Jan 27 16:22:17 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 <kcompletion.h>
#include <qstring.h>
#include <qcstring.h>

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

class KCompletionJBridge : public KCompletion
{
public:
	KCompletionJBridge() : KCompletion() {}
	~KCompletionJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_postProcessMatch(QString* arg1) {
		KCompletion::postProcessMatch(arg1);
		return;
	}
	void protected_postProcessMatches(QStringList* arg1) {
		KCompletion::postProcessMatches(arg1);
		return;
	}
	void protected_postProcessMatches(KCompletionMatches* arg1) {
		KCompletion::postProcessMatches(arg1);
		return;
	}
	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_koala_KCompletion_newKCompletion(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KCompletionJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KCompletion_finalize(env, obj);
	return;
}

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

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KCompletion_makeCompletion(JNIEnv *env, jobject obj, jstring string)
{
	QString  _qstring;
static QString * _qstring_string = 0;
	_qstring = ((KCompletion*) QtSupport::getQt(env, obj))->makeCompletion((QString&) * (QString *) QtSupport::toQString(env, string, &_qstring_string));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCompletion_substringCompletion(JNIEnv *env, jobject obj, jstring string)
{
	QStringList  _qlist;
static QString * _qstring_string = 0;
	_qlist = ((KCompletion*) QtSupport::getQt(env, obj))->substringCompletion((QString&) * (QString *) QtSupport::toQString(env, string, &_qstring_string));
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

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

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

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

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCompletion_items(JNIEnv *env, jobject obj)
{
	QStringList  _qlist;
	_qlist = ((KCompletion*) QtSupport::getQt(env, obj))->items();
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_setCompletionMode(JNIEnv *env, jobject obj, jint mode)
{
	((KCompletion*) QtSupport::getQt(env, obj))->setCompletionMode((KGlobalSettings::Completion) mode);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KCompletion_completionMode(JNIEnv *env, jobject obj)
{
	return (jint) ((KCompletion*) QtSupport::getQt(env, obj))->completionMode();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_setOrder(JNIEnv *env, jobject obj, jint order)
{
	((KCompletion*) QtSupport::getQt(env, obj))->setOrder((KCompletion::CompOrder) order);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KCompletion_order(JNIEnv *env, jobject obj)
{
	return (jint) ((KCompletion*) QtSupport::getQt(env, obj))->order();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_setIgnoreCase(JNIEnv *env, jobject obj, jboolean ignoreCase)
{
	((KCompletion*) QtSupport::getQt(env, obj))->setIgnoreCase((bool) ignoreCase);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KCompletion_ignoreCase(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KCompletion*) QtSupport::getQt(env, obj))->ignoreCase();
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCompletion_allMatches__(JNIEnv *env, jobject obj)
{
	QStringList  _qlist;
	_qlist = ((KCompletion*) QtSupport::getQt(env, obj))->allMatches();
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCompletion_allMatches__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring string)
{
	QStringList  _qlist;
static QString * _qstring_string = 0;
	_qlist = ((KCompletion*) QtSupport::getQt(env, obj))->allMatches((QString&) * (QString *) QtSupport::toQString(env, string, &_qstring_string));
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_KCompletion_allWeightedMatches__(JNIEnv *env, jobject obj)
//{
//	return () ((KCompletion*) QtSupport::getQt(env, obj))->allWeightedMatches();
//}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_KCompletion_allWeightedMatches__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring string)
//{
//static QString * _qstring_string = 0;
//	return () ((KCompletion*) QtSupport::getQt(env, obj))->allWeightedMatches((QString&) * (QString *) QtSupport::toQString(env, string, &_qstring_string));
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_setEnableSounds(JNIEnv *env, jobject obj, jboolean enable)
{
	((KCompletion*) QtSupport::getQt(env, obj))->setEnableSounds((bool) enable);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KCompletion_isSoundsEnabled(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KCompletion*) QtSupport::getQt(env, obj))->isSoundsEnabled();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KCompletion_hasMultipleMatches(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KCompletion*) QtSupport::getQt(env, obj))->hasMultipleMatches();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_enableSounds(JNIEnv *env, jobject obj)
{
	((KCompletion*) QtSupport::getQt(env, obj))->enableSounds();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_disableSounds(JNIEnv *env, jobject obj)
{
	((KCompletion*) QtSupport::getQt(env, obj))->disableSounds();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_slotMakeCompletion(JNIEnv *env, jobject obj, jstring string)
{
static QString * _qstring_string = 0;
	((KCompletion*) QtSupport::getQt(env, obj))->slotMakeCompletion((QString&) * (QString *) QtSupport::toQString(env, string, &_qstring_string));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_slotPreviousMatch(JNIEnv *env, jobject obj)
{
	((KCompletion*) QtSupport::getQt(env, obj))->slotPreviousMatch();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_slotNextMatch(JNIEnv *env, jobject obj)
{
	((KCompletion*) QtSupport::getQt(env, obj))->slotNextMatch();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_insertItems(JNIEnv *env, jobject obj, jobjectArray items)
{
static QStringList * _qlist_items = 0;
	((KCompletion*) QtSupport::getQt(env, obj))->insertItems((QStringList&) * (QStringList *) QtSupport::toQStringList(env, items, &_qlist_items));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_setItems(JNIEnv *env, jobject obj, jobjectArray arg1)
{
static QStringList * _qlist_arg1 = 0;
	((KCompletion*) QtSupport::getQt(env, obj))->setItems((QStringList&) * (QStringList *) QtSupport::toQStringList(env, arg1, &_qlist_arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_addItem__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	((KCompletion*) QtSupport::getQt(env, obj))->addItem((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_addItem__Ljava_lang_String_2I(JNIEnv *env, jobject obj, jstring arg1, jint weight)
{
static QString * _qstring_arg1 = 0;
	((KCompletion*) QtSupport::getQt(env, obj))->addItem((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1), (uint) weight);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_removeItem(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	((KCompletion*) QtSupport::getQt(env, obj))->removeItem((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_postProcessMatch(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	((KCompletionJBridge*) QtSupport::getQt(env, obj))->protected_postProcessMatch((QString*) QtSupport::toQString(env, arg1, &_qstring_arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCompletion_postProcessMatches(JNIEnv *env, jobject obj, jobjectArray arg1)
{
static QStringList * _qlist_arg1 = 0;
	((KCompletionJBridge*) QtSupport::getQt(env, obj))->protected_postProcessMatches((QStringList*) QtSupport::toQStringList(env, arg1, &_qlist_arg1));
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KCompletion_postProcessMatches__(JNIEnv *env, jobject obj, j arg1)
//{
//	((KCompletionJBridge*) QtSupport::getQt(env, obj))->protected_postProcessMatches((KCompletionMatches*) arg1);
//	return;
//}

