/***************************************************************************
                            QCanvas.cpp -  description
                             -------------------
    begin                : Sun Feb 10 08:33:44 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Feb 10 08:33:44 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 <qcanvas.h>
#include <qstring.h>
#include <qcstring.h>

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

class QCanvasJBridge : public QCanvas
{
public:
	QCanvasJBridge(QObject* parent, const char* name) : QCanvas(parent, name) {}
	QCanvasJBridge(int w, int h) : QCanvas(w, h) {}
	QCanvasJBridge(QPixmap p, int h, int v, int tilewidth, int tileheight) : QCanvas(p, h, v, tilewidth, tileheight) {}
	~QCanvasJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_drawBackground(QPainter& arg1, const QRect& area) {
		QCanvas::drawBackground(arg1, area);
		return;
	}
	void protected_drawForeground(QPainter& arg1, const QRect& area) {
		QCanvas::drawForeground(arg1, area);
		return;
	}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(arg1);
		}
		return;
	}
	void customEvent(QCustomEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "customEvent", arg1, "org.kde.qt.QCustomEvent")) {
			QObject::customEvent(arg1);
		}
		return;
	}
	void timerEvent(QTimerEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "timerEvent", arg1, "org.kde.qt.QTimerEvent")) {
			QObject::timerEvent(arg1);
		}
		return;
	}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_newQCanvas__Lorg_kde_qt_QObject_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject parent, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCanvasJBridge((QObject*) QtSupport::getQt(env, parent), (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_newQCanvas__II(JNIEnv *env, jobject obj, jint w, jint h)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCanvasJBridge((int) w, (int) h));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_newQCanvas__Lorg_kde_qt_QPixmap_2IIII(JNIEnv *env, jobject obj, jobject p, jint h, jint v, jint tilewidth, jint tileheight)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCanvasJBridge((QPixmap) *(QPixmap *) QtSupport::getQt(env, p), (int) h, (int) v, (int) tilewidth, (int) tileheight));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_qt_QCanvas_finalize(env, obj);
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setTiles(JNIEnv *env, jobject obj, jobject tiles, jint h, jint v, jint tilewidth, jint tileheight)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setTiles((QPixmap) *(QPixmap *) QtSupport::getQt(env, tiles), (int) h, (int) v, (int) tilewidth, (int) tileheight);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setBackgroundPixmap(JNIEnv *env, jobject obj, jobject p)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setBackgroundPixmap((QPixmap&) *(QPixmap *) QtSupport::getQt(env, p));
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setBackgroundColor(JNIEnv *env, jobject obj, jobject c)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setBackgroundColor((QColor&) *(QColor *) QtSupport::getQt(env, c));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvas_backgroundColor(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QColor (((QCanvas*) QtSupport::getQt(env, obj))->backgroundColor()), "org.kde.qt.QColor", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setTile(JNIEnv *env, jobject obj, jint x, jint y, jint tilenum)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setTile((int) x, (int) y, (int) tilenum);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvas_tile(JNIEnv *env, jobject obj, jint x, jint y)
{
	return (jint) ((QCanvas*) QtSupport::getQt(env, obj))->tile((int) x, (int) y);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvas_tilesHorizontally(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvas*) QtSupport::getQt(env, obj))->tilesHorizontally();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvas_tilesVertically(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvas*) QtSupport::getQt(env, obj))->tilesVertically();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvas_tileWidth(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvas*) QtSupport::getQt(env, obj))->tileWidth();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvas_tileHeight(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvas*) QtSupport::getQt(env, obj))->tileHeight();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_resize(JNIEnv *env, jobject obj, jint width, jint height)
{
	((QCanvas*) QtSupport::getQt(env, obj))->resize((int) width, (int) height);
	return;
}

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

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

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

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvas_rect(JNIEnv *env, jobject obj)
{
	QRect _r= ((QCanvas*) 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);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QCanvas_onCanvas__II(JNIEnv *env, jobject obj, jint x, jint y)
{
	return (jboolean) ((QCanvas*) QtSupport::getQt(env, obj))->onCanvas((int) x, (int) y);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QCanvas_onCanvas__Lorg_kde_qt_QPoint_2(JNIEnv *env, jobject obj, jobject p)
{
	return (jboolean) ((QCanvas*) QtSupport::getQt(env, obj))->onCanvas((QPoint&) *(QPoint *) QtSupport::getQt(env, p));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QCanvas_validChunk__II(JNIEnv *env, jobject obj, jint x, jint y)
{
	return (jboolean) ((QCanvas*) QtSupport::getQt(env, obj))->validChunk((int) x, (int) y);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QCanvas_validChunk__Lorg_kde_qt_QPoint_2(JNIEnv *env, jobject obj, jobject p)
{
	return (jboolean) ((QCanvas*) QtSupport::getQt(env, obj))->validChunk((QPoint&) *(QPoint *) QtSupport::getQt(env, p));
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvas_chunkSize(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvas*) QtSupport::getQt(env, obj))->chunkSize();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_retune__II(JNIEnv *env, jobject obj, jint chunksize, jint maxclusters)
{
	((QCanvas*) QtSupport::getQt(env, obj))->retune((int) chunksize, (int) maxclusters);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_retune__I(JNIEnv *env, jobject obj, jint chunksize)
{
	((QCanvas*) QtSupport::getQt(env, obj))->retune((int) chunksize, 100);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QCanvas_sameChunk(JNIEnv *env, jobject obj, jint x1, jint y1, jint x2, jint y2)
{
	return (jboolean) ((QCanvas*) QtSupport::getQt(env, obj))->sameChunk((int) x1, (int) y1, (int) x2, (int) y2);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setChangedChunk(JNIEnv *env, jobject obj, jint i, jint j)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setChangedChunk((int) i, (int) j);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setChangedChunkContaining(JNIEnv *env, jobject obj, jint x, jint y)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setChangedChunkContaining((int) x, (int) y);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setAllChanged(JNIEnv *env, jobject obj)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setAllChanged();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setChanged(JNIEnv *env, jobject obj, jobject area)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setChanged((QRect&) *(QRect *) QtSupport::getQt(env, area));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setUnchanged(JNIEnv *env, jobject obj, jobject area)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setUnchanged((QRect&) *(QRect *) QtSupport::getQt(env, area));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_addItemToChunk(JNIEnv *env, jobject obj, jobject arg1, jint i, jint j)
{
	((QCanvas*) QtSupport::getQt(env, obj))->addItemToChunk((QCanvasItem*) QtSupport::getQt(env, arg1), (int) i, (int) j);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_removeItemFromChunk(JNIEnv *env, jobject obj, jobject arg1, jint i, jint j)
{
	((QCanvas*) QtSupport::getQt(env, obj))->removeItemFromChunk((QCanvasItem*) QtSupport::getQt(env, arg1), (int) i, (int) j);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_addItemToChunkContaining(JNIEnv *env, jobject obj, jobject arg1, jint x, jint y)
{
	((QCanvas*) QtSupport::getQt(env, obj))->addItemToChunkContaining((QCanvasItem*) QtSupport::getQt(env, arg1), (int) x, (int) y);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_removeItemFromChunkContaining(JNIEnv *env, jobject obj, jobject arg1, jint x, jint y)
{
	((QCanvas*) QtSupport::getQt(env, obj))->removeItemFromChunkContaining((QCanvasItem*) QtSupport::getQt(env, arg1), (int) x, (int) y);
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvas_allItems(JNIEnv *env, jobject obj)
{
	QCanvasItemList  _qlist;
	_qlist = ((QCanvas*) QtSupport::getQt(env, obj))->allItems();
	return (jobject) QtSupport::arrayWithQCanvasItemList(env, (QCanvasItemList *) &_qlist);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvas_collisions__Lorg_kde_qt_QPoint_2(JNIEnv *env, jobject obj, jobject arg1)
{
	QCanvasItemList  _qlist;
	_qlist = ((QCanvas*) QtSupport::getQt(env, obj))->collisions((QPoint&) *(QPoint *) QtSupport::getQt(env, arg1));
	return (jobject) QtSupport::arrayWithQCanvasItemList(env, (QCanvasItemList *) &_qlist);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvas_collisions__Lorg_kde_qt_QRect_2(JNIEnv *env, jobject obj, jobject arg1)
{
	QCanvasItemList  _qlist;
	_qlist = ((QCanvas*) QtSupport::getQt(env, obj))->collisions((QRect&) *(QRect *) QtSupport::getQt(env, arg1));
	return (jobject) QtSupport::arrayWithQCanvasItemList(env, (QCanvasItemList *) &_qlist);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvas_collisions__Lorg_kde_qt_QPointArray_2Lorg_kde_qt_QCanvasItem_2Z(JNIEnv *env, jobject obj, jobject pa, jobject item, jboolean exact)
{
	QCanvasItemList  _qlist;
	_qlist = ((QCanvas*) QtSupport::getQt(env, obj))->collisions((QPointArray&) *(QPointArray *) QtSupport::getQt(env, pa), (QCanvasItem*) QtSupport::getQt(env, item), (bool) exact);
	return (jobject) QtSupport::arrayWithQCanvasItemList(env, (QCanvasItemList *) &_qlist);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_drawArea__Lorg_kde_qt_QRect_2Lorg_kde_qt_QPainter_2Z(JNIEnv *env, jobject obj, jobject arg1, jobject p, jboolean double_buffer)
{
	((QCanvas*) QtSupport::getQt(env, obj))->drawArea((QRect&) *(QRect *) QtSupport::getQt(env, arg1), (QPainter*) QtSupport::getQt(env, p), (bool) double_buffer);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_drawArea__Lorg_kde_qt_QRect_2Lorg_kde_qt_QPainter_2(JNIEnv *env, jobject obj, jobject arg1, jobject p)
{
	((QCanvas*) QtSupport::getQt(env, obj))->drawArea((QRect&) *(QRect *) QtSupport::getQt(env, arg1), (QPainter*) QtSupport::getQt(env, p), FALSE);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_addView(JNIEnv *env, jobject obj, jobject arg1)
{
	((QCanvas*) QtSupport::getQt(env, obj))->addView((QCanvasView*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_removeView(JNIEnv *env, jobject obj, jobject arg1)
{
	((QCanvas*) QtSupport::getQt(env, obj))->removeView((QCanvasView*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_drawCanvasArea__Lorg_kde_qt_QRect_2Lorg_kde_qt_QPainter_2Z(JNIEnv *env, jobject obj, jobject arg1, jobject p, jboolean double_buffer)
{
	((QCanvas*) QtSupport::getQt(env, obj))->drawCanvasArea((QRect&) *(QRect *) QtSupport::getQt(env, arg1), (QPainter*) QtSupport::getQt(env, p), (bool) double_buffer);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_drawCanvasArea__Lorg_kde_qt_QRect_2(JNIEnv *env, jobject obj, jobject arg1)
{
	((QCanvas*) QtSupport::getQt(env, obj))->drawCanvasArea((QRect&) *(QRect *) QtSupport::getQt(env, arg1), 0, TRUE);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_drawViewArea(JNIEnv *env, jobject obj, jobject view, jobject p, jobject r, jboolean dbuf)
{
	((QCanvas*) QtSupport::getQt(env, obj))->drawViewArea((QCanvasView*) QtSupport::getQt(env, view), (QPainter*) QtSupport::getQt(env, p), (QRect&) *(QRect *) QtSupport::getQt(env, r), (bool) dbuf);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_addItem(JNIEnv *env, jobject obj, jobject arg1)
{
	((QCanvas*) QtSupport::getQt(env, obj))->addItem((QCanvasItem*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_addAnimation(JNIEnv *env, jobject obj, jobject arg1)
{
	((QCanvas*) QtSupport::getQt(env, obj))->addAnimation((QCanvasItem*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_removeItem(JNIEnv *env, jobject obj, jobject arg1)
{
	((QCanvas*) QtSupport::getQt(env, obj))->removeItem((QCanvasItem*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_removeAnimation(JNIEnv *env, jobject obj, jobject arg1)
{
	((QCanvas*) QtSupport::getQt(env, obj))->removeAnimation((QCanvasItem*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setAdvancePeriod(JNIEnv *env, jobject obj, jint ms)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setAdvancePeriod((int) ms);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setUpdatePeriod(JNIEnv *env, jobject obj, jint ms)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setUpdatePeriod((int) ms);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_setDoubleBuffering(JNIEnv *env, jobject obj, jboolean y)
{
	((QCanvas*) QtSupport::getQt(env, obj))->setDoubleBuffering((bool) y);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_advance(JNIEnv *env, jobject obj)
{
	((QCanvas*) QtSupport::getQt(env, obj))->advance();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_update(JNIEnv *env, jobject obj)
{
	((QCanvas*) QtSupport::getQt(env, obj))->update();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_drawBackground(JNIEnv *env, jobject obj, jobject arg1, jobject area)
{
	((QCanvasJBridge*) QtSupport::getQt(env, obj))->protected_drawBackground((QPainter&) *(QPainter *) QtSupport::getQt(env, arg1), (QRect&) *(QRect *) QtSupport::getQt(env, area));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvas_drawForeground(JNIEnv *env, jobject obj, jobject arg1, jobject area)
{
	((QCanvasJBridge*) QtSupport::getQt(env, obj))->protected_drawForeground((QPainter&) *(QPainter *) QtSupport::getQt(env, arg1), (QRect&) *(QRect *) QtSupport::getQt(env, area));
	return;
}

