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

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

class PartManagerJBridge : public KParts::PartManager
{
public:
	PartManagerJBridge(QWidget* parent, const char* name) : PartManager(parent, name) {}
	PartManagerJBridge(QWidget* topLevel, QObject* parent, const char* name) : PartManager(topLevel, parent, name) {}
	~PartManagerJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_setActiveInstance(KInstance* instance) {
		PartManager::setActiveInstance(instance);
		return;
	}
	void protected_slotObjectDestroyed() {
		PartManager::slotObjectDestroyed();
		return;
	}
	void protected_slotWidgetDestroyed() {
		PartManager::slotWidgetDestroyed();
		return;
	}
	void protected_slotManagedTopLevelWidgetDestroyed() {
		PartManager::slotManagedTopLevelWidgetDestroyed();
		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_PartManager_newPartManager__Lorg_kde_qt_QWidget_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 PartManagerJBridge((QWidget*) 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_PartManager_newPartManager__Lorg_kde_qt_QWidget_2(JNIEnv *env, jobject obj, jobject parent)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new PartManagerJBridge((QWidget*) QtSupport::getQt(env, parent), 0L));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_newPartManager__Lorg_kde_qt_QWidget_2Lorg_kde_qt_QObject_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject topLevel, jobject parent, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new PartManagerJBridge((QWidget*) QtSupport::getQt(env, topLevel), (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_PartManager_newPartManager__Lorg_kde_qt_QWidget_2Lorg_kde_qt_QObject_2(JNIEnv *env, jobject obj, jobject topLevel, jobject parent)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new PartManagerJBridge((QWidget*) QtSupport::getQt(env, topLevel), (QObject*) QtSupport::getQt(env, parent), 0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_PartManager_finalize(env, obj);
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_setSelectionPolicy(JNIEnv *env, jobject obj, jint policy)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->setSelectionPolicy((KParts::PartManager::SelectionPolicy) policy);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_PartManager_selectionPolicy(JNIEnv *env, jobject obj)
{
	return (jint) ((KParts::PartManager*) QtSupport::getQt(env, obj))->selectionPolicy();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_setAllowNestedParts(JNIEnv *env, jobject obj, jboolean allow)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->setAllowNestedParts((bool) allow);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_PartManager_allowNestedParts(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KParts::PartManager*) QtSupport::getQt(env, obj))->allowNestedParts();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_setIgnoreScrollBars(JNIEnv *env, jobject obj, jboolean ignore)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->setIgnoreScrollBars((bool) ignore);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_PartManager_ignoreScrollBars(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KParts::PartManager*) QtSupport::getQt(env, obj))->ignoreScrollBars();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_PartManager_eventFilter(JNIEnv *env, jobject obj, jobject _obj, jobject ev)
{
	return (jboolean) ((KParts::PartManager*) QtSupport::getQt(env, obj))->eventFilter((QObject*) QtSupport::getQt(env, _obj), (QEvent*) QtSupport::getQt(env, ev));
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_addPart__Lorg_kde_koala_Part_2Z(JNIEnv *env, jobject obj, jobject part, jboolean setActive)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->addPart((KParts::Part*) QtSupport::getQt(env, part), (bool) setActive);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_addPart__Lorg_kde_koala_Part_2(JNIEnv *env, jobject obj, jobject part)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->addPart((KParts::Part*) QtSupport::getQt(env, part), true);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_removePart(JNIEnv *env, jobject obj, jobject part)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->removePart((KParts::Part*) QtSupport::getQt(env, part));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_replacePart__Lorg_kde_koala_Part_2Lorg_kde_koala_Part_2Z(JNIEnv *env, jobject obj, jobject oldPart, jobject newPart, jboolean setActive)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->replacePart((KParts::Part*) QtSupport::getQt(env, oldPart), (KParts::Part*) QtSupport::getQt(env, newPart), (bool) setActive);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_replacePart__Lorg_kde_koala_Part_2Lorg_kde_koala_Part_2(JNIEnv *env, jobject obj, jobject oldPart, jobject newPart)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->replacePart((KParts::Part*) QtSupport::getQt(env, oldPart), (KParts::Part*) QtSupport::getQt(env, newPart), true);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_setActivePart__Lorg_kde_koala_Part_2Lorg_kde_qt_QWidget_2(JNIEnv *env, jobject obj, jobject part, jobject widget)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->setActivePart((KParts::Part*) QtSupport::getQt(env, part), (QWidget*) QtSupport::getQt(env, widget));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_setActivePart__Lorg_kde_koala_Part_2(JNIEnv *env, jobject obj, jobject part)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->setActivePart((KParts::Part*) QtSupport::getQt(env, part), 0L);
	return;
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_setSelectedPart__Lorg_kde_koala_Part_2Lorg_kde_qt_QWidget_2(JNIEnv *env, jobject obj, jobject part, jobject widget)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->setSelectedPart((KParts::Part*) QtSupport::getQt(env, part), (QWidget*) QtSupport::getQt(env, widget));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_setSelectedPart__Lorg_kde_koala_Part_2(JNIEnv *env, jobject obj, jobject part)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->setSelectedPart((KParts::Part*) QtSupport::getQt(env, part), 0L);
	return;
}

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

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

//JNIEXPORT  JNICALL
//Java_org_kde_koala_PartManager_parts(JNIEnv *env, jobject obj)
//{
//	return () ((KParts::PartManager*) QtSupport::getQt(env, obj))->parts();
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_addManagedTopLevelWidget(JNIEnv *env, jobject obj, jobject topLevel)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->addManagedTopLevelWidget((QWidget*) QtSupport::getQt(env, topLevel));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_removeManagedTopLevelWidget(JNIEnv *env, jobject obj, jobject topLevel)
{
	((KParts::PartManager*) QtSupport::getQt(env, obj))->removeManagedTopLevelWidget((QWidget*) QtSupport::getQt(env, topLevel));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_setActiveInstance(JNIEnv *env, jobject obj, jobject instance)
{
	((PartManagerJBridge*) QtSupport::getQt(env, obj))->protected_setActiveInstance((KInstance*) QtSupport::getQt(env, instance));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_slotObjectDestroyed(JNIEnv *env, jobject obj)
{
	((PartManagerJBridge*) QtSupport::getQt(env, obj))->protected_slotObjectDestroyed();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_slotWidgetDestroyed(JNIEnv *env, jobject obj)
{
	((PartManagerJBridge*) QtSupport::getQt(env, obj))->protected_slotWidgetDestroyed();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_PartManager_slotManagedTopLevelWidgetDestroyed(JNIEnv *env, jobject obj)
{
	((PartManagerJBridge*) QtSupport::getQt(env, obj))->protected_slotManagedTopLevelWidgetDestroyed();
	return;
}

