/***************************************************************************
                            BrowserExtension.cpp -  description
                             -------------------
    begin                : Sun Aug 26 09:45:02 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Aug 26 09:45:02 2001, using kdoc parser/custom Java conversion backend.
 ***************************************************************************/

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

#include <qtjava/QtSupport.h>
#include <kdejava/BrowserExtension.h>

class BrowserExtensionJBridge : public KParts::BrowserExtension
{
public:
	BrowserExtensionJBridge(KParts::ReadOnlyPart* parent, const char* name) : BrowserExtension(parent, name) {}
	~BrowserExtensionJBridge() {QtSupport::qtKeyDeleted(this);}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(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_BrowserExtension_newBrowserExtension__Lorg_kde_koala_ReadOnlyPart_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 BrowserExtensionJBridge((KParts::ReadOnlyPart*) 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_BrowserExtension_newBrowserExtension__Lorg_kde_koala_ReadOnlyPart_2(JNIEnv *env, jobject obj, jobject parent)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new BrowserExtensionJBridge((KParts::ReadOnlyPart*) QtSupport::getQt(env, parent), 0L));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_BrowserExtension_setURLArgs(JNIEnv *env, jobject obj, jobject args)
{
	((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->setURLArgs((KParts::URLArgs&) *(KParts::URLArgs *) QtSupport::getQt(env, args));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_BrowserExtension_urlArgs(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new  KParts::URLArgs (((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->urlArgs()), "org.kde.koala.URLArgs", TRUE);
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_BrowserExtension_xOffset(JNIEnv *env, jobject obj)
{
	return (jint) ((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->xOffset();
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_BrowserExtension_yOffset(JNIEnv *env, jobject obj)
{
	return (jint) ((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->yOffset();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_BrowserExtension_saveState(JNIEnv *env, jobject obj, jobject stream)
{
	((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->saveState((QDataStream&) *(QDataStream *) QtSupport::getQt(env, stream));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_BrowserExtension_restoreState(JNIEnv *env, jobject obj, jobject stream)
{
	((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->restoreState((QDataStream&) *(QDataStream *) QtSupport::getQt(env, stream));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_BrowserExtension_isURLDropHandlingEnabled(JNIEnv *env, jobject obj)
{
	return (jboolean) ((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->isURLDropHandlingEnabled();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_BrowserExtension_setURLDropHandlingEnabled(JNIEnv *env, jobject obj, jboolean enable)
{
	((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->setURLDropHandlingEnabled((bool) enable);
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_BrowserExtension_setBrowserInterface(JNIEnv *env, jobject obj, j impl)
//{
//	((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->setBrowserInterface((BrowserInterface*) impl);
//	return;
//}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_BrowserExtension_browserInterface(JNIEnv *env, jobject obj)
//{
//	return () ((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->browserInterface();
//}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_BrowserExtension_isActionEnabled(JNIEnv *env, jobject obj, jstring name)
{
static QCString * _qstring_name = 0;
	return (jboolean) ((BrowserExtensionJBridge*) QtSupport::getQt(env, obj))->isActionEnabled((char*) QtSupport::toCharString(env, name, &_qstring_name));
}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_BrowserExtension_actionSlotMap(JNIEnv *env, jclass obj)
//{
//	return () BrowserExtensionJBridge::actionSlotMap();
//}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_BrowserExtension_actionSlotMapPtr(JNIEnv *env, jclass obj)
//{
//	return () BrowserExtensionJBridge::actionSlotMapPtr();
//}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_BrowserExtension_childObject(JNIEnv *env, jclass obj, jobject _obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)BrowserExtensionJBridge::childObject((QObject*) QtSupport::getQt(env, _obj)), "org.kde.koala.BrowserExtension");
}

