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

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

class KFileListViewItemJBridge : public KFileListViewItem
{
public:
	KFileListViewItemJBridge(QListView* parent, const QString& text, const QPixmap& icon, KFileItem* fi) : KFileListViewItem(parent, text, icon, fi) {}
	KFileListViewItemJBridge(QListView* parent, const QString& text, const QPixmap& icon, KFileItem* fi, QListViewItem* after) : KFileListViewItem(parent, text, icon, fi, after) {}
	~KFileListViewItemJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KFileListViewItem_newKFileListViewItem__Lorg_kde_qt_QListView_2Ljava_lang_String_2Lorg_kde_qt_QPixmap_2Lorg_kde_koala_KFileItem_2(JNIEnv *env, jobject obj, jobject parent, jstring text, jobject icon, jobject fi)
{
static QString * _qstring_text = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KFileListViewItemJBridge((QListView*) QtSupport::getQt(env, parent), (QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text), (QPixmap&) *(QPixmap *) QtSupport::getQt(env, icon), (KFileItem*) QtSupport::getQt(env, fi)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KFileListViewItem_newKFileListViewItem__Lorg_kde_qt_QListView_2Ljava_lang_String_2Lorg_kde_qt_QPixmap_2Lorg_kde_koala_KFileItem_2Lorg_kde_qt_QListViewItem_2(JNIEnv *env, jobject obj, jobject parent, jstring text, jobject icon, jobject fi, jobject after)
{
static QString * _qstring_text = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KFileListViewItemJBridge((QListView*) QtSupport::getQt(env, parent), (QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text), (QPixmap&) *(QPixmap *) QtSupport::getQt(env, icon), (KFileItem*) QtSupport::getQt(env, fi), (QListViewItem*) QtSupport::getQt(env, after)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KFileListViewItem_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KFileListViewItem_finalize(env, obj);
	return;
}

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

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KFileListViewItem_fileInfo(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KFileListViewItem*) QtSupport::getQt(env, obj))->fileInfo(), "org.kde.koala.KFileItem");
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KFileListViewItem_key(JNIEnv *env, jobject obj, jint arg1, jboolean arg2)
{
	QString  _qstring;
	_qstring = ((KFileListViewItem*) QtSupport::getQt(env, obj))->key((int) arg1, (bool) arg2);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KFileListViewItem_setKey(JNIEnv *env, jobject obj, jstring key)
{
static QString * _qstring_key = 0;
	((KFileListViewItem*) QtSupport::getQt(env, obj))->setKey((QString&) * (QString *) QtSupport::toQString(env, key, &_qstring_key));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KFileListViewItem_rect(JNIEnv *env, jobject obj)
{
	QRect _r= ((KFileListViewItem*) QtSupport::getQt(env, obj))->rect();
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QRect(_r.left(),_r.top(),_r.width(),_r.height()), "org.kde.qt.QRect", TRUE);
}

