/***************************************************************************
                            QPaintDevice.cpp -  description
                             -------------------
    begin                : Sun Nov  3 10:27:27 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Nov  3 10:27:27 2002, 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 <qpaintdevice.h>
#include <qstring.h>
#include <qcstring.h>

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

class QPaintDeviceJBridge : public QPaintDevice
{
public:
	~QPaintDeviceJBridge() {QtSupport::qtKeyDeleted(this);}
	QPaintDeviceJBridge(uint devflags) : QPaintDevice(devflags) {}
	bool protected_cmd(int arg1, QPainter* arg2, QPDevCmdParam* arg3) {
		return (bool) QPaintDevice::cmd(arg1, arg2, arg3);
	}
	int protected_metric(int arg1) {
		return (int) QPaintDevice::metric(arg1);
	}
	int protected_fontMet(QFont* arg1, int arg2, const char* arg3, int arg4) {
		return (int) QPaintDevice::fontMet(arg1, arg2, arg3, arg4);
	}
	int protected_fontInf(QFont* arg1, int arg2) {
		return (int) QPaintDevice::fontInf(arg1, arg2);
	}
};


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

JNIEXPORT void JNICALL
Java_org_kde_qt_QPaintDevice_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_qt_QPaintDevice_finalize(env, obj);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QPaintDevice_isDisposed(JNIEnv *env, jobject obj)
{
	return (QtSupport::getQt(env, obj) == 0);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QPaintDevice_devType(JNIEnv *env, jobject obj)
{
	return (jint) ((QPaintDevice*) QtSupport::getQt(env, obj))->devType();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QPaintDevice_isExtDev(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QPaintDevice*) QtSupport::getQt(env, obj))->isExtDev();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QPaintDevice_paintingActive(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QPaintDevice*) QtSupport::getQt(env, obj))->paintingActive();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPaintDevice_setResolution(JNIEnv *env, jobject obj, jint arg1)
{
	((QPaintDevice*) QtSupport::getQt(env, obj))->setResolution((int) arg1);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QPaintDevice_resolution(JNIEnv *env, jobject obj)
{
	return (jint) ((QPaintDevice*) QtSupport::getQt(env, obj))->resolution();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPaintDevice_newQPaintDevice(JNIEnv *env, jobject obj, jint devflags)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QPaintDeviceJBridge((uint) devflags));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QPaintDevice_cmd(JNIEnv *env, jobject obj, jint arg1, jobject arg2, jobject arg3)
{
	return (jboolean) ((QPaintDeviceJBridge*) QtSupport::getQt(env, obj))->protected_cmd((int) arg1, (QPainter*) QtSupport::getQt(env, arg2), (QPDevCmdParam*) QtSupport::getQt(env, arg3));
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QPaintDevice_metric(JNIEnv *env, jobject obj, jint arg1)
{
	return (jint) ((QPaintDeviceJBridge*) QtSupport::getQt(env, obj))->protected_metric((int) arg1);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QPaintDevice_fontMet__Lorg_kde_qt_QFont_2ILjava_lang_String_2I(JNIEnv *env, jobject obj, jobject arg1, jint arg2, jstring arg3, jint arg4)
{
static QCString * _qstring_arg3 = 0;
	return (jint) ((QPaintDeviceJBridge*) QtSupport::getQt(env, obj))->protected_fontMet((QFont*) QtSupport::getQt(env, arg1), (int) arg2, (char*) QtSupport::toCharString(env, arg3, &_qstring_arg3), (int) arg4);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QPaintDevice_fontMet__Lorg_kde_qt_QFont_2I(JNIEnv *env, jobject obj, jobject arg1, jint arg2)
{
	return (jint) ((QPaintDeviceJBridge*) QtSupport::getQt(env, obj))->protected_fontMet((QFont*) QtSupport::getQt(env, arg1), (int) arg2, 0, 0);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QPaintDevice_fontInf(JNIEnv *env, jobject obj, jobject arg1, jint arg2)
{
	return (jint) ((QPaintDeviceJBridge*) QtSupport::getQt(env, obj))->protected_fontInf((QFont*) QtSupport::getQt(env, arg1), (int) arg2);
}

JNIEXPORT jlong JNICALL
Java_org_kde_qt_QPaintDevice_paintDevice(JNIEnv * env, jobject obj)
{
	return (jlong) (QPaintDevice *) QtSupport::getQt(env, obj);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPaintDevice_bitBlt(JNIEnv *env, jclass obj, jobject arg1, jint arg2, jint arg3, jobject arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9, jboolean arg10)
{
 	bitBlt((QPaintDevice*)QtSupport::paintDevice(env, arg1), (int)arg2, (int)arg3, (QPaintDevice*)QtSupport::getQt(env, arg4), (int)arg5, (int)arg6, (int)arg7, (int)arg8, (Qt::RasterOp)arg9, (bool)arg10);
  	return;
}


