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

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

class KXMLGUIFactoryJBridge : public KXMLGUIFactory
{
public:
	KXMLGUIFactoryJBridge(KXMLGUIBuilder* builder, QObject* parent, const char* name) : KXMLGUIFactory(builder, parent, name) {}
	~KXMLGUIFactoryJBridge() {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_koala_KXMLGUIFactory_newKXMLGUIFactory__Lorg_kde_koala_KXMLGUIBuilderInterface_2Lorg_kde_qt_QObject_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject builder, jobject parent, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KXMLGUIFactoryJBridge((KXMLGUIBuilder*) QtSupport::getQt(env, builder), (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_koala_KXMLGUIFactory_newKXMLGUIFactory__Lorg_kde_koala_KXMLGUIBuilderInterface_2(JNIEnv *env, jobject obj, jobject builder)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KXMLGUIFactoryJBridge((KXMLGUIBuilder*) QtSupport::getQt(env, builder), 0, 0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KXMLGUIFactory_finalize(env, obj);
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_addClient(JNIEnv *env, jobject obj, jobject client)
{
	((KXMLGUIFactory*) QtSupport::getQt(env, obj))->addClient((KXMLGUIClient*) QtSupport::getQt(env, client));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_removeClient(JNIEnv *env, jobject obj, jobject client)
{
	((KXMLGUIFactory*) QtSupport::getQt(env, obj))->removeClient((KXMLGUIClient*) QtSupport::getQt(env, client));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_plugActionList(JNIEnv *env, jobject obj, jobject client, jstring name, jobject actionList)
{
static QString * _qstring_name = 0;
	((KXMLGUIFactory*) QtSupport::getQt(env, obj))->plugActionList((KXMLGUIClient*) QtSupport::getQt(env, client), (QString&) * (QString *) QtSupport::toQString(env, name, &_qstring_name), (QPtrList<KAction>&) *(QPtrList<KAction> *) QtSupport::getQt(env, actionList));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_unplugActionList(JNIEnv *env, jobject obj, jobject client, jstring name)
{
static QString * _qstring_name = 0;
	((KXMLGUIFactory*) QtSupport::getQt(env, obj))->unplugActionList((KXMLGUIClient*) QtSupport::getQt(env, client), (QString&) * (QString *) QtSupport::toQString(env, name, &_qstring_name));
	return;
}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_KXMLGUIFactory_clients(JNIEnv *env, jobject obj)
//{
//	return () ((KXMLGUIFactory*) QtSupport::getQt(env, obj))->clients();
//}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KXMLGUIFactory_container__Ljava_lang_String_2Lorg_kde_koala_KXMLGUIClientInterface_2Z(JNIEnv *env, jobject obj, jstring containerName, jobject client, jboolean useTagName)
{
static QString * _qstring_containerName = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KXMLGUIFactory*) QtSupport::getQt(env, obj))->container((QString&) * (QString *) QtSupport::toQString(env, containerName, &_qstring_containerName), (KXMLGUIClient*) QtSupport::getQt(env, client), (bool) useTagName), "org.kde.qt.QWidget");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KXMLGUIFactory_container__Ljava_lang_String_2Lorg_kde_koala_KXMLGUIClientInterface_2(JNIEnv *env, jobject obj, jstring containerName, jobject client)
{
static QString * _qstring_containerName = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KXMLGUIFactory*) QtSupport::getQt(env, obj))->container((QString&) * (QString *) QtSupport::toQString(env, containerName, &_qstring_containerName), (KXMLGUIClient*) QtSupport::getQt(env, client), false), "org.kde.qt.QWidget");
}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_KXMLGUIFactory_containers(JNIEnv *env, jobject obj, jstring tagName)
//{
//static QString * _qstring_tagName = 0;
//	return () ((KXMLGUIFactory*) QtSupport::getQt(env, obj))->containers((QString&) * (QString *) QtSupport::toQString(env, tagName, &_qstring_tagName));
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_reset(JNIEnv *env, jobject obj)
{
	((KXMLGUIFactory*) QtSupport::getQt(env, obj))->reset();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_resetContainer__Ljava_lang_String_2Z(JNIEnv *env, jobject obj, jstring containerName, jboolean useTagName)
{
static QString * _qstring_containerName = 0;
	((KXMLGUIFactory*) QtSupport::getQt(env, obj))->resetContainer((QString&) * (QString *) QtSupport::toQString(env, containerName, &_qstring_containerName), (bool) useTagName);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_resetContainer__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring containerName)
{
static QString * _qstring_containerName = 0;
	((KXMLGUIFactory*) QtSupport::getQt(env, obj))->resetContainer((QString&) * (QString *) QtSupport::toQString(env, containerName, &_qstring_containerName), false);
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KXMLGUIFactory_readConfigFile__Ljava_lang_String_2ZLorg_kde_koala_KInstanceInterface_2(JNIEnv *env, jclass obj, jstring filename, jboolean never_null, jobject instance)
{
	QString  _qstring;
static QString * _qstring_filename = 0;
	_qstring = KXMLGUIFactoryJBridge::readConfigFile((QString&) * (QString *) QtSupport::toQString(env, filename, &_qstring_filename), (bool) never_null, (KInstance*) QtSupport::getQt(env, instance));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KXMLGUIFactory_readConfigFile__Ljava_lang_String_2Z(JNIEnv *env, jclass obj, jstring filename, jboolean never_null)
{
static QString * _qstring_filename = 0;
	QString _qstring;
	_qstring = KXMLGUIFactoryJBridge::readConfigFile((QString&) * (QString *) QtSupport::toQString(env, filename, &_qstring_filename), (bool) never_null, 0);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KXMLGUIFactory_readConfigFile__Ljava_lang_String_2Lorg_kde_koala_KInstanceInterface_2(JNIEnv *env, jclass obj, jstring filename, jobject instance)
{
	QString  _qstring;
static QString * _qstring_filename = 0;
	_qstring = KXMLGUIFactoryJBridge::readConfigFile((QString&) * (QString *) QtSupport::toQString(env, filename, &_qstring_filename), (KInstance*) QtSupport::getQt(env, instance));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KXMLGUIFactory_readConfigFile__Ljava_lang_String_2(JNIEnv *env, jclass obj, jstring filename)
{
static QString * _qstring_filename = 0;
	QString _qstring;
	_qstring = KXMLGUIFactoryJBridge::readConfigFile((QString&) * (QString *) QtSupport::toQString(env, filename, &_qstring_filename), (KInstance *)0);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KXMLGUIFactory_saveConfigFile__Lorg_kde_qt_QDomDocument_2Ljava_lang_String_2Lorg_kde_koala_KInstanceInterface_2(JNIEnv *env, jclass obj, jobject doc, jstring filename, jobject instance)
{
static QString * _qstring_filename = 0;
	return (jboolean) KXMLGUIFactoryJBridge::saveConfigFile((QDomDocument&) *(QDomDocument *) QtSupport::getQt(env, doc), (QString&) * (QString *) QtSupport::toQString(env, filename, &_qstring_filename), (KInstance*) QtSupport::getQt(env, instance));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KXMLGUIFactory_saveConfigFile__Lorg_kde_qt_QDomDocument_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jobject doc, jstring filename)
{
static QString * _qstring_filename = 0;
	return (jboolean) KXMLGUIFactoryJBridge::saveConfigFile((QDomDocument&) *(QDomDocument *) QtSupport::getQt(env, doc), (QString&) * (QString *) QtSupport::toQString(env, filename, &_qstring_filename), 0);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KXMLGUIFactory_documentToXML(JNIEnv *env, jclass obj, jobject doc)
{
	QString  _qstring;
	_qstring = KXMLGUIFactoryJBridge::documentToXML((QDomDocument&) *(QDomDocument *) QtSupport::getQt(env, doc));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KXMLGUIFactory_elementToXML(JNIEnv *env, jclass obj, jobject elem)
{
	QString  _qstring;
	_qstring = KXMLGUIFactoryJBridge::elementToXML((QDomElement&) *(QDomElement *) QtSupport::getQt(env, elem));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KXMLGUIFactory_removeDOMComments(JNIEnv *env, jclass obj, jobject node)
{
	KXMLGUIFactoryJBridge::removeDOMComments((QDomNode&) *(QDomNode *) QtSupport::getQt(env, node));
	return;
}

