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

@implementation  QIntValidator


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

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

- initWithInt: (int)bottom top: (int)top parent: (QObject *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QIntValidator1((int)bottom, (int)top, (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_QIntValidator((qt_QIntValidator *)[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_QIntValidator_validate((qt_QIntValidator *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (int)arg2);
}

- setBottom: (int)arg1
{
	qt_QIntValidator_setBottom((qt_QIntValidator *)[self qt], (int)arg1);
	return self;
}

- setTop: (int)arg1
{
	qt_QIntValidator_setTop((qt_QIntValidator *)[self qt], (int)arg1);
	return self;
}

- setRange: (int)bottom top: (int)top
{
	qt_QIntValidator_setRange((qt_QIntValidator *)[self qt], (int)bottom, (int)top);
	return self;
}

- (int) bottom
{
	return (int) qt_QIntValidator_bottom((qt_QIntValidator *)[self qt]);
}

- (int) top
{
	return (int) qt_QIntValidator_top((qt_QIntValidator *)[self qt]);
}

@end
