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

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

class QRectJBridge : public QRect
{
public:
	QRectJBridge() : QRect() {}
	QRectJBridge(const QPoint& topleft, const QPoint& bottomright) : QRect(topleft, bottomright) {}
	QRectJBridge(const QPoint& topleft, const QSize& size) : QRect(topleft, size) {}
	QRectJBridge(int left, int top, int width, int height) : QRect(left, top, width, height) {}
};


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

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_newQRect__Lorg_kde_qt_QPoint_2Lorg_kde_qt_QPoint_2(JNIEnv *env, jobject obj, jobject topleft, jobject bottomright)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRectJBridge((QPoint&) *(QPoint *) QtSupport::getQt(env, topleft), (QPoint&) *(QPoint *) QtSupport::getQt(env, bottomright)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_newQRect__Lorg_kde_qt_QPoint_2Lorg_kde_qt_QSize_2(JNIEnv *env, jobject obj, jobject topleft, jobject size)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRectJBridge((QPoint&) *(QPoint *) QtSupport::getQt(env, topleft), (QSize&) *(QSize *) QtSupport::getQt(env, size)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_newQRect__IIII(JNIEnv *env, jobject obj, jint left, jint top, jint width, jint height)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRectJBridge((int) left, (int) top, (int) width, (int) height));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_isNull(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->isNull();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_isEmpty(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->isEmpty();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_isValid(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->isValid();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QRect_normalize(JNIEnv *env, jobject obj)
{
	QRect _r= ((QRectJBridge*) QtSupport::getQt(env, obj))->normalize();
	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_QRect_left(JNIEnv *env, jobject obj)
{
	return (jint) ((QRectJBridge*) QtSupport::getQt(env, obj))->left();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QRect_top(JNIEnv *env, jobject obj)
{
	return (jint) ((QRectJBridge*) QtSupport::getQt(env, obj))->top();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QRect_right(JNIEnv *env, jobject obj)
{
	return (jint) ((QRectJBridge*) QtSupport::getQt(env, obj))->right();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QRect_bottom(JNIEnv *env, jobject obj)
{
	return (jint) ((QRectJBridge*) QtSupport::getQt(env, obj))->bottom();
}

JNIEXPORT jshort JNICALL
Java_org_kde_qt_QRect_rLeft(JNIEnv *env, jobject obj)
{
	return (jshort) ((QRectJBridge*) QtSupport::getQt(env, obj))->rLeft();
}

JNIEXPORT jshort JNICALL
Java_org_kde_qt_QRect_rTop(JNIEnv *env, jobject obj)
{
	return (jshort) ((QRectJBridge*) QtSupport::getQt(env, obj))->rTop();
}

JNIEXPORT jshort JNICALL
Java_org_kde_qt_QRect_rRight(JNIEnv *env, jobject obj)
{
	return (jshort) ((QRectJBridge*) QtSupport::getQt(env, obj))->rRight();
}

JNIEXPORT jshort JNICALL
Java_org_kde_qt_QRect_rBottom(JNIEnv *env, jobject obj)
{
	return (jshort) ((QRectJBridge*) QtSupport::getQt(env, obj))->rBottom();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QRect_x(JNIEnv *env, jobject obj)
{
	return (jint) ((QRectJBridge*) QtSupport::getQt(env, obj))->x();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QRect_y(JNIEnv *env, jobject obj)
{
	return (jint) ((QRectJBridge*) QtSupport::getQt(env, obj))->y();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setLeft(JNIEnv *env, jobject obj, jint pos)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setLeft((int) pos);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setTop(JNIEnv *env, jobject obj, jint pos)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setTop((int) pos);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setRight(JNIEnv *env, jobject obj, jint pos)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setRight((int) pos);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setBottom(JNIEnv *env, jobject obj, jint pos)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setBottom((int) pos);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setX(JNIEnv *env, jobject obj, jint x)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setX((int) x);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setY(JNIEnv *env, jobject obj, jint y)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setY((int) y);
	return;
}

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

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

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

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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_rect(JNIEnv *env, jobject obj, jintArray x, jintArray y, jintArray w, jintArray h)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->rect( (int*) QtSupport::toIntPtr(env, x),  (int*) QtSupport::toIntPtr(env, y),  (int*) QtSupport::toIntPtr(env, w),  (int*) QtSupport::toIntPtr(env, h));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_coords(JNIEnv *env, jobject obj, jintArray x1, jintArray y1, jintArray x2, jintArray y2)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->coords( (int*) QtSupport::toIntPtr(env, x1),  (int*) QtSupport::toIntPtr(env, y1),  (int*) QtSupport::toIntPtr(env, x2),  (int*) QtSupport::toIntPtr(env, y2));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_moveTopLeft(JNIEnv *env, jobject obj, jobject p)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->moveTopLeft((QPoint&) *(QPoint *) QtSupport::getQt(env, p));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_moveBottomRight(JNIEnv *env, jobject obj, jobject p)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->moveBottomRight((QPoint&) *(QPoint *) QtSupport::getQt(env, p));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_moveTopRight(JNIEnv *env, jobject obj, jobject p)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->moveTopRight((QPoint&) *(QPoint *) QtSupport::getQt(env, p));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_moveBottomLeft(JNIEnv *env, jobject obj, jobject p)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->moveBottomLeft((QPoint&) *(QPoint *) QtSupport::getQt(env, p));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_moveCenter(JNIEnv *env, jobject obj, jobject p)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->moveCenter((QPoint&) *(QPoint *) QtSupport::getQt(env, p));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_moveBy(JNIEnv *env, jobject obj, jint dx, jint dy)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->moveBy((int) dx, (int) dy);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setRect(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setRect((int) x, (int) y, (int) w, (int) h);
	return;
}

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

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

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

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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setWidth(JNIEnv *env, jobject obj, jint w)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setWidth((int) w);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setHeight(JNIEnv *env, jobject obj, jint h)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setHeight((int) h);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRect_setSize(JNIEnv *env, jobject obj, jobject s)
{
	((QRectJBridge*) QtSupport::getQt(env, obj))->setSize((QSize&) *(QSize *) QtSupport::getQt(env, s));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_contains__Lorg_kde_qt_QPoint_2Z(JNIEnv *env, jobject obj, jobject p, jboolean proper)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->contains((QPoint&) *(QPoint *) QtSupport::getQt(env, p), (bool) proper);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_contains__Lorg_kde_qt_QPoint_2(JNIEnv *env, jobject obj, jobject p)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->contains((QPoint&) *(QPoint *) QtSupport::getQt(env, p), FALSE);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_contains__IIZ(JNIEnv *env, jobject obj, jint x, jint y, jboolean proper)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->contains((int) x, (int) y, (bool) proper);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_contains__II(JNIEnv *env, jobject obj, jint x, jint y)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->contains((int) x, (int) y, FALSE);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_contains__Lorg_kde_qt_QRect_2Z(JNIEnv *env, jobject obj, jobject r, jboolean proper)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->contains((QRect&) *(QRect *) QtSupport::getQt(env, r), (bool) proper);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QRect_contains__Lorg_kde_qt_QRect_2(JNIEnv *env, jobject obj, jobject r)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->contains((QRect&) *(QRect *) QtSupport::getQt(env, r), FALSE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QRect_unite(JNIEnv *env, jobject obj, jobject r)
{
	QRect _r= ((QRectJBridge*) QtSupport::getQt(env, obj))->unite((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_QRect_intersect(JNIEnv *env, jobject obj, jobject r)
{
	QRect _r= ((QRectJBridge*) QtSupport::getQt(env, obj))->intersect((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 jboolean JNICALL
Java_org_kde_qt_QRect_intersects(JNIEnv *env, jobject obj, jobject r)
{
	return (jboolean) ((QRectJBridge*) QtSupport::getQt(env, obj))->intersects((QRect&) *(QRect *) QtSupport::getQt(env, r));
}

