/***************************************************************************
                            KFloatValidator.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_KFloatValidator.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KFloatValidator.h>
#include <qtobjc/QWidget.h>


@implementation  KFloatValidator


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

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

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

- initWithDouble: (double)bottom top: (double)top parent: (QWidget *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KFloatValidator1((double)bottom, (double)top, (qt_QWidget *) [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) {
			kde_del_KFloatValidator((kde_KFloatValidator *)[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) kde_KFloatValidator_validate((kde_KFloatValidator *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (int)arg2);
}

- fixup: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	kde_KFloatValidator_fixup((kde_KFloatValidator *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- setRange: (double)bottom top: (double)top
{
	kde_KFloatValidator_setRange((kde_KFloatValidator *)[self qt], (double)bottom, (double)top);
	return self;
}

- (double) bottom
{
	return (double) kde_KFloatValidator_bottom((kde_KFloatValidator *)[self qt]);
}

- (double) top
{
	return (double) kde_KFloatValidator_top((kde_KFloatValidator *)[self qt]);
}

- setAcceptLocalizedNumbers: (BOOL)b
{
	kde_KFloatValidator_setAcceptLocalizedNumbers((kde_KFloatValidator *)[self qt], (int)b);
	return self;
}

- (BOOL) acceptLocalizedNumbers
{
	return (BOOL) kde_KFloatValidator_acceptLocalizedNumbers((kde_KFloatValidator *)[self qt]);
}

@end
