/***************************************************************************
                            QLCDNumber.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_QLCDNumber.h>
#include <qtobjc/QLCDNumber.h>
#include <qtobjc/QPainter.h>

@implementation  QLCDNumber


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

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

- initWithUnsigned: (unsigned int)numDigits 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QLCDNumber1((unsigned int)numDigits, 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) {
			qt_del_QLCDNumber((qt_QLCDNumber *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) smallDecimalPoint
{
	return (BOOL) qt_QLCDNumber_smallDecimalPoint((qt_QLCDNumber *)[self qt]);
}

- (int) numDigits
{
	return (int) qt_QLCDNumber_numDigits((qt_QLCDNumber *)[self qt]);
}

- setNumDigits: (int)nDigits
{
	qt_QLCDNumber_setNumDigits((qt_QLCDNumber *)[self qt], (int)nDigits);
	return self;
}

- (BOOL) checkDoubleOverflow: (double)num
{
	return (BOOL) qt_QLCDNumber_checkOverflow((qt_QLCDNumber *)[self qt], (double)num);
}

- (BOOL) checkIntOverflow: (int)num
{
	return (BOOL) qt_QLCDNumber_checkOverflow1((qt_QLCDNumber *)[self qt], (int)num);
}

- (int) mode
{
	return (int) qt_QLCDNumber_mode((qt_QLCDNumber *)[self qt]);
}

- setMode: (int)arg1
{
	qt_QLCDNumber_setMode((qt_QLCDNumber *)[self qt], (int)arg1);
	return self;
}

- (int) segmentStyle
{
	return (int) qt_QLCDNumber_segmentStyle((qt_QLCDNumber *)[self qt]);
}

- setSegmentStyle: (int)arg1
{
	qt_QLCDNumber_setSegmentStyle((qt_QLCDNumber *)[self qt], (int)arg1);
	return self;
}

- (double) value
{
	return (double) qt_QLCDNumber_value((qt_QLCDNumber *)[self qt]);
}

- (int) intValue
{
	return (int) qt_QLCDNumber_intValue((qt_QLCDNumber *)[self qt]);
}

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

- displayString: (NSString *)str
{
static qt_QString * _qstring_str = 0L;
	qt_QLCDNumber_display((qt_QLCDNumber *)[self qt], (qt_QString *) [str toQString: &_qstring_str]);
	return self;
}

- displayInt: (int)num
{
	qt_QLCDNumber_display1((qt_QLCDNumber *)[self qt], (int)num);
	return self;
}

- displayDouble: (double)num
{
	qt_QLCDNumber_display2((qt_QLCDNumber *)[self qt], (double)num);
	return self;
}

- setHexMode
{
	qt_QLCDNumber_setHexMode((qt_QLCDNumber *)[self qt]);
	return self;
}

- setDecMode
{
	qt_QLCDNumber_setDecMode((qt_QLCDNumber *)[self qt]);
	return self;
}

- setOctMode
{
	qt_QLCDNumber_setOctMode((qt_QLCDNumber *)[self qt]);
	return self;
}

- setBinMode
{
	qt_QLCDNumber_setBinMode((qt_QLCDNumber *)[self qt]);
	return self;
}

- setSmallDecimalPoint: (BOOL)arg1
{
	qt_QLCDNumber_setSmallDecimalPoint((qt_QLCDNumber *)[self qt], (int)arg1);
	return self;
}

- drawContents: (QPainter *)arg1
{
	qt_QLCDNumber_drawContents((qt_QLCDNumber *)[self qt], (qt_QPainter *) [arg1 qt]);
	return self;
}

+ (int) Hex
{
	return (int) QLCDNUMBER_Hex;
}

+ (int) Dec
{
	return (int) QLCDNUMBER_Dec;
}

+ (int) Oct
{
	return (int) QLCDNUMBER_Oct;
}

+ (int) Bin
{
	return (int) QLCDNUMBER_Bin;
}

+ (int) HEX
{
	return (int) QLCDNUMBER_HEX;
}

+ (int) DEC
{
	return (int) QLCDNUMBER_DEC;
}

+ (int) OCT
{
	return (int) QLCDNUMBER_OCT;
}

+ (int) BIN
{
	return (int) QLCDNUMBER_BIN;
}

+ (int) Outline
{
	return (int) QLCDNUMBER_Outline;
}

+ (int) Filled
{
	return (int) QLCDNUMBER_Filled;
}

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

@end
