/***************************************************************************
                            QTableItem.cpp -  description
                             -------------------
    begin                : Wed Nov 21 17:05:56 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 17:05:56 2001, 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 <qtable.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <qtjava/QTableItem.h>

class QTableItemJBridge : public QTableItem
{
public:
	QTableItemJBridge(QTable* table, EditType et, const QString& text) : QTableItem(table, et, text) {}
	QTableItemJBridge(QTable* table, EditType et, const QString& text, const QPixmap& p) : QTableItem(table, et, text, p) {}
	~QTableItemJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_newQTableItem__Lorg_kde_qt_QTable_2ILjava_lang_String_2(JNIEnv *env, jobject obj, jobject table, jint et, jstring text)
{
static QString * _qstring_text = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QTableItemJBridge((QTable*) QtSupport::getQt(env, table), (QTableItem::EditType) et, (QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_newQTableItem__Lorg_kde_qt_QTable_2ILjava_lang_String_2Lorg_kde_qt_QPixmap_2(JNIEnv *env, jobject obj, jobject table, jint et, jstring text, jobject p)
{
static QString * _qstring_text = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QTableItemJBridge((QTable*) QtSupport::getQt(env, table), (QTableItem::EditType) et, (QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text), (QPixmap&) *(QPixmap *) QtSupport::getQt(env, p)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTableItem_pixmap(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new  QPixmap (((QTableItemJBridge*) QtSupport::getQt(env, obj))->pixmap()), "org.kde.qt.QPixmap", TRUE);
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTableItem_text(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((QTableItemJBridge*) QtSupport::getQt(env, obj))->text();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setPixmap(JNIEnv *env, jobject obj, jobject p)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setPixmap((QPixmap&) *(QPixmap *) QtSupport::getQt(env, p));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setText(JNIEnv *env, jobject obj, jstring t)
{
static QString * _qstring_t = 0;
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setText((QString&) * (QString *) QtSupport::toQString(env, t, &_qstring_t));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTableItem_table(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QTableItemJBridge*) QtSupport::getQt(env, obj))->table(), "org.kde.qt.QTable");
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTableItem_alignment(JNIEnv *env, jobject obj)
{
	return (jint) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->alignment();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setWordWrap(JNIEnv *env, jobject obj, jboolean b)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setWordWrap((bool) b);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QTableItem_wordWrap(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->wordWrap();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTableItem_editType(JNIEnv *env, jobject obj)
{
	return (jint) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->editType();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTableItem_createEditor(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QTableItemJBridge*) QtSupport::getQt(env, obj))->createEditor(), "org.kde.qt.QWidget");
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setContentFromEditor(JNIEnv *env, jobject obj, jobject w)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setContentFromEditor((QWidget*) QtSupport::getQt(env, w));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setReplaceable(JNIEnv *env, jobject obj, jboolean arg1)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setReplaceable((bool) arg1);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QTableItem_isReplaceable(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->isReplaceable();
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTableItem_key(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((QTableItemJBridge*) QtSupport::getQt(env, obj))->key();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTableItem_sizeHint(JNIEnv *env, jobject obj)
{
	QSize _s= ((QTableItemJBridge*) QtSupport::getQt(env, obj))->sizeHint();
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QSize(_s.width(),_s.height()), "org.kde.qt.QSize", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setSpan(JNIEnv *env, jobject obj, jint rs, jint cs)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setSpan((int) rs, (int) cs);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTableItem_rowSpan(JNIEnv *env, jobject obj)
{
	return (jint) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->rowSpan();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTableItem_colSpan(JNIEnv *env, jobject obj)
{
	return (jint) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->colSpan();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setRow(JNIEnv *env, jobject obj, jint r)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setRow((int) r);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setCol(JNIEnv *env, jobject obj, jint c)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setCol((int) c);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTableItem_row(JNIEnv *env, jobject obj)
{
	return (jint) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->row();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTableItem_col(JNIEnv *env, jobject obj)
{
	return (jint) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->col();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_paint(JNIEnv *env, jobject obj, jobject p, jobject cg, jobject cr, jboolean selected)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->paint((QPainter*) QtSupport::getQt(env, p), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), (QRect&) *(QRect *) QtSupport::getQt(env, cr), (bool) selected);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_updateEditor(JNIEnv *env, jobject obj, jint oldRow, jint oldCol)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->updateEditor((int) oldRow, (int) oldCol);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTableItem_setEnabled(JNIEnv *env, jobject obj, jboolean b)
{
	((QTableItemJBridge*) QtSupport::getQt(env, obj))->setEnabled((bool) b);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QTableItem_isEnabled(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->isEnabled();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTableItem_rtti(JNIEnv *env, jobject obj)
{
	return (jint) ((QTableItemJBridge*) QtSupport::getQt(env, obj))->rtti();
}

