/***************************************************************************
                            QPen.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_QPen.h>
#include <qtobjc/QPen.h>
#include <qtobjc/QColor.h>

@implementation  QPen


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

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

- initWithColor: (QColor *)color width: (unsigned int)width style: (int)style
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPen2((qt_QColor *) [color qt], (unsigned int)width, (int)style)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithColor: (QColor *)color 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPen2((qt_QColor *) [color qt], 0, [QPen SolidLine])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithColor: (QColor *)cl w: (unsigned int)w s: (int)s c: (int)c j: (int)j
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPen3((qt_QColor *) [cl qt], (unsigned int)w, (int)s, (int)c, (int)j)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- copyWithZone: (NSZone *) zone
{
	QPen * aCopy;
	aCopy = [[(QPen *)[[self class] allocWithZone: zone] setQt: qt_new_QPen4([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_QPen((qt_QPen *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (int) style
{
	return (int) qt_QPen_style((qt_QPen *)[self qt]);
}

- setStyle: (int)arg1
{
	qt_QPen_setStyle((qt_QPen *)[self qt], (int)arg1);
	return self;
}

- (unsigned int) width
{
	return (unsigned int) qt_QPen_width((qt_QPen *)[self qt]);
}

- setWidth: (unsigned int)arg1
{
	qt_QPen_setWidth((qt_QPen *)[self qt], (unsigned int)arg1);
	return self;
}

- (QColor*) color
{
	return (QColor*) [QtSupport objectForQtKey: qt_QPen_color((qt_QPen *)[self qt]) withClass: [QColor class] allocatedInObjcWorld: YES];
}

- setColor: (QColor *)arg1
{
	qt_QPen_setColor((qt_QPen *)[self qt], (qt_QColor *) [arg1 qt]);
	return self;
}

- (int) capStyle
{
	return (int) qt_QPen_capStyle((qt_QPen *)[self qt]);
}

- setCapStyle: (int)arg1
{
	qt_QPen_setCapStyle((qt_QPen *)[self qt], (int)arg1);
	return self;
}

- (int) joinStyle
{
	return (int) qt_QPen_joinStyle((qt_QPen *)[self qt]);
}

- setJoinStyle: (int)arg1
{
	qt_QPen_setJoinStyle((qt_QPen *)[self qt], (int)arg1);
	return self;
}

@end
