/***************************************************************************
                            KProgress.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 <qtc/qt_QRangeControl.h>
#include <kdec/kde_KProgress.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KProgress.h>
#include <qtobjc/QPixmap.h>


@implementation  KProgress


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

- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KProgress(0, 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithInt: (int)totalSteps 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KProgress1((int)totalSteps, 0, 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_KProgress((kde_KProgress *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setTextEnabled: (BOOL)arg1
{
	kde_KProgress_setTextEnabled((kde_KProgress *)[self qt], (int)arg1);
	return self;
}

- (int) value
{
	return (int) kde_KProgress_value((kde_KProgress *)[self qt]);
}

- (BOOL) textEnabled
{
	return (BOOL) kde_KProgress_textEnabled((kde_KProgress *)[self qt]);
}

- (NSString *) format
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KProgress_format((kde_KProgress *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setRange: (int)min max: (int)max
{
	kde_KProgress_setRange((kde_KProgress *)[self qt], (int)min, (int)max);
	return self;
}

- (int) maxValue
{
	return (int) kde_KProgress_maxValue((kde_KProgress *)[self qt]);
}

- setFormat: (NSString *)format
{
static qt_QString * _qstring_format = 0L;
	kde_KProgress_setFormat((kde_KProgress *)[self qt], (qt_QString *) [format toQString: &_qstring_format]);
	return self;
}

- setTotalSteps: (int)totalSteps
{
	kde_KProgress_setTotalSteps((kde_KProgress *)[self qt], (int)totalSteps);
	return self;
}

- setValue: (int)progress
{
	kde_KProgress_setValue((kde_KProgress *)[self qt], (int)progress);
	return self;
}

- advance: (int)offset
{
	kde_KProgress_advance((kde_KProgress *)[self qt], (int)offset);
	return self;
}

@end
