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

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

class QCanvasSpriteJBridge : public QCanvasSprite
{
public:
	QCanvasSpriteJBridge(QCanvasPixmapArray* array, QCanvas* canvas) : QCanvasSprite(array, canvas) {}
	~QCanvasSpriteJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_newQCanvasSprite(JNIEnv *env, jobject obj, jobject array, jobject canvas)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QCanvasSpriteJBridge((QCanvasPixmapArray*) QtSupport::getQt(env, array), (QCanvas*) QtSupport::getQt(env, canvas)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_setSequence(JNIEnv *env, jobject obj, jobject seq)
{
	((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->setSequence((QCanvasPixmapArray*) QtSupport::getQt(env, seq));
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_move__DD(JNIEnv *env, jobject obj, jdouble x, jdouble y)
{
	((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->move((double) x, (double) y);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_move__DDI(JNIEnv *env, jobject obj, jdouble x, jdouble y, jint frame)
{
	((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->move((double) x, (double) y, (int) frame);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_setFrame(JNIEnv *env, jobject obj, jint arg1)
{
	((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->setFrame((int) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_setFrameAnimation__III(JNIEnv *env, jobject obj, jint arg1, jint step, jint state)
{
	((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->setFrameAnimation((QCanvasSprite::FrameAnimationType) arg1, (int) step, (int) state);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_setFrameAnimation__(JNIEnv *env, jobject obj)
{
	((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->setFrameAnimation(QCanvasSprite::Cycle, 1, 0);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_frame(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->frame();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_frameCount(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->frameCount();
}

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

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QCanvasSprite_collidesWith(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jboolean) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->collidesWith((QCanvasItem*) QtSupport::getQt(env, arg1));
}

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

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

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

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_leftEdge__(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->leftEdge();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_topEdge__(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->topEdge();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_rightEdge__(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->rightEdge();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_bottomEdge__(JNIEnv *env, jobject obj)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->bottomEdge();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_leftEdge__I(JNIEnv *env, jobject obj, jint nx)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->leftEdge((int) nx);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_topEdge__I(JNIEnv *env, jobject obj, jint ny)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->topEdge((int) ny);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_rightEdge__I(JNIEnv *env, jobject obj, jint nx)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->rightEdge((int) nx);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QCanvasSprite_bottomEdge__I(JNIEnv *env, jobject obj, jint ny)
{
	return (jint) ((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->bottomEdge((int) ny);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvasSprite_image__(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->image(), "org.kde.qt.QCanvasPixmap");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvasSprite_imageAdvanced(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->imageAdvanced(), "org.kde.qt.QCanvasPixmap");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvasSprite_image__I(JNIEnv *env, jobject obj, jint f)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->image((int) f), "org.kde.qt.QCanvasPixmap");
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_advance(JNIEnv *env, jobject obj, jint stage)
{
	((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->advance((int) stage);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasSprite_draw(JNIEnv *env, jobject obj, jobject painter)
{
	((QCanvasSpriteJBridge*) QtSupport::getQt(env, obj))->draw((QPainter&) *(QPainter *) QtSupport::getQt(env, painter));
	return;
}

