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

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

class QRegionJBridge : public QRegion
{
public:
	QRegionJBridge() : QRegion() {}
	QRegionJBridge(int x, int y, int w, int h, RegionType arg1) : QRegion(x, y, w, h, arg1) {}
	QRegionJBridge(const QRect& arg1, RegionType arg2) : QRegion(arg1, arg2) {}
	QRegionJBridge(const QPointArray& arg1, bool winding) : QRegion(arg1, winding) {}
	QRegionJBridge(const QRegion& arg1) : QRegion(arg1) {}
	QRegionJBridge(const QBitmap& arg1) : QRegion(arg1) {}
	~QRegionJBridge() {QtSupport::qtKeyDeleted(this);}
};


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

JNIEXPORT void JNICALL
Java_org_kde_qt_QRegion_newQRegion__IIIII(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h, jint arg1)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRegionJBridge((int) x, (int) y, (int) w, (int) h, (QRegion::RegionType) arg1));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRegion_newQRegion__IIII(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRegionJBridge((int) x, (int) y, (int) w, (int) h, QRegion::Rectangle));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRegion_newQRegion__Lorg_kde_qt_QRect_2I(JNIEnv *env, jobject obj, jobject arg1, jint arg2)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRegionJBridge((QRect&) *(QRect *) QtSupport::getQt(env, arg1), (QRegion::RegionType) arg2));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRegion_newQRegion__Lorg_kde_qt_QRect_2(JNIEnv *env, jobject obj, jobject arg1)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRegionJBridge((QRect&) *(QRect *) QtSupport::getQt(env, arg1), QRegion::Rectangle));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRegion_newQRegion__Lorg_kde_qt_QPointArray_2Z(JNIEnv *env, jobject obj, jobject arg1, jboolean winding)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRegionJBridge((QPointArray&) *(QPointArray *) QtSupport::getQt(env, arg1), (bool) winding));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRegion_newQRegion__Lorg_kde_qt_QPointArray_2(JNIEnv *env, jobject obj, jobject arg1)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRegionJBridge((QPointArray&) *(QPointArray *) QtSupport::getQt(env, arg1), FALSE));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRegion_newQRegion__Lorg_kde_qt_QRegion_2(JNIEnv *env, jobject obj, jobject arg1)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRegionJBridge((QRegion&) *(QRegion *) QtSupport::getQt(env, arg1)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QRegion_newQRegion__Lorg_kde_qt_QBitmap_2(JNIEnv *env, jobject obj, jobject arg1)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QRegionJBridge((QBitmap&) *(QBitmap *) QtSupport::getQt(env, arg1)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

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

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

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

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

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

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QRegion_unite(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QRegion (((QRegionJBridge*) QtSupport::getQt(env, obj))->unite((QRegion&) *(QRegion *) QtSupport::getQt(env, arg1))), "org.kde.qt.QRegion", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QRegion_intersect(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QRegion (((QRegionJBridge*) QtSupport::getQt(env, obj))->intersect((QRegion&) *(QRegion *) QtSupport::getQt(env, arg1))), "org.kde.qt.QRegion", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QRegion_subtract(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QRegion (((QRegionJBridge*) QtSupport::getQt(env, obj))->subtract((QRegion&) *(QRegion *) QtSupport::getQt(env, arg1))), "org.kde.qt.QRegion", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QRegion_eor(JNIEnv *env, jobject obj, jobject arg1)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QRegion (((QRegionJBridge*) QtSupport::getQt(env, obj))->eor((QRegion&) *(QRegion *) QtSupport::getQt(env, arg1))), "org.kde.qt.QRegion", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QRegion_boundingRect(JNIEnv *env, jobject obj)
{
	QRect _r= ((QRegionJBridge*) 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 void JNICALL
Java_org_kde_qt_QRegion_setRects(JNIEnv *env, jobject obj, jobject arg1, jint arg2)
{
	((QRegionJBridge*) QtSupport::getQt(env, obj))->setRects((QRect*) QtSupport::getQt(env, arg1), (int) arg2);
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QRegion_rects(JNIEnv *env, jobject obj)
{
	QMemArray<QRect>  _qlist;
	_qlist = ((QRegion *) QtSupport::getQt(env, obj))->rects();
	return (jobject) QtSupport::arrayWithQRectList(env,  &_qlist);
}

//JNIEXPORT jint JNICALL
//Java_org_kde_qt_QRegion_handle__(JNIEnv *env, jobject obj)
//{
//	return (jint) ((QRegionJBridge*) QtSupport::getQt(env, obj))->handle();
//}

//JNIEXPORT jint JNICALL
//Java_org_kde_qt_QRegion_handle__(JNIEnv *env, jobject obj)
//{
//	return (jint) ((QRegionJBridge*) QtSupport::getQt(env, obj))->handle();
//}

//JNIEXPORT  JNICALL
//Java_org_kde_qt_QRegion_handle__Z(JNIEnv *env, jobject obj, jboolean require_rgn)
//{
//	return () ((QRegionJBridge*) QtSupport::getQt(env, obj))->handle((bool) require_rgn);
//}

//JNIEXPORT  JNICALL
//Java_org_kde_qt_QRegion_handle__(JNIEnv *env, jobject obj)
//{
//	return () ((QRegionJBridge*) QtSupport::getQt(env, obj))->handle(FALSE);
//}

//JNIEXPORT jint JNICALL
//Java_org_kde_qt_QRegion_handle__(JNIEnv *env, jobject obj)
//{
//	return (jint) ((QRegionJBridge*) QtSupport::getQt(env, obj))->handle();
//}

