/***************************************************************************
                            Part.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 <kparts/part.h>
#include <qstring.h>
#include <qcstring.h>

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

class PartJBridge : public KParts::Part
{
public:
	PartJBridge(QObject* parent, const char* name) : Part(parent, name) {}
	~PartJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_setWidget(QWidget* widget) {
		Part::setWidget(widget);
		return;
	}
	 bool  protected_event(QEvent* event) {
		return ( bool ) Part::event(event);
	}
	void protected_setInstance(KInstance * instance) {
		Part::setInstance(instance);
		return;
	}
	void protected_setInstance(KInstance * instance, bool yn) {
		Part::setInstance(instance, yn);
		return;
	}
	void protected_setXMLFile(const QString& file, bool merge, bool setXMLDoc) {
		KParts::Part::setXMLFile(file, merge, setXMLDoc);
		return;
	}
	void protected_setLocalXMLFile(const QString& file) {
		KParts::Part::setLocalXMLFile(file);
		return;
	}
	void protected_setXML(const QString& document, bool merge) {
		KParts::Part::setXML(document, merge);
		return;
	}
	void protected_setDOMDocument(const QDomDocument& document, bool merge) {
		KParts::Part::setDOMDocument(document, merge);
		return;
	}
	void protected_conserveMemory() {
		KParts::Part::conserveMemory();
		return;
	}
	void protected_stateChanged(const QString& newstate) {
		KParts::Part::stateChanged(newstate);
		return;
	}	
	void protected_customEvent(QCustomEvent* event) {
		Part::customEvent(event);
		return;
	}
	void protected_partActivateEvent(KParts::PartActivateEvent* event) {
		Part::partActivateEvent(event);
		return;
	}
	void protected_partSelectEvent(KParts::PartSelectEvent* event) {
		Part::partSelectEvent(event);
		return;
	}
	void protected_guiActivateEvent(KParts::GUIActivateEvent* event) {
		Part::guiActivateEvent(event);
		return;
	}
	QWidget * protected_hostContainer(const QString& containerName) {
		return (QWidget *) Part::hostContainer(containerName);
	}
	void partActivateEvent(KParts::PartActivateEvent* event) {
		if (! QtSupport::eventDelegate(this, "partActivateEvent", event, "org.kde.koala.PartActivateEvent")) {
			Part::partActivateEvent(event);
		}
		return;
	}
	void partSelectEvent(KParts::PartSelectEvent* event) {
		if (! QtSupport::eventDelegate(this, "partSelectEvent", event, "org.kde.koala.PartSelectEvent")) {
			Part::partSelectEvent(event);
		}
		return;
	}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(arg1);
		}
		return;
	}
	void customEvent(QCustomEvent* event) {
		if (! QtSupport::eventDelegate(this, "customEvent", event, "org.kde.qt.QCustomEvent")) {
			Part::customEvent(event);
		}
		return;
	}
	void guiActivateEvent(KParts::GUIActivateEvent* event) {
		if (! QtSupport::eventDelegate(this, "guiActivateEvent", event, "org.kde.koala.GUIActivateEvent")) {
			Part::guiActivateEvent(event);
		}
		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_Part_newPart__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 PartJBridge((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_Part_newPart__(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new PartJBridge(0, 0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_Part_finalize(env, obj);
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_embed(JNIEnv *env, jobject obj, jobject parentWidget)
{
	((KParts::Part*) QtSupport::getQt(env, obj))->embed((QWidget*) QtSupport::getQt(env, parentWidget));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_widget(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KParts::Part*) QtSupport::getQt(env, obj))->widget(), "org.kde.qt.QWidget");
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setManager(JNIEnv *env, jobject obj, jobject manager)
{
	((KParts::Part*) QtSupport::getQt(env, obj))->setManager((KParts::PartManager*) QtSupport::getQt(env, manager));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_manager(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KParts::Part*) QtSupport::getQt(env, obj))->manager(), "org.kde.koala.PartManager");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_hitTest(JNIEnv *env, jobject obj, jobject widget, jobject globalPos)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KParts::Part*) QtSupport::getQt(env, obj))->hitTest((QWidget*) QtSupport::getQt(env, widget), (QPoint&) *(QPoint *) QtSupport::getQt(env, globalPos)), "org.kde.koala.Part");
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setSelectable(JNIEnv *env, jobject obj, jboolean selectable)
{
	((KParts::Part*) QtSupport::getQt(env, obj))->setSelectable((bool) selectable);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Part_isSelectable(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KParts::Part*) QtSupport::getQt(env, obj))->isSelectable();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setWidget(JNIEnv *env, jobject obj, jobject widget)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setWidget((QWidget*) QtSupport::getQt(env, widget));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Part_event(JNIEnv *env, jobject obj, jobject event)
{
	return (jboolean) ((PartJBridge*) QtSupport::getQt(env, obj))->protected_event((QEvent*) QtSupport::getQt(env, event));
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_customEvent(JNIEnv *env, jobject obj, jobject event)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_customEvent((QCustomEvent*) QtSupport::getQt(env, event));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_partActivateEvent(JNIEnv *env, jobject obj, jobject event)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_partActivateEvent((KParts::PartActivateEvent*) QtSupport::getQt(env, event));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_partSelectEvent(JNIEnv *env, jobject obj, jobject event)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_partSelectEvent((KParts::PartSelectEvent*) QtSupport::getQt(env, event));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_guiActivateEvent(JNIEnv *env, jobject obj, jobject event)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_guiActivateEvent((KParts::GUIActivateEvent*) QtSupport::getQt(env, event));
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setInstance__Lorg_kde_koala_KInstanceInterface_2(JNIEnv *env, jobject obj, jobject instance)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setInstance((KInstance*) QtSupport::getQt(env, instance));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setInstance__Lorg_kde_koala_KInstanceInterface_2Z(JNIEnv *env, jobject obj, jobject instance, jboolean loadPlugins)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setInstance((KInstance*) QtSupport::getQt(env, instance), (bool) loadPlugins);
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_action__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring name)
{
static QCString * _qstring_name = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)((PartJBridge*) QtSupport::getQt(env, obj))->action((char*) QtSupport::toCharString(env, name, &_qstring_name)), "org.kde.koala.KAction");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_action__Lorg_kde_qt_QDomElement_2(JNIEnv *env, jobject obj, jobject element)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((PartJBridge*) QtSupport::getQt(env, obj))->action((QDomElement&) *(QDomElement *) QtSupport::getQt(env, element)), "org.kde.koala.KAction");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_actionCollection(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((PartJBridge*) QtSupport::getQt(env, obj))->actionCollection(), "org.kde.koala.KActionCollection");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_instance(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((PartJBridge*) QtSupport::getQt(env, obj))->instance(), "org.kde.koala.KInstanceInterface");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_domDocument(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new  QDomDocument (((PartJBridge*) QtSupport::getQt(env, obj))->domDocument()), "org.kde.qt.QDomDocument", TRUE);
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setXMLGUIBuildDocument(JNIEnv *env, jobject obj, jobject doc)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->setXMLGUIBuildDocument((QDomDocument&) *(QDomDocument *) QtSupport::getQt(env, doc));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_xmlguiBuildDocument(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QDomDocument (((PartJBridge*) QtSupport::getQt(env, obj))->xmlguiBuildDocument()), "org.kde.qt.QDomDocument", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setFactory(JNIEnv *env, jobject obj, jobject factory)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->setFactory((KXMLGUIFactory*) QtSupport::getQt(env, factory));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_factory(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((PartJBridge*) QtSupport::getQt(env, obj))->factory(), "org.kde.koala.KXMLGUIFactory");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_parentClient(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((PartJBridge*) QtSupport::getQt(env, obj))->parentClient(), "org.kde.koala.PartInterface");
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_insertChildClient(JNIEnv *env, jobject obj, jobject child)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->insertChildClient((PartJBridge*) QtSupport::getQt(env, child));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_removeChildClient(JNIEnv *env, jobject obj, jobject child)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->removeChildClient((PartJBridge*) QtSupport::getQt(env, child));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setClientBuilder(JNIEnv *env, jobject obj, jobject builder)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->setClientBuilder((KXMLGUIBuilder*) QtSupport::getQt(env, builder));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Part_clientBuilder(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((PartJBridge*) QtSupport::getQt(env, obj))->clientBuilder(), "org.kde.koala.KXMLGUIBuilderInterface");
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_reloadXML(JNIEnv *env, jobject obj)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->reloadXML();
	return;
}

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

JNIEXPORT jstring JNICALL
Java_org_kde_koala_Part_findMostRecentXMLFile(JNIEnv *env, jclass obj, jobjectArray files, jstring doc)
{
	QString  _qstring;
static QString * _qstring_doc = 0;
static QStringList * _qlist_files = 0;
	_qstring = PartJBridge::findMostRecentXMLFile((QStringList&) * (QStringList *) QtSupport::toQStringList(env, files, &_qlist_files), (QString&) * (QString *) QtSupport::toQString(env, doc, &_qstring_doc));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setInstance(JNIEnv *env, jobject obj, jobject instance)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setInstance((KInstance*) QtSupport::getQt(env, instance));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setXMLFile__Ljava_lang_String_2ZZ(JNIEnv *env, jobject obj, jstring file, jboolean merge, jboolean setXMLDoc)
{
static QString * _qstring_file = 0;
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setXMLFile((QString&) * (QString *) QtSupport::toQString(env, file, &_qstring_file), (bool) merge, (bool) setXMLDoc);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setXMLFile__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring file)
{
static QString * _qstring_file = 0;
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setXMLFile((QString&) * (QString *) QtSupport::toQString(env, file, &_qstring_file), false, true);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setLocalXMLFile(JNIEnv *env, jobject obj, jstring file)
{
static QString * _qstring_file = 0;
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setLocalXMLFile((QString&) * (QString *) QtSupport::toQString(env, file, &_qstring_file));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setXML__Ljava_lang_String_2Z(JNIEnv *env, jobject obj, jstring document, jboolean merge)
{
static QString * _qstring_document = 0;
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setXML((QString&) * (QString *) QtSupport::toQString(env, document, &_qstring_document), (bool) merge);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setXML__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring document)
{
static QString * _qstring_document = 0;
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setXML((QString&) * (QString *) QtSupport::toQString(env, document, &_qstring_document), false);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setDOMDocument__Lorg_kde_qt_QDomDocument_2Z(JNIEnv *env, jobject obj, jobject document, jboolean merge)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setDOMDocument((QDomDocument&) *(QDomDocument *) QtSupport::getQt(env, document), (bool) merge);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_setDOMDocument__Lorg_kde_qt_QDomDocument_2(JNIEnv *env, jobject obj, jobject document)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_setDOMDocument((QDomDocument&) *(QDomDocument *) QtSupport::getQt(env, document), false);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_conserveMemory(JNIEnv *env, jobject obj)
{
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_conserveMemory();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_addStateActionEnabled(JNIEnv *env, jobject obj, jstring state, jstring action)
{
static QString * _qstring_action = 0;
static QString * _qstring_state = 0;
	((KXMLGUIClient *) (KParts::Part*) QtSupport::getQt(env, obj))->addStateActionEnabled((QString&) * (QString *) QtSupport::toQString(env, state, &_qstring_state), (QString&) * (QString *) QtSupport::toQString(env, action, &_qstring_action));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_addStateActionDisabled(JNIEnv *env, jobject obj, jstring state, jstring action)
{
static QString * _qstring_action = 0;
static QString * _qstring_state = 0;
	((KXMLGUIClient *) (KParts::Part *) QtSupport::getQt(env, obj))->addStateActionDisabled((QString&) * (QString *) QtSupport::toQString(env, state, &_qstring_state), (QString&) * (QString *) QtSupport::toQString(env, action, &_qstring_action));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Part_stateChanged(JNIEnv *env, jobject obj, jstring newstate)
{
static QString * _qstring_newstate = 0;
	((PartJBridge*) QtSupport::getQt(env, obj))->protected_stateChanged((QString&) * (QString *) QtSupport::toQString(env, newstate, &_qstring_newstate));
	return;
}

