/***************************************************************************
                            QCursor.m -  description
                             -------------------
    begin                : Wed Nov 21 12:08:37 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 12:08:37 2001, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <qtc/qt_QCursor.h>
#include <qtobjc/QCursor.h>
#include <qtobjc/QPoint.h>

#include <qtobjc/QBitmap.h>
#include <qtobjc/QPixmap.h>

@implementation  QCursor

- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}

- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCursor()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)shape
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCursor1((int)shape)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithBitmap: (QBitmap *)bitmap mask: (QBitmap *)mask hotX: (int)hotX hotY: (int)hotY
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCursor2((qt_QBitmap *) [bitmap qt], (qt_QBitmap *) [mask qt], (int)hotX, (int)hotY)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithBitmap: (QBitmap *)bitmap mask: (QBitmap *)mask 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCursor2((qt_QBitmap *) [bitmap qt], (qt_QBitmap *) [mask qt], -1, -1)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithPixmap: (QPixmap *)pixmap hotX: (int)hotX hotY: (int)hotY
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCursor3((qt_QPixmap *) [pixmap qt], (int)hotX, (int)hotY)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithPixmap: (QPixmap *)pixmap 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCursor3((qt_QPixmap *) [pixmap qt], -1, -1)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- copyWithZone: (NSZone *) zone
{
	QCursor * aCopy;
	aCopy = [[(QCursor *)[[self class] allocWithZone: zone] setQt: qt_new_QCursor4([self qt])] init];
	[aCopy setAllocatedInObjcWorld: YES];
	[QtSupport setObject: aCopy forQtKey: [aCopy qt]];
	return aCopy;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			qt_del_QCursor((qt_QCursor *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (int) shape
{
	return (int) qt_QCursor_shape((qt_QCursor *)[self qt]);
}

- setShape: (int)arg1
{
	qt_QCursor_setShape((qt_QCursor *)[self qt], (int)arg1);
	return self;
}

- (QBitmap*) bitmap
{
	return (QBitmap*) [QtSupport objectForQtKey: qt_QCursor_bitmap((qt_QCursor *)[self qt]) withClass: [QBitmap class] allocatedInObjcWorld: YES];
}

- (QBitmap*) mask
{
	return (QBitmap*) [QtSupport objectForQtKey: qt_QCursor_mask((qt_QCursor *)[self qt]) withClass: [QBitmap class] allocatedInObjcWorld: YES];
}

- (QPoint*) hotSpot
{
	return (QPoint*) [QtSupport objectForQtKey: qt_QCursor_hotSpot((qt_QCursor *)[self qt]) withClass: [QPoint class] allocatedInObjcWorld: YES];
}

- (void*) handle
{
	return (void*) qt_QCursor_handle((qt_QCursor *)[self qt]);
}

//- initWithVoid: (void *)arg1
//{
//	if ([self qt] == 0L) {
//		[self setQt: qt_new_QCursor5((void *)arg1)];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

//- (unsigned int) handle
//{
//	return (unsigned int) qt_QCursor_handle1((qt_QCursor *)[self qt]);
//}

//- (unsigned int) handle
//{
//	return (unsigned int) qt_QCursor_handle2((qt_QCursor *)[self qt]);
//}

//- (unsigned int) handle
//{
//	return (unsigned int) qt_QCursor_handle3((qt_QCursor *)[self qt]);
//}

+ (QPoint*) pos
{
	return (QPoint*) [QtSupport objectForQtKey: qt_QCursor_pos() withClass: [QPoint class] allocatedInObjcWorld: YES];
}

+ setPos: (int)x y: (int)y
{
	qt_QCursor_setPos((int)x, (int)y);
	return self;
}

+ setPos: (QPoint*)arg1
{
	qt_QCursor_setPos1((qt_QPoint*) [arg1 qt]);
	return self;
}

//+ (QPoint*) pos
//{
//	return (QPoint*) [QtSupport objectForQtKey: qt_QCursor_pos1() withClass: [QPoint class] allocatedInObjcWorld: YES];
//}

//+ setPos: (int)x y: (int)y
//{
//	qt_QCursor_setPos2((int)x, (int)y);
//	return self;
//}

//+ setPos: (QPoint*)arg1
//{
//	qt_QCursor_setPos3((qt_QPoint*) [arg1 qt]);
//	return self;
//}

+ initialize
{
	qt_QCursor_initialize();
	return self;
}

+ cleanup
{
	qt_QCursor_cleanup();
	return self;
}

+ (int) x11Screen
{
	return (int) qt_QCursor_x11Screen();
}

@end
