/***************************************************************************
                            QCanvasRectangle.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_QCanvasRectangle.h>
#include <qtobjc/QCanvasRectangle.h>
#include <qtobjc/QCanvas.h>
#include <qtobjc/QRect.h>
#include <qtobjc/QSize.h>
#include <qtobjc/QPainter.h>

@implementation  QCanvasRectangle


- initWithCanvas: (QCanvas*)canvas
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCanvasRectangle((qt_QCanvas*) [canvas qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithRect: (QRect*)arg1 canvas: (QCanvas*)canvas
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCanvasRectangle1((qt_QRect*) [arg1 qt], (qt_QCanvas*) [canvas qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)x y: (int)y width: (int)width height: (int)height canvas: (QCanvas*)canvas
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCanvasRectangle2((int)x, (int)y, (int)width, (int)height, (qt_QCanvas*) [canvas qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- (int) width
{
	return (int) qt_QCanvasRectangle_width((qt_QCanvasRectangle *)[self qt]);
}

- (int) height
{
	return (int) qt_QCanvasRectangle_height((qt_QCanvasRectangle *)[self qt]);
}

- setSize: (int)w h: (int)h
{
	qt_QCanvasRectangle_setSize((qt_QCanvasRectangle *)[self qt], (int)w, (int)h);
	return self;
}

- (QSize*) size
{
	return (QSize*) [QtSupport objectForQtKey: qt_QCanvasRectangle_size((qt_QCanvasRectangle *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- (QPointArray*) areaPoints
{
	return (QPointArray*) [QtSupport objectForQtKey: qt_QCanvasRectangle_areaPoints((qt_QCanvasRectangle *)[self qt]) withClass: [QPointArray class] allocatedInObjcWorld: YES];
}

- (QRect*) rect
{
	return (QRect*) [QtSupport objectForQtKey: qt_QCanvasRectangle_rect((qt_QCanvasRectangle *)[self qt]) withClass: [QRect class] allocatedInObjcWorld: YES];
}

- (BOOL) collidesWith: (QCanvasItem*)arg1
{
	return (BOOL) qt_QCanvasRectangle_collidesWith((qt_QCanvasRectangle *)[self qt], (qt_QCanvasItem*) [arg1 qt]);
}

- (int) rtti
{
	return (int) qt_QCanvasRectangle_rtti((qt_QCanvasRectangle *)[self qt]);
}

- drawShape: (QPainter*)arg1
{
	qt_QCanvasRectangle_drawShape((qt_QCanvasRectangle *)[self qt], (qt_QPainter*) [arg1 qt]);
	return self;
}

- (QPointArray*) chunks
{
	return (QPointArray*) [QtSupport objectForQtKey: qt_QCanvasRectangle_chunks((qt_QCanvasRectangle *)[self qt]) withClass: [QPointArray class] allocatedInObjcWorld: YES];
}

@end
