/***************************************************************************
                            HTMLCollection.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 <dom/html_misc.h>
#include <dom/dom_string.h>
#include <qstring.h>
#include <qcstring.h>

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

class HTMLCollectionJBridge : public DOM::HTMLCollection
{
public:
	HTMLCollectionJBridge() : DOM::HTMLCollection() {}
	HTMLCollectionJBridge(const DOM::HTMLCollection& other) : DOM::HTMLCollection(other) {}
	~HTMLCollectionJBridge() {QtSupport::qtKeyDeleted(this);}
	HTMLCollectionJBridge(DOM::NodeImpl* base, int type) : DOM::HTMLCollection(base, type) {}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLCollection_newHTMLCollection__(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new HTMLCollectionJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLCollection_newHTMLCollection__Lorg_kde_koala_HTMLCollection_2(JNIEnv *env, jobject obj, jobject other)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new HTMLCollectionJBridge((DOM::HTMLCollection&) *(DOM::HTMLCollection *) QtSupport::getQt(env, other)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLCollection_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (DOM::HTMLCollection*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT jlong JNICALL
Java_org_kde_koala_HTMLCollection_length(JNIEnv *env, jobject obj)
{
	return (jlong) ((HTMLCollectionJBridge*) QtSupport::getQt(env, obj))->length();
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLCollection_item(JNIEnv *env, jobject obj, jlong index)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::Node (((HTMLCollectionJBridge*) QtSupport::getQt(env, obj))->item((unsigned long) index)), "org.kde.koala.DOMNode", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLCollection_namedItem(JNIEnv *env, jobject obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::Node (((HTMLCollectionJBridge*) QtSupport::getQt(env, obj))->namedItem((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name))), "org.kde.koala.DOMNode", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLCollection_base(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::Node (((HTMLCollectionJBridge*) QtSupport::getQt(env, obj))->base()), "org.kde.koala.DOMNode", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLCollection_handle(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((HTMLCollectionJBridge*) QtSupport::getQt(env, obj))->handle(), "org.kde.koala.HTMLCollectionImpl");
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_HTMLCollection_isNull(JNIEnv *env, jobject obj)
{
	return (jboolean) ((HTMLCollectionJBridge*) QtSupport::getQt(env, obj))->isNull();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLCollection_newHTMLCollection__Lorg_kde_koala_NodeImpl_2I(JNIEnv *env, jobject obj, jobject base, jint type)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new HTMLCollectionJBridge((DOM::NodeImpl*) QtSupport::getQt(env, base), (int) type));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

