/***************************************************************************
                            QDoubleValidator.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_QDoubleValidator.h>
#include <qtobjc/QDoubleValidator.h>
#include <qtobjc/QWidget.h>

@implementation  QDoubleValidator


- initWithObject: (QObject *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QDoubleValidator((qt_QObject *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithObject: (QObject *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QDoubleValidator((qt_QObject *) [parent qt], 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithDouble: (double)bottom top: (double)top decimals: (int)decimals parent: (QObject *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QDoubleValidator1((double)bottom, (double)top, (int)decimals, (qt_QObject *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithDouble: (double)bottom top: (double)top decimals: (int)decimals parent: (QObject *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QDoubleValidator1((double)bottom, (double)top, (int)decimals, (qt_QObject *) [parent qt], 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parent] == nil) {
			qt_del_QDoubleValidator((qt_QDoubleValidator *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (int) validate: (NSString *)arg1 int: (int)arg2
{
static qt_QString * _qstring_arg1 = 0L;
	return (int) qt_QDoubleValidator_validate((qt_QDoubleValidator *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (int)arg2);
}

- setRange: (double)bottom top: (double)top decimals: (int)decimals
{
	qt_QDoubleValidator_setRange((qt_QDoubleValidator *)[self qt], (double)bottom, (double)top, (int)decimals);
	return self;
}

- setRange: (double)bottom top: (double)top 
{
	qt_QDoubleValidator_setRange((qt_QDoubleValidator *)[self qt], (double)bottom, (double)top, 0);
	return self;
}

- setBottom: (double)arg1
{
	qt_QDoubleValidator_setBottom((qt_QDoubleValidator *)[self qt], (double)arg1);
	return self;
}

- setTop: (double)arg1
{
	qt_QDoubleValidator_setTop((qt_QDoubleValidator *)[self qt], (double)arg1);
	return self;
}

- setDecimals: (int)arg1
{
	qt_QDoubleValidator_setDecimals((qt_QDoubleValidator *)[self qt], (int)arg1);
	return self;
}

- (double) bottom
{
	return (double) qt_QDoubleValidator_bottom((qt_QDoubleValidator *)[self qt]);
}

- (double) top
{
	return (double) qt_QDoubleValidator_top((qt_QDoubleValidator *)[self qt]);
}

- (int) decimals
{
	return (int) qt_QDoubleValidator_decimals((qt_QDoubleValidator *)[self qt]);
}

@end
