/***************************************************************************
                            CSSPrimitiveValue.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, 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 <kdec/kde_CSSPrimitiveValue.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/CSSPrimitiveValue.h>

@implementation  CSSPrimitiveValue


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

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

- initWithCSSValue: (CSSValue*)other
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_CSSPrimitiveValue2((kde_CSSValue*) [other qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- (unsigned short) primitiveType
{
	return (unsigned short) kde_CSSPrimitiveValue_primitiveType((kde_CSSPrimitiveValue *)[self qt]);
}

- setFloatValue: (unsigned short)unitType floatValue: (float)floatValue
{
	kde_CSSPrimitiveValue_setFloatValue((kde_CSSPrimitiveValue *)[self qt], (unsigned short)unitType, (float)floatValue);
	return self;
}

- (float) getFloatValue: (unsigned short)unitType
{
	return (float) kde_CSSPrimitiveValue_getFloatValue((kde_CSSPrimitiveValue *)[self qt], (unsigned short)unitType);
}

- setStringValue: (unsigned short)stringType stringValue: (NSString *)stringValue
{
static kde_DOMString * _domstring_stringValue = 0L;
	kde_CSSPrimitiveValue_setStringValue((kde_CSSPrimitiveValue *)[self qt], (unsigned short)stringType, (kde_DOMString*) [stringValue toDOMString: &_domstring_stringValue]);
	return self;
}

//- (NSString *) getStringValue
//{
//static kde_DOMString * _domstring = 0L;
//	_domstring = kde_CSSPrimitiveValue_getStringValue((kde_CSSPrimitiveValue *)[self qt]);
//	return [NSString fromDOMString: _domstring];
//}

- (Counter*) getCounterValue
{
	return (Counter*) [QtSupport objectForQtKey: kde_CSSPrimitiveValue_getCounterValue((kde_CSSPrimitiveValue *)[self qt]) withClass: [Counter class] allocatedInObjcWorld: YES];
}

- (Rect*) getRectValue
{
	return (Rect*) [QtSupport objectForQtKey: kde_CSSPrimitiveValue_getRectValue((kde_CSSPrimitiveValue *)[self qt]) withClass: [Rect class] allocatedInObjcWorld: YES];
}

- (RGBColor*) getRGBColorValue
{
	return (RGBColor*) [QtSupport objectForQtKey: kde_CSSPrimitiveValue_getRGBColorValue((kde_CSSPrimitiveValue *)[self qt]) withClass: [RGBColor class] allocatedInObjcWorld: YES];
}

+ (int) CSS_UNKNOWN
{
	return (int) CSSPRIMITIVEVALUE_CSS_UNKNOWN;
}

+ (int) CSS_NUMBER
{
	return (int) CSSPRIMITIVEVALUE_CSS_NUMBER;
}

+ (int) CSS_PERCENTAGE
{
	return (int) CSSPRIMITIVEVALUE_CSS_PERCENTAGE;
}

+ (int) CSS_EMS
{
	return (int) CSSPRIMITIVEVALUE_CSS_EMS;
}

+ (int) CSS_EXS
{
	return (int) CSSPRIMITIVEVALUE_CSS_EXS;
}

+ (int) CSS_PX
{
	return (int) CSSPRIMITIVEVALUE_CSS_PX;
}

+ (int) CSS_CM
{
	return (int) CSSPRIMITIVEVALUE_CSS_CM;
}

+ (int) CSS_MM
{
	return (int) CSSPRIMITIVEVALUE_CSS_MM;
}

+ (int) CSS_IN
{
	return (int) CSSPRIMITIVEVALUE_CSS_IN;
}

+ (int) CSS_PT
{
	return (int) CSSPRIMITIVEVALUE_CSS_PT;
}

+ (int) CSS_PC
{
	return (int) CSSPRIMITIVEVALUE_CSS_PC;
}

+ (int) CSS_DEG
{
	return (int) CSSPRIMITIVEVALUE_CSS_DEG;
}

+ (int) CSS_RAD
{
	return (int) CSSPRIMITIVEVALUE_CSS_RAD;
}

+ (int) CSS_GRAD
{
	return (int) CSSPRIMITIVEVALUE_CSS_GRAD;
}

+ (int) CSS_MS
{
	return (int) CSSPRIMITIVEVALUE_CSS_MS;
}

+ (int) CSS_S
{
	return (int) CSSPRIMITIVEVALUE_CSS_S;
}

+ (int) CSS_HZ
{
	return (int) CSSPRIMITIVEVALUE_CSS_HZ;
}

+ (int) CSS_KHZ
{
	return (int) CSSPRIMITIVEVALUE_CSS_KHZ;
}

+ (int) CSS_DIMENSION
{
	return (int) CSSPRIMITIVEVALUE_CSS_DIMENSION;
}

+ (int) CSS_STRING
{
	return (int) CSSPRIMITIVEVALUE_CSS_STRING;
}

+ (int) CSS_URI
{
	return (int) CSSPRIMITIVEVALUE_CSS_URI;
}

+ (int) CSS_IDENT
{
	return (int) CSSPRIMITIVEVALUE_CSS_IDENT;
}

+ (int) CSS_ATTR
{
	return (int) CSSPRIMITIVEVALUE_CSS_ATTR;
}

+ (int) CSS_COUNTER
{
	return (int) CSSPRIMITIVEVALUE_CSS_COUNTER;
}

+ (int) CSS_RECT
{
	return (int) CSSPRIMITIVEVALUE_CSS_RECT;
}

+ (int) CSS_RGBCOLOR
{
	return (int) CSSPRIMITIVEVALUE_CSS_RGBCOLOR;
}

@end
