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

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

#ifndef QT_NO_STYLE_SGI

class QSGIStyleJBridge : public QSGIStyle
{
public:
	QSGIStyleJBridge(bool useHighlightCols) : QSGIStyle(useHighlightCols) {}
	~QSGIStyleJBridge() {QtSupport::qtKeyDeleted(this);}
	bool  protected_eventFilter(QObject* arg1, QEvent* arg2) {
		return (bool ) QSGIStyle::eventFilter(arg1, arg2);
	}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(arg1);
		}
		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_QSGIStyle_newQSGIStyle__Z(JNIEnv *env, jobject obj, jboolean useHighlightCols)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QSGIStyleJBridge((bool) useHighlightCols));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_polish__Lorg_kde_qt_QWidget_2(JNIEnv *env, jobject obj, jobject arg1)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->polish((QWidget*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_unPolish__Lorg_kde_qt_QWidget_2(JNIEnv *env, jobject obj, jobject arg1)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->unPolish((QWidget*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_polish__Lorg_kde_qt_QApplication_2(JNIEnv *env, jobject obj, jobject arg1)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->polish((QApplication*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_unPolish__Lorg_kde_qt_QApplication_2(JNIEnv *env, jobject obj, jobject arg1)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->unPolish((QApplication*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_drawPrimitive__ILorg_kde_qt_QPainter_2Lorg_kde_qt_QRect_2Lorg_kde_qt_QColorGroup_2II(JNIEnv *env, jobject obj, jint pe, jobject p, jobject r, jobject cg, jint flags, jint arg1)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->drawPrimitive((QStyle::PrimitiveElement) pe, (QPainter*) QtSupport::getQt(env, p), (QRect&) *(QRect *) QtSupport::getQt(env, r), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), (QStyle::SFlags) flags, (QStyleOption&) * (QStyleOption *) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_drawPrimitive__ILorg_kde_qt_QPainter_2Lorg_kde_qt_QRect_2Lorg_kde_qt_QColorGroup_2(JNIEnv *env, jobject obj, jint pe, jobject p, jobject r, jobject cg)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->drawPrimitive((QStyle::PrimitiveElement) pe, (QPainter*) QtSupport::getQt(env, p), (QRect&) *(QRect *) QtSupport::getQt(env, r), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), QSGIStyle::Style_Default, QStyleOption::Default);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_drawControl__ILorg_kde_qt_QPainter_2Lorg_kde_qt_QWidget_2Lorg_kde_qt_QRect_2Lorg_kde_qt_QColorGroup_2II(JNIEnv *env, jobject obj, jint element, jobject p, jobject widget, jobject r, jobject cg, jint how, jint arg1)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->drawControl((QStyle::ControlElement) element, (QPainter*) QtSupport::getQt(env, p), (QWidget*) QtSupport::getQt(env, widget), (QRect&) *(QRect *) QtSupport::getQt(env, r), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), (QStyle::SFlags) how, (QStyleOption&) * (QStyleOption *) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_drawControl__ILorg_kde_qt_QPainter_2Lorg_kde_qt_QWidget_2Lorg_kde_qt_QRect_2Lorg_kde_qt_QColorGroup_2(JNIEnv *env, jobject obj, jint element, jobject p, jobject widget, jobject r, jobject cg)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->drawControl((QStyle::ControlElement) element, (QPainter*) QtSupport::getQt(env, p), (QWidget*) QtSupport::getQt(env, widget), (QRect&) *(QRect *) QtSupport::getQt(env, r), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), QSGIStyle::Style_Default, QStyleOption::Default);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_drawComplexControl__ILorg_kde_qt_QPainter_2Lorg_kde_qt_QWidget_2Lorg_kde_qt_QRect_2Lorg_kde_qt_QColorGroup_2IIII(JNIEnv *env, jobject obj, jint control, jobject p, jobject widget, jobject r, jobject cg, jint how, jint sub, jint subActive, jint arg1)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->drawComplexControl((QStyle::ComplexControl) control, (QPainter*) QtSupport::getQt(env, p), (QWidget*) QtSupport::getQt(env, widget), (QRect&) *(QRect *) QtSupport::getQt(env, r), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), (QStyle::SFlags) how, (QStyle::SCFlags) sub, (QStyle::SCFlags) subActive, (QStyleOption&) * (QStyleOption *) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSGIStyle_drawComplexControl__ILorg_kde_qt_QPainter_2Lorg_kde_qt_QWidget_2Lorg_kde_qt_QRect_2Lorg_kde_qt_QColorGroup_2(JNIEnv *env, jobject obj, jint control, jobject p, jobject widget, jobject r, jobject cg)
{
	((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->drawComplexControl((QStyle::ComplexControl) control, (QPainter*) QtSupport::getQt(env, p), (QWidget*) QtSupport::getQt(env, widget), (QRect&) *(QRect *) QtSupport::getQt(env, r), (QColorGroup&) *(QColorGroup *) QtSupport::getQt(env, cg), QSGIStyle::Style_Default, QSGIStyle::SC_All, QSGIStyle::SC_None, QStyleOption::Default);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QSGIStyle_pixelMetric__ILorg_kde_qt_QWidget_2(JNIEnv *env, jobject obj, jint metric, jobject widget)
{
	return (jint) ((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->pixelMetric((QStyle::PixelMetric) metric, (QWidget*) QtSupport::getQt(env, widget));
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QSGIStyle_pixelMetric__I(JNIEnv *env, jobject obj, jint metric)
{
	return (jint) ((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->pixelMetric((QStyle::PixelMetric) metric, 0);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QSGIStyle_sizeFromContents(JNIEnv *env, jobject obj, jint contents, jobject widget, jobject contentsSize, jint arg1)
{
	QSize _s= ((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->sizeFromContents((QStyle::ContentsType) contents, (QWidget*) QtSupport::getQt(env, widget), (QSize&) *(QSize *) QtSupport::getQt(env, contentsSize), (QStyleOption&) * (QStyleOption *) arg1);
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QSize(_s.width(),_s.height()), "org.kde.qt.QSize", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QSGIStyle_subRect(JNIEnv *env, jobject obj, jint r, jobject widget)
{
	QRect _r= ((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->subRect((QStyle::SubRect) r, (QWidget*) QtSupport::getQt(env, widget));
	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_QSGIStyle_querySubControlMetrics(JNIEnv *env, jobject obj, jint control, jobject widget, jint sc, jint arg1)
{
	QRect _r= ((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->querySubControlMetrics((QStyle::ComplexControl) control, (QWidget*) QtSupport::getQt(env, widget), (QStyle::SubControl) sc, (QStyleOption&) * (QStyleOption *) arg1);
	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_QSGIStyle_eventFilter(JNIEnv *env, jobject obj, jobject arg1, jobject arg2)
{
	return (jboolean) ((QSGIStyleJBridge*) QtSupport::getQt(env, obj))->protected_eventFilter((QObject*) QtSupport::getQt(env, arg1), (QEvent*) QtSupport::getQt(env, arg2));
}

#endif

