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

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

class QGridLayoutJBridge : public QGridLayout
{
public:
	QGridLayoutJBridge(QWidget* parent, int nRows, int nCols, int border, int spacing, const char* name) : QGridLayout(parent, nRows, nCols, border, spacing, name) {}
	QGridLayoutJBridge(int nRows, int nCols, int spacing, const char* name) : QGridLayout(nRows, nCols, spacing, name) {}
	QGridLayoutJBridge(QLayout* parentLayout, int nRows, int nCols, int spacing, const char* name) : QGridLayout(parentLayout, nRows, nCols, spacing, name) {}
	~QGridLayoutJBridge() {QtSupport::qtKeyDeleted(this);}
	bool  protected_findWidget(QWidget* w, int* r, int* c) {
		return (bool ) QGridLayout::findWidget(w, r, c);
	}
	void protected_add(QLayoutItem* arg1, int row, int col) {
		QGridLayout::add(arg1, row, col);
		return;
	}
	void childEvent(QChildEvent* e) {
		if (! QtSupport::eventDelegate(this, "childEvent", e, "org.kde.qt.QChildEvent")) {
			QLayout::childEvent(e);
		}
		return;
	}
	void customEvent(QCustomEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "customEvent", arg1, "org.kde.qt.QCustomEvent")) {
			QObject::customEvent(arg1);
		}
		return;
	}
	void timerEvent(QTimerEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "timerEvent", arg1, "org.kde.qt.QTimerEvent")) {
			QObject::timerEvent(arg1);
		}
		return;
	}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_newQGridLayout__Lorg_kde_qt_QWidget_2IIIILjava_lang_String_2(JNIEnv *env, jobject obj, jobject parent, jint nRows, jint nCols, jint border, jint spacing, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QGridLayoutJBridge((QWidget*) QtSupport::getQt(env, parent), (int) nRows, (int) nCols, (int) border, (int) spacing, (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_newQGridLayout__Lorg_kde_qt_QWidget_2(JNIEnv *env, jobject obj, jobject parent)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QGridLayoutJBridge((QWidget*) QtSupport::getQt(env, parent), 1, 1, 0, -1, 0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_newQGridLayout__IIILjava_lang_String_2(JNIEnv *env, jobject obj, jint nRows, jint nCols, jint spacing, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QGridLayoutJBridge((int) nRows, (int) nCols, (int) spacing, (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_newQGridLayout__Lorg_kde_qt_QLayout_2IIILjava_lang_String_2(JNIEnv *env, jobject obj, jobject parentLayout, jint nRows, jint nCols, jint spacing, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QGridLayoutJBridge((QLayout*) QtSupport::getQt(env, parentLayout), (int) nRows, (int) nCols, (int) spacing, (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_newQGridLayout__Lorg_kde_qt_QLayout_2(JNIEnv *env, jobject obj, jobject parentLayout)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QGridLayoutJBridge((QLayout*) QtSupport::getQt(env, parentLayout), 1, 1, -1, 0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj) && ((QGridLayout*)QtSupport::getQt(env, obj))->parent() == (QObject *) 0) {
		delete (QGridLayout*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

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

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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_setRowStretch(JNIEnv *env, jobject obj, jint row, jint stretch)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->setRowStretch((int) row, (int) stretch);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_setColStretch(JNIEnv *env, jobject obj, jint col, jint stretch)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->setColStretch((int) col, (int) stretch);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGridLayout_rowStretch(JNIEnv *env, jobject obj, jint row)
{
	return (jint) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->rowStretch((int) row);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGridLayout_colStretch(JNIEnv *env, jobject obj, jint col)
{
	return (jint) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->colStretch((int) col);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGridLayout_numRows(JNIEnv *env, jobject obj)
{
	return (jint) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->numRows();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGridLayout_numCols(JNIEnv *env, jobject obj)
{
	return (jint) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->numCols();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QGridLayout_cellGeometry(JNIEnv *env, jobject obj, jint row, jint col)
{
	QRect _r= ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->cellGeometry((int) row, (int) col);
	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_QGridLayout_hasHeightForWidth(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->hasHeightForWidth();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGridLayout_heightForWidth(JNIEnv *env, jobject obj, jint arg1)
{
	return (jint) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->heightForWidth((int) arg1);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGridLayout_expanding(JNIEnv *env, jobject obj)
{
	return (jint) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->expanding();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_invalidate(JNIEnv *env, jobject obj)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->invalidate();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addItem__Lorg_kde_qt_QLayoutItemInterface_2(JNIEnv *env, jobject obj, jobject arg1)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addItem((QLayoutItem*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addItem__Lorg_kde_qt_QLayoutItemInterface_2II(JNIEnv *env, jobject obj, jobject item, jint row, jint col)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addItem((QLayoutItem*) QtSupport::getQt(env, item), (int) row, (int) col);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addMultiCell__Lorg_kde_qt_QLayoutItemInterface_2IIIII(JNIEnv *env, jobject obj, jobject arg1, jint fromRow, jint toRow, jint fromCol, jint toCol, jint align)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addMultiCell((QLayoutItem*) QtSupport::getQt(env, arg1), (int) fromRow, (int) toRow, (int) fromCol, (int) toCol, (int) align);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addMultiCell__Lorg_kde_qt_QLayoutItemInterface_2IIII(JNIEnv *env, jobject obj, jobject arg1, jint fromRow, jint toRow, jint fromCol, jint toCol)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addMultiCell((QLayoutItem*) QtSupport::getQt(env, arg1), (int) fromRow, (int) toRow, (int) fromCol, (int) toCol, 0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addWidget__Lorg_kde_qt_QWidget_2III(JNIEnv *env, jobject obj, jobject arg1, jint row, jint col, jint align)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addWidget((QWidget*) QtSupport::getQt(env, arg1), (int) row, (int) col, (int) align);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addWidget__Lorg_kde_qt_QWidget_2II(JNIEnv *env, jobject obj, jobject arg1, jint row, jint col)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addWidget((QWidget*) QtSupport::getQt(env, arg1), (int) row, (int) col, 0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addMultiCellWidget__Lorg_kde_qt_QWidget_2IIIII(JNIEnv *env, jobject obj, jobject arg1, jint fromRow, jint toRow, jint fromCol, jint toCol, jint align)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addMultiCellWidget((QWidget*) QtSupport::getQt(env, arg1), (int) fromRow, (int) toRow, (int) fromCol, (int) toCol, (int) align);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addMultiCellWidget__Lorg_kde_qt_QWidget_2IIII(JNIEnv *env, jobject obj, jobject arg1, jint fromRow, jint toRow, jint fromCol, jint toCol)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addMultiCellWidget((QWidget*) QtSupport::getQt(env, arg1), (int) fromRow, (int) toRow, (int) fromCol, (int) toCol, 0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addLayout(JNIEnv *env, jobject obj, jobject layout, jint row, jint col)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addLayout((QLayout*) QtSupport::getQt(env, layout), (int) row, (int) col);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addMultiCellLayout__Lorg_kde_qt_QLayout_2IIIII(JNIEnv *env, jobject obj, jobject layout, jint fromRow, jint toRow, jint fromCol, jint toCol, jint align)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addMultiCellLayout((QLayout*) QtSupport::getQt(env, layout), (int) fromRow, (int) toRow, (int) fromCol, (int) toCol, (int) align);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addMultiCellLayout__Lorg_kde_qt_QLayout_2IIII(JNIEnv *env, jobject obj, jobject layout, jint fromRow, jint toRow, jint fromCol, jint toCol)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addMultiCellLayout((QLayout*) QtSupport::getQt(env, layout), (int) fromRow, (int) toRow, (int) fromCol, (int) toCol, 0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addRowSpacing(JNIEnv *env, jobject obj, jint row, jint minsize)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addRowSpacing((int) row, (int) minsize);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_addColSpacing(JNIEnv *env, jobject obj, jint col, jint minsize)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->addColSpacing((int) col, (int) minsize);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_expand(JNIEnv *env, jobject obj, jint rows, jint cols)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->expand((int) rows, (int) cols);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_setOrigin(JNIEnv *env, jobject obj, jint arg1)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->setOrigin((QGridLayout::Corner) arg1);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QGridLayout_origin(JNIEnv *env, jobject obj)
{
	return (jint) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->origin();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QGridLayout_iterator(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QLayoutIterator (((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->iterator()), "org.kde.qt.QLayoutIterator", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_setGeometry(JNIEnv *env, jobject obj, jobject arg1)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->setGeometry((QRect&) *(QRect *) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QGridLayout_findWidget(JNIEnv *env, jobject obj, jobject w, jintArray r, jintArray c)
{
	return (jboolean) ((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->protected_findWidget((QWidget*) QtSupport::getQt(env, w),  (int*) QtSupport::toIntPtr(env, r),  (int*) QtSupport::toIntPtr(env, c));
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QGridLayout_add(JNIEnv *env, jobject obj, jobject arg1, jint row, jint col)
{
	((QGridLayoutJBridge*) QtSupport::getQt(env, obj))->protected_add((QLayoutItem*) QtSupport::getQt(env, arg1), (int) row, (int) col);
	return;
}

