/***************************************************************************
                            QCanvasSprite.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_QCanvasSprite.h>
#include <qtobjc/QCanvasSprite.h>
#include <qtobjc/QPainter.h>
#include <qtobjc/QWidget.h>
#include <qtobjc/QCanvasPixmapArray.h>
#include <qtobjc/QCanvas.h>

@implementation  QCanvasSprite


- initWithCanvasPixmapArray: (QCanvasPixmapArray*)array canvas: (QCanvas*)canvas
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCanvasSprite((qt_QCanvasPixmapArray*) [array qt], (qt_QCanvas*) [canvas qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- setSequence: (QCanvasPixmapArray*)seq
{
	qt_QCanvasSprite_setSequence((qt_QCanvasSprite *)[self qt], (qt_QCanvasPixmapArray*) [seq qt]);
	return self;
}

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

- move: (double)x y: (double)y
{
	qt_QCanvasSprite_move((qt_QCanvasSprite *)[self qt], (double)x, (double)y);
	return self;
}

- move: (double)x y: (double)y frame: (int)frame
{
	qt_QCanvasSprite_move1((qt_QCanvasSprite *)[self qt], (double)x, (double)y, (int)frame);
	return self;
}

- setFrame: (int)arg1
{
	qt_QCanvasSprite_setFrame((qt_QCanvasSprite *)[self qt], (int)arg1);
	return self;
}

- setFrameAnimation: (int)arg1 step: (int)step state: (int)state
{
	qt_QCanvasSprite_setFrameAnimation((qt_QCanvasSprite *)[self qt], (int)arg1, (int)step, (int)state);
	return self;
}

- setFrameAnimation
{
	qt_QCanvasSprite_setFrameAnimation((qt_QCanvasSprite *)[self qt], [QCanvasSprite Cycle], 1, 0);
	return self;
}

- (int) frame
{
	return (int) qt_QCanvasSprite_frame((qt_QCanvasSprite *)[self qt]);
}

- (int) frameCount
{
	return (int) qt_QCanvasSprite_frameCount((qt_QCanvasSprite *)[self qt]);
}

- (int) rtti
{
	return (int) qt_QCanvasSprite_rtti((qt_QCanvasSprite *)[self qt]);
}

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

- (QRect*) boundingRect
{
	return (QRect*) [QtSupport objectForQtKey: qt_QCanvasSprite_boundingRect((qt_QCanvasSprite *)[self qt]) withClass: [QRect class] allocatedInObjcWorld: YES];
}

- (int) width
{
	return (int) qt_QCanvasSprite_width((qt_QCanvasSprite *)[self qt]);
}

- (int) height
{
	return (int) qt_QCanvasSprite_height((qt_QCanvasSprite *)[self qt]);
}

- (int) leftEdge
{
	return (int) qt_QCanvasSprite_leftEdge((qt_QCanvasSprite *)[self qt]);
}

- (int) topEdge
{
	return (int) qt_QCanvasSprite_topEdge((qt_QCanvasSprite *)[self qt]);
}

- (int) rightEdge
{
	return (int) qt_QCanvasSprite_rightEdge((qt_QCanvasSprite *)[self qt]);
}

- (int) bottomEdge
{
	return (int) qt_QCanvasSprite_bottomEdge((qt_QCanvasSprite *)[self qt]);
}

- (int) leftEdge: (int)nx
{
	return (int) qt_QCanvasSprite_leftEdge1((qt_QCanvasSprite *)[self qt], (int)nx);
}

- (int) topEdge: (int)ny
{
	return (int) qt_QCanvasSprite_topEdge1((qt_QCanvasSprite *)[self qt], (int)ny);
}

- (int) rightEdge: (int)nx
{
	return (int) qt_QCanvasSprite_rightEdge1((qt_QCanvasSprite *)[self qt], (int)nx);
}

- (int) bottomEdge: (int)ny
{
	return (int) qt_QCanvasSprite_bottomEdge1((qt_QCanvasSprite *)[self qt], (int)ny);
}

- (QCanvasPixmap*) image
{
	return (QCanvasPixmap*) [QtSupport objectForQtKey: qt_QCanvasSprite_image((qt_QCanvasSprite *)[self qt]) withClass: [QCanvasPixmap class] allocatedInObjcWorld: YES];
}

- (QCanvasPixmap*) imageAdvanced
{
	return (QCanvasPixmap*) [QtSupport objectForQtKey: qt_QCanvasSprite_imageAdvanced((qt_QCanvasSprite *)[self qt]) withClass: [QCanvasPixmap class] allocatedInObjcWorld: YES];
}

- (QCanvasPixmap*) image: (int)f
{
	return (QCanvasPixmap*) [QtSupport objectForQtKey: qt_QCanvasSprite_image1((qt_QCanvasSprite *)[self qt], (int)f) withClass: [QCanvasPixmap class] allocatedInObjcWorld: YES];
}

- advance: (int)stage
{
	qt_QCanvasSprite_advance((qt_QCanvasSprite *)[self qt], (int)stage);
	return self;
}

- draw: (QPainter*)painter
{
	qt_QCanvasSprite_draw((qt_QCanvasSprite *)[self qt], (qt_QPainter*) [painter qt]);
	return self;
}

+ (int) Cycle
{
	return (int) QCANVASSPRITE_Cycle;
}

+ (int) Oscillate
{
	return (int) QCANVASSPRITE_Oscillate;
}

@end
