/***************************************************************************
                            KLed.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_KLed.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KLed.h>

@implementation  KLed


- initWithWidget: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KLed((qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithColor: (QColor *)col parent: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KLed1((qt_QColor *) [col qt], (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithColor: (QColor *)col st: (int)st look: (int)look shape: (int)shape parent: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KLed2((qt_QColor *) [col qt], (int)st, (int)look, (int)shape, (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithColor: (QColor *)col st: (int)st look: (int)look shape: (int)shape 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KLed2((qt_QColor *) [col qt], (int)st, (int)look, (int)shape, 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parentWidget: YES] == nil) {
			kde_del_KLed((kde_KLed *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (int) state
{
	return (int) kde_KLed_state((kde_KLed *)[self qt]);
}

- (int) shape
{
	return (int) kde_KLed_shape((kde_KLed *)[self qt]);
}

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

- (int) look
{
	return (int) kde_KLed_look((kde_KLed *)[self qt]);
}

- (int) darkFactor
{
	return (int) kde_KLed_darkFactor((kde_KLed *)[self qt]);
}

- setState: (int)state
{
	kde_KLed_setState((kde_KLed *)[self qt], (int)state);
	return self;
}

- setShape: (int)s
{
	kde_KLed_setShape((kde_KLed *)[self qt], (int)s);
	return self;
}

- toggleState
{
	kde_KLed_toggleState((kde_KLed *)[self qt]);
	return self;
}

- setColor: (QColor *)color
{
	kde_KLed_setColor((kde_KLed *)[self qt], (qt_QColor *) [color qt]);
	return self;
}

- setDarkFactor: (int)darkfactor
{
	kde_KLed_setDarkFactor((kde_KLed *)[self qt], (int)darkfactor);
	return self;
}

- setLook: (int)look
{
	kde_KLed_setLook((kde_KLed *)[self qt], (int)look);
	return self;
}

- (QSize*) sizeHint
{
	return (QSize*) [QtSupport objectForQtKey: kde_KLed_sizeHint((kde_KLed *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- (QSize*) minimumSizeHint
{
	return (QSize*) [QtSupport objectForQtKey: kde_KLed_minimumSizeHint((kde_KLed *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- toggle
{
	kde_KLed_toggle((kde_KLed *)[self qt]);
	return self;
}

- on
{
	kde_KLed_on((kde_KLed *)[self qt]);
	return self;
}

- off
{
	kde_KLed_off((kde_KLed *)[self qt]);
	return self;
}

- paintFlat
{
	kde_KLed_paintFlat((kde_KLed *)[self qt]);
	return self;
}

- paintRound
{
	kde_KLed_paintRound((kde_KLed *)[self qt]);
	return self;
}

- paintSunken
{
	kde_KLed_paintSunken((kde_KLed *)[self qt]);
	return self;
}

- paintRect
{
	kde_KLed_paintRect((kde_KLed *)[self qt]);
	return self;
}

- paintRectFrame: (BOOL)raised
{
	kde_KLed_paintRectFrame((kde_KLed *)[self qt], (int)raised);
	return self;
}

+ (int) Off
{
	return (int) KLED_Off;
}

+ (int) On
{
	return (int) KLED_On;
}

+ (int) Rectangular
{
	return (int) KLED_Rectangular;
}

+ (int) Circular
{
	return (int) KLED_Circular;
}

+ (int) Flat
{
	return (int) KLED_Flat;
}

+ (int) Raised
{
	return (int) KLED_Raised;
}

+ (int) Sunken
{
	return (int) KLED_Sunken;
}

@end
