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

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

class QSimpleRichTextJBridge : public QSimpleRichText
{
public:
	QSimpleRichTextJBridge(const QString& text, const QFont& fnt, const QString& context, const QStyleSheet* sheet) : QSimpleRichText(text, fnt, context, sheet) {}
	QSimpleRichTextJBridge(const QString& text, const QFont& fnt, const QString& context, const QStyleSheet* sheet, const QMimeSourceFactory* factory, int pageBreak, const QColor& linkColor, bool linkUnderline) : QSimpleRichText(text, fnt, context, sheet, factory, pageBreak, linkColor, linkUnderline) {}
	~QSimpleRichTextJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_newQSimpleRichText__Ljava_lang_String_2Lorg_kde_qt_QFont_2Ljava_lang_String_2Lorg_kde_qt_QStyleSheet_2(JNIEnv *env, jobject obj, jstring text, jobject fnt, jstring context, jobject sheet)
{
static QString * _qstring_context = 0;
static QString * _qstring_text = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QSimpleRichTextJBridge((QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text), (QFont&) *(QFont *) QtSupport::getQt(env, fnt), (QString&) * (QString *) QtSupport::toQString(env, context, &_qstring_context), (QStyleSheet*) QtSupport::getQt(env, sheet)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_newQSimpleRichText__Ljava_lang_String_2Lorg_kde_qt_QFont_2(JNIEnv *env, jobject obj, jstring text, jobject fnt)
{
static QString * _qstring_text = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QSimpleRichTextJBridge((QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text), (QFont&) *(QFont *) QtSupport::getQt(env, fnt), QString::null, 0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_newQSimpleRichText__Ljava_lang_String_2Lorg_kde_qt_QFont_2Ljava_lang_String_2Lorg_kde_qt_QStyleSheet_2Lorg_kde_qt_QMimeSourceFactory_2ILorg_kde_qt_QColor_2Z(JNIEnv *env, jobject obj, jstring text, jobject fnt, jstring context, jobject sheet, jobject factory, jint pageBreak, jobject linkColor, jboolean linkUnderline)
{
static QString * _qstring_context = 0;
static QString * _qstring_text = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QSimpleRichTextJBridge((QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text), (QFont&) *(QFont *) QtSupport::getQt(env, fnt), (QString&) * (QString *) QtSupport::toQString(env, context, &_qstring_context), (QStyleSheet*) QtSupport::getQt(env, sheet), (QMimeSourceFactory*) QtSupport::getQt(env, factory), (int) pageBreak, (QColor&) *(QColor *) QtSupport::getQt(env, linkColor), (bool) linkUnderline));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_newQSimpleRichText__Ljava_lang_String_2Lorg_kde_qt_QFont_2Ljava_lang_String_2Lorg_kde_qt_QStyleSheet_2Lorg_kde_qt_QMimeSourceFactory_2(JNIEnv *env, jobject obj, jstring text, jobject fnt, jstring context, jobject sheet, jobject factory)
{
static QString * _qstring_context = 0;
static QString * _qstring_text = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QSimpleRichTextJBridge((QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text), (QFont&) *(QFont *) QtSupport::getQt(env, fnt), (QString&) * (QString *) QtSupport::toQString(env, context, &_qstring_context), (QStyleSheet*) QtSupport::getQt(env, sheet), (QMimeSourceFactory*) QtSupport::getQt(env, factory), -1, Qt::blue, TRUE));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_setWidth__I(JNIEnv *env, jobject obj, jint arg1)
{
	((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->setWidth((int) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_setWidth__Lorg_kde_qt_QPainter_2I(JNIEnv *env, jobject obj, jobject arg1, jint arg2)
{
	((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->setWidth((QPainter*) QtSupport::getQt(env, arg1), (int) arg2);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_setDefaultFont(JNIEnv *env, jobject obj, jobject f)
{
	((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->setDefaultFont((QFont&) *(QFont *) QtSupport::getQt(env, f));
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QSimpleRichText_width(JNIEnv *env, jobject obj)
{
	return (jint) ((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->width();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QSimpleRichText_widthUsed(JNIEnv *env, jobject obj)
{
	return (jint) ((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->widthUsed();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QSimpleRichText_height(JNIEnv *env, jobject obj)
{
	return (jint) ((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->height();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_adjustSize(JNIEnv *env, jobject obj)
{
	((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->adjustSize();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_draw__Lorg_kde_qt_QPainter_2IILorg_kde_qt_QRect_2Lorg_kde_qt_QColorGroup_2Lorg_kde_qt_QBrush_2(JNIEnv *env, jobject obj, jobject p, jint x, jint y, jobject clipRect, jobject cg, jobject paper)
{
	((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->draw((QPainter*) QtSupport::getQt(env, p), (int) x, (int) y, (QRect&) *(QRect *) QtSupport::getQt(env, clipRect), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), (QBrush*) QtSupport::getQt(env, paper));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_draw__Lorg_kde_qt_QPainter_2IILorg_kde_qt_QRect_2Lorg_kde_qt_QColorGroup_2(JNIEnv *env, jobject obj, jobject p, jint x, jint y, jobject clipRect, jobject cg)
{
	((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->draw((QPainter*) QtSupport::getQt(env, p), (int) x, (int) y, (QRect&) *(QRect *) QtSupport::getQt(env, clipRect), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), 0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_draw__Lorg_kde_qt_QPainter_2IILorg_kde_qt_QRegion_2Lorg_kde_qt_QColorGroup_2Lorg_kde_qt_QBrush_2(JNIEnv *env, jobject obj, jobject p, jint x, jint y, jobject clipRegion, jobject cg, jobject paper)
{
	((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->draw((QPainter*) QtSupport::getQt(env, p), (int) x, (int) y, (QRegion&) *(QRegion *) QtSupport::getQt(env, clipRegion), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), (QBrush*) QtSupport::getQt(env, paper));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSimpleRichText_draw__Lorg_kde_qt_QPainter_2IILorg_kde_qt_QRegion_2Lorg_kde_qt_QColorGroup_2(JNIEnv *env, jobject obj, jobject p, jint x, jint y, jobject clipRegion, jobject cg)
{
	((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->draw((QPainter*) QtSupport::getQt(env, p), (int) x, (int) y, (QRegion&) *(QRegion *) QtSupport::getQt(env, clipRegion), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), 0);
	return;
}

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

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QSimpleRichText_anchorAt(JNIEnv *env, jobject obj, jobject pos)
{
	QString  _qstring;
	_qstring = ((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->anchorAt((QPoint&) *(QPoint *) QtSupport::getQt(env, pos));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QSimpleRichText_inText(JNIEnv *env, jobject obj, jobject pos)
{
	return (jboolean) ((QSimpleRichTextJBridge*) QtSupport::getQt(env, obj))->inText((QPoint&) *(QPoint *) QtSupport::getQt(env, pos));
}

