/***************************************************************************
                            QProgressDialog.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_QProgressDialog.h>
#include <qtobjc/QProgressDialog.h>
#include <qtobjc/QPushButton.h>
#include <qtobjc/QLabel.h>
#include <qtobjc/QProgressBar.h>
#include <qtobjc/QStyle.h>

@implementation  QProgressDialog


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

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

- initWithText: (NSString *)labelText cancelButtonText: (NSString *)cancelButtonText totalSteps: (int)totalSteps parent: (QWidget *)parent name: (NSString *)name modal: (BOOL)modal f: (int)f
{
static qt_QString * _qstring_cancelButtonText = 0L;
static qt_QString * _qstring_labelText = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QProgressDialog1((qt_QString *) [labelText toQString: &_qstring_labelText], (qt_QString *) [cancelButtonText toQString: &_qstring_cancelButtonText], (int)totalSteps, (qt_QWidget *) [parent qt], (char*) [name cString], (int)modal, (int)f)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)labelText cancelButtonText: (NSString *)cancelButtonText totalSteps: (int)totalSteps 
{
static qt_QString * _qstring_cancelButtonText = 0L;
static qt_QString * _qstring_labelText = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QProgressDialog1((qt_QString *) [labelText toQString: &_qstring_labelText], (qt_QString *) [cancelButtonText toQString: &_qstring_cancelButtonText], (int)totalSteps, 0, 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) {
			qt_del_QProgressDialog((qt_QProgressDialog *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setLabel: (QLabel *)arg1
{
	qt_QProgressDialog_setLabel((qt_QProgressDialog *)[self qt], (qt_QLabel *) [arg1 qt]);
	return self;
}

- setCancelButton: (QPushButton*)arg1
{
	qt_QProgressDialog_setCancelButton((qt_QProgressDialog *)[self qt], (qt_QPushButton*) [arg1 qt]);
	return self;
}

- setBar: (QProgressBar*)arg1
{
	qt_QProgressDialog_setBar((qt_QProgressDialog *)[self qt], (qt_QProgressBar*) [arg1 qt]);
	return self;
}

- (BOOL) wasCancelled
{
	return (BOOL) qt_QProgressDialog_wasCancelled((qt_QProgressDialog *)[self qt]);
}

- (int) totalSteps
{
	return (int) qt_QProgressDialog_totalSteps((qt_QProgressDialog *)[self qt]);
}

- (int) progress
{
	return (int) qt_QProgressDialog_progress((qt_QProgressDialog *)[self qt]);
}

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

- (NSString *) labelText
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QProgressDialog_labelText((qt_QProgressDialog *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setAutoReset: (BOOL)b
{
	qt_QProgressDialog_setAutoReset((qt_QProgressDialog *)[self qt], (int)b);
	return self;
}

- (BOOL) autoReset
{
	return (BOOL) qt_QProgressDialog_autoReset((qt_QProgressDialog *)[self qt]);
}

- setAutoClose: (BOOL)b
{
	qt_QProgressDialog_setAutoClose((qt_QProgressDialog *)[self qt], (int)b);
	return self;
}

- (BOOL) autoClose
{
	return (BOOL) qt_QProgressDialog_autoClose((qt_QProgressDialog *)[self qt]);
}

- (int) minimumDuration
{
	return (int) qt_QProgressDialog_minimumDuration((qt_QProgressDialog *)[self qt]);
}

- cancel
{
	qt_QProgressDialog_cancel((qt_QProgressDialog *)[self qt]);
	return self;
}

- reset
{
	qt_QProgressDialog_reset((qt_QProgressDialog *)[self qt]);
	return self;
}

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

- setProgress: (int)progress
{
	qt_QProgressDialog_setProgress((qt_QProgressDialog *)[self qt], (int)progress);
	return self;
}

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

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

- setMinimumDuration: (int)ms
{
	qt_QProgressDialog_setMinimumDuration((qt_QProgressDialog *)[self qt], (int)ms);
	return self;
}

- styleChange: (QStyle*)arg1
{
	qt_QProgressDialog_styleChange((qt_QProgressDialog *)[self qt], (qt_QStyle*) [arg1 qt]);
	return self;
}

- forceShow
{
	qt_QProgressDialog_forceShow((qt_QProgressDialog *)[self qt]);
	return self;
}

@end
