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

@implementation  KDoubleNumInput


- initWithWidget: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KDoubleNumInput((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_KDoubleNumInput(0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithDouble: (double)value 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KDoubleNumInput1((double)value, 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_KDoubleNumInput((kde_KDoubleNumInput *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- initWithNumInput: (KNumInput*)below value: (double)value parent: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KDoubleNumInput2((kde_KNumInput*) [below qt], (double)value, (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithNumInput: (KNumInput*)below value: (double)value 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KDoubleNumInput2((kde_KNumInput*) [below qt], (double)value, 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (double) value
{
	return (double) kde_KDoubleNumInput_value((kde_KDoubleNumInput *)[self qt]);
}

- (NSString *) suffix
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KDoubleNumInput_suffix((kde_KDoubleNumInput *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) prefix
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KDoubleNumInput_prefix((kde_KDoubleNumInput *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (int) precision
{
	return (int) kde_KDoubleNumInput_precision((kde_KDoubleNumInput *)[self qt]);
}

- (NSString *) specialValueText
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KDoubleNumInput_specialValueText((kde_KDoubleNumInput *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setRange: (double)min max: (double)max step: (double)step slider: (BOOL)slider
{
	kde_KDoubleNumInput_setRange((kde_KDoubleNumInput *)[self qt], (double)min, (double)max, (double)step, (int)slider);
	return self;
}

- setRange: (double)min max: (double)max 
{
	kde_KDoubleNumInput_setRange((kde_KDoubleNumInput *)[self qt], (double)min, (double)max, 1, 1);
	return self;
}

- setMinValue: (double)min
{
	kde_KDoubleNumInput_setMinValue((kde_KDoubleNumInput *)[self qt], (double)min);
	return self;
}

- (double) minValue
{
	return (double) kde_KDoubleNumInput_minValue((kde_KDoubleNumInput *)[self qt]);
}

- setMaxValue: (double)max
{
	kde_KDoubleNumInput_setMaxValue((kde_KDoubleNumInput *)[self qt], (double)max);
	return self;
}

- (double) maxValue
{
	return (double) kde_KDoubleNumInput_maxValue((kde_KDoubleNumInput *)[self qt]);
}

- setPrecision: (int)precision
{
	kde_KDoubleNumInput_setPrecision((kde_KDoubleNumInput *)[self qt], (int)precision);
	return self;
}

- setSpecialValueText: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
	kde_KDoubleNumInput_setSpecialValueText((kde_KDoubleNumInput *)[self qt], (qt_QString *) [text toQString: &_qstring_text]);
	return self;
}

- setValue: (double)arg1
{
	kde_KDoubleNumInput_setValue((kde_KDoubleNumInput *)[self qt], (double)arg1);
	return self;
}

- setSuffix: (NSString *)suffix
{
static qt_QString * _qstring_suffix = 0L;
	kde_KDoubleNumInput_setSuffix((kde_KDoubleNumInput *)[self qt], (qt_QString *) [suffix toQString: &_qstring_suffix]);
	return self;
}

- setPrefix: (NSString *)prefix
{
static qt_QString * _qstring_prefix = 0L;
	kde_KDoubleNumInput_setPrefix((kde_KDoubleNumInput *)[self qt], (qt_QString *) [prefix toQString: &_qstring_prefix]);
	return self;
}

- resetEditBox
{
	kde_KDoubleNumInput_resetEditBox((kde_KDoubleNumInput *)[self qt]);
	return self;
}

@end
