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

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

class QWMatrixJBridge : public QWMatrix
{
public:
	QWMatrixJBridge() : QWMatrix() {}
	QWMatrixJBridge(double m11, double m12, double m21, double m22, double dx, double dy) : QWMatrix(m11, m12, m21, m22, dx, dy) {}
};


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

JNIEXPORT void JNICALL
Java_org_kde_qt_QWMatrix_newQWMatrix__DDDDDD(JNIEnv *env, jobject obj, jdouble m11, jdouble m12, jdouble m21, jdouble m22, jdouble dx, jdouble dy)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QWMatrixJBridge((double) m11, (double) m12, (double) m21, (double) m22, (double) dx, (double) dy));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QWMatrix_setMatrix(JNIEnv *env, jobject obj, jdouble m11, jdouble m12, jdouble m21, jdouble m22, jdouble dx, jdouble dy)
{
	((QWMatrixJBridge*) QtSupport::getQt(env, obj))->setMatrix((double) m11, (double) m12, (double) m21, (double) m22, (double) dx, (double) dy);
	return;
}

JNIEXPORT jdouble JNICALL
Java_org_kde_qt_QWMatrix_m11(JNIEnv *env, jobject obj)
{
	return (jdouble) ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->m11();
}

JNIEXPORT jdouble JNICALL
Java_org_kde_qt_QWMatrix_m12(JNIEnv *env, jobject obj)
{
	return (jdouble) ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->m12();
}

JNIEXPORT jdouble JNICALL
Java_org_kde_qt_QWMatrix_m21(JNIEnv *env, jobject obj)
{
	return (jdouble) ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->m21();
}

JNIEXPORT jdouble JNICALL
Java_org_kde_qt_QWMatrix_m22(JNIEnv *env, jobject obj)
{
	return (jdouble) ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->m22();
}

JNIEXPORT jdouble JNICALL
Java_org_kde_qt_QWMatrix_dx(JNIEnv *env, jobject obj)
{
	return (jdouble) ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->dx();
}

JNIEXPORT jdouble JNICALL
Java_org_kde_qt_QWMatrix_dy(JNIEnv *env, jobject obj)
{
	return (jdouble) ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->dy();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QWMatrix_map__II_3I_3I(JNIEnv *env, jobject obj, jint x, jint y, jintArray tx, jintArray ty)
{
	((QWMatrixJBridge*) QtSupport::getQt(env, obj))->map((int) x, (int) y,  (int*) QtSupport::toIntPtr(env, tx),  (int*) QtSupport::toIntPtr(env, ty));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QWMatrix_map__DD_3D_3D(JNIEnv *env, jobject obj, jdouble x, jdouble y, jdoubleArray tx, jdoubleArray ty)
{
	((QWMatrixJBridge*) QtSupport::getQt(env, obj))->map((double) x, (double) y,  (double*) QtSupport::toDoublePtr(env, tx),  (double*) QtSupport::toDoublePtr(env, ty));
	return;
}

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

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

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

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QWMatrix_map__Lorg_kde_qt_QPointArray_2(JNIEnv *env, jobject obj, jobject a)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QPointArray (((QWMatrixJBridge*) QtSupport::getQt(env, obj))->map((QPointArray&) *(QPointArray *) QtSupport::getQt(env, a))), "org.kde.qt.QPointArray", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QWMatrix_reset(JNIEnv *env, jobject obj)
{
	((QWMatrixJBridge*) QtSupport::getQt(env, obj))->reset();
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QWMatrix_isIdentity(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->isIdentity();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QWMatrix_translate(JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)(QWMatrix *) &((QWMatrixJBridge*) QtSupport::getQt(env, obj))->translate((double) dx, (double) dy), "org.kde.qt.QWMatrix");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QWMatrix_scale(JNIEnv *env, jobject obj, jdouble sx, jdouble sy)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)(QWMatrix *) &((QWMatrixJBridge*) QtSupport::getQt(env, obj))->scale((double) sx, (double) sy), "org.kde.qt.QWMatrix");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QWMatrix_shear(JNIEnv *env, jobject obj, jdouble sh, jdouble sv)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)(QWMatrix *) &((QWMatrixJBridge*) QtSupport::getQt(env, obj))->shear((double) sh, (double) sv), "org.kde.qt.QWMatrix");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QWMatrix_rotate(JNIEnv *env, jobject obj, jdouble a)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)(QWMatrix *) &((QWMatrixJBridge*) QtSupport::getQt(env, obj))->rotate((double) a), "org.kde.qt.QWMatrix");
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QWMatrix_isInvertible(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->isInvertible();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QWMatrix_invert(JNIEnv *env, jobject obj, jbooleanArray arg1)
{
	bool * invertible = QtSupport::toBooleanPtr(env, arg1);
	QWMatrix _m= ((QWMatrixJBridge*) QtSupport::getQt(env, obj))->invert(invertible);
	env->SetBooleanArrayRegion(arg1, 0, 1, (jboolean *) invertible);
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QWMatrix(_m.m11(),_m.m12(),_m.m21(),_m.m22(),_m.dx(),_m.dy()), "org.kde.qt.QWMatrix", TRUE);
}

