/***************************************************************************
                            QCanvasPixmapArray.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_QCanvasPixmapArray.h>
#include <qtobjc/QCanvasPixmapArray.h>
#include <qtobjc/QCanvasPixmap.h>

@implementation  QCanvasPixmapArray

- (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_QCanvasPixmapArray()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)datafilenamepattern framecount: (int)framecount
{
static qt_QString * _qstring_datafilenamepattern = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCanvasPixmapArray1((qt_QString *) [datafilenamepattern toQString: &_qstring_datafilenamepattern], (int)framecount)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)datafilenamepattern 
{
static qt_QString * _qstring_datafilenamepattern = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCanvasPixmapArray1((qt_QString *) [datafilenamepattern toQString: &_qstring_datafilenamepattern], 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- (BOOL) readPixmaps: (NSString *)datafilenamepattern framecount: (int)framecount
{
static qt_QString * _qstring_datafilenamepattern = 0L;
	return (BOOL) qt_QCanvasPixmapArray_readPixmaps((qt_QCanvasPixmapArray *)[self qt], (qt_QString *) [datafilenamepattern toQString: &_qstring_datafilenamepattern], (int)framecount);
}

- (BOOL) readPixmaps: (NSString *)datafilenamepattern 
{
static qt_QString * _qstring_datafilenamepattern = 0L;
	return (BOOL) qt_QCanvasPixmapArray_readPixmaps((qt_QCanvasPixmapArray *)[self qt], (qt_QString *) [datafilenamepattern toQString: &_qstring_datafilenamepattern], 0);
}

- (BOOL) readCollisionMasks: (NSString *)filenamepattern
{
static qt_QString * _qstring_filenamepattern = 0L;
	return (BOOL) qt_QCanvasPixmapArray_readCollisionMasks((qt_QCanvasPixmapArray *)[self qt], (qt_QString *) [filenamepattern toQString: &_qstring_filenamepattern]);
}

- (BOOL) isValid
{
	return (BOOL) qt_QCanvasPixmapArray_isValid((qt_QCanvasPixmapArray *)[self qt]);
}

- (QCanvasPixmap*) image: (int)i
{
	return (QCanvasPixmap*) [QtSupport objectForQtKey: qt_QCanvasPixmapArray_image((qt_QCanvasPixmapArray *)[self qt], (int)i) withClass: [QCanvasPixmap class] allocatedInObjcWorld: YES];
}

- setImage: (int)i p: (QCanvasPixmap*)p
{
	qt_QCanvasPixmapArray_setImage((qt_QCanvasPixmapArray *)[self qt], (int)i, (qt_QCanvasPixmap*) [p qt]);
	return self;
}

- (unsigned int) count
{
	return (unsigned int) qt_QCanvasPixmapArray_count((qt_QCanvasPixmapArray *)[self qt]);
}

@end
