/***************************************************************************
                            QCanvasLine.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/QCanvasLine.h>

class QCanvasLineJBridge : public QCanvasLine
{
public:
	QCanvasLineJBridge(QCanvas* canvas) : QCanvasLine(canvas) {}
	~QCanvasLineJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_drawShape(QPainter& arg1) {
		QCanvasLine::drawShape(arg1);
		return;
	}
	QPointArray  protected_areaPoints() {
		return (QPointArray ) QCanvasLine::areaPoints();
	}
};


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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasLine_setPoints(JNIEnv *env, jobject obj, jint x1, jint y1, jint x2, jint y2)
{
	((QCanvasLineJBridge*) QtSupport::getQt(env, obj))->setPoints((int) x1, (int) y1, (int) x2, (int) y2);
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvasLine_startPoint(JNIEnv *env, jobject obj)
{
	QPoint _p= ((QCanvasLineJBridge*) QtSupport::getQt(env, obj))->startPoint();
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QPoint(_p.x(),_p.y()), "org.kde.qt.QPoint", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvasLine_endPoint(JNIEnv *env, jobject obj)
{
	QPoint _p= ((QCanvasLineJBridge*) QtSupport::getQt(env, obj))->endPoint();
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QPoint(_p.x(),_p.y()), "org.kde.qt.QPoint", TRUE);
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasLine_setPen(JNIEnv *env, jobject obj, jobject p)
{
	((QCanvasLineJBridge*) QtSupport::getQt(env, obj))->setPen((QPen) *(QPen *) QtSupport::getQt(env, p));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QCanvasLine_drawShape(JNIEnv *env, jobject obj, jobject arg1)
{
	((QCanvasLineJBridge*) QtSupport::getQt(env, obj))->protected_drawShape((QPainter&) *(QPainter *) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QCanvasLine_areaPoints(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QPointArray (((QCanvasLineJBridge*) QtSupport::getQt(env, obj))->protected_areaPoints()), "org.kde.qt.QPointArray", TRUE);
}

