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

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

class CSSStyleDeclarationJBridge : public DOM::CSSStyleDeclaration
{
public:
	CSSStyleDeclarationJBridge() : DOM::CSSStyleDeclaration() {}
	CSSStyleDeclarationJBridge(const DOM::CSSStyleDeclaration& other) : DOM::CSSStyleDeclaration(other) {}
//	CSSStyleDeclarationJBridge(DOM::CSSStyleDeclarationImpl* impl) : DOM::CSSStyleDeclaration(impl) {}
	~CSSStyleDeclarationJBridge() {QtSupport::qtKeyDeleted(this);}
};


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

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

//JNIEXPORT void JNICALL
//Java_org_kde_koala_CSSStyleDeclaration_newCSSStyleDeclaration__Lorg_kde_koala_CSSStyleDeclarationImpl_2(JNIEnv *env, jobject obj, jobject impl)
//{
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new CSSStyleDeclarationJBridge((CSSStyleDeclarationImpl*) QtSupport::getQt(env, impl)));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

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

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_cssText(JNIEnv *env, jobject obj)
{
	DOM::DOMString _domstring;
	_domstring = ((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->cssText();
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CSSStyleDeclaration_setCssText(JNIEnv *env, jobject obj, jstring arg1)
{
static DOM::DOMString * _domstring_arg1 = 0;
	((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->setCssText((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, arg1, &_domstring_arg1));
	return;
}

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

//JNIEXPORT jobject JNICALL
//Java_org_kde_koala_CSSStyleDeclaration_parentRule(JNIEnv *env, jobject obj)
//{
//	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::CSSRule (((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->parentRule()), "org.kde.koala.CSSRule", TRUE);
//}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_getPropertyValue(JNIEnv *env, jobject obj, jstring propertyName)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_propertyName = 0;
	_domstring = ((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->getPropertyValue((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_CSSStyleDeclaration_getPropertyCSSValue(JNIEnv *env, jobject obj, jstring propertyName)
{
static DOM::DOMString * _domstring_propertyName = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::CSSValue (((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->getPropertyCSSValue((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName))), "org.kde.koala.CSSValue", TRUE);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_removeProperty(JNIEnv *env, jobject obj, jstring propertyName)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_propertyName = 0;
	_domstring = ((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->removeProperty((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_getPropertyPriority(JNIEnv *env, jobject obj, jstring propertyName)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_propertyName = 0;
	_domstring = ((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->getPropertyPriority((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CSSStyleDeclaration_setProperty(JNIEnv *env, jobject obj, jstring propertyName, jstring value, jstring priority)
{
static DOM::DOMString * _domstring_priority = 0;
static DOM::DOMString * _domstring_value = 0;
static DOM::DOMString * _domstring_propertyName = 0;
	((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->setProperty((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, value, &_domstring_value), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, priority, &_domstring_priority));
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_item(JNIEnv *env, jobject obj, jlong index)
{
	DOM::DOMString _domstring;
	_domstring = ((CSSStyleDeclarationJBridge*) QtSupport::getQt(env, obj))->item((unsigned long) index);
	return KDESupport::fromDOMString(env, &_domstring);
}

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

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

