/***************************************************************************
                            QMessageBox.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_QMessageBox.h>
#include <qtobjc/QMessageBox.h>
#include <qtobjc/QStyle.h>
#include <qtobjc/QPixmap.h>

@implementation  QMessageBox


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

- initWithText: (NSString *)caption text: (NSString *)text icon: (int)icon button0: (int)button0 button1: (int)button1 button2: (int)button2 parent: (QWidget *)parent name: (NSString *)name modal: (BOOL)modal f: (int)f
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QMessageBox1((qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (int)icon, (int)button0, (int)button1, (int)button2, (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 *)caption text: (NSString *)text icon: (int)icon button0: (int)button0 button1: (int)button1 button2: (int)button2 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QMessageBox1((qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (int)icon, (int)button0, (int)button1, (int)button2, 0, 0, 1, [QMessageBox WStyle_DialogBorder])];
		[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_QMessageBox((qt_QMessageBox *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (NSString *) text
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QMessageBox_text((qt_QMessageBox *)[self qt]);
	return [NSString fromQString: _qstring];
}

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

- (int) icon
{
	return (int) qt_QMessageBox_icon((qt_QMessageBox *)[self qt]);
}

- setIcon: (int)arg1
{
	qt_QMessageBox_setIcon((qt_QMessageBox *)[self qt], (int)arg1);
	return self;
}

- setIconWithPixmap: (QPixmap *)arg1
{
	qt_QMessageBox_setIcon1((qt_QMessageBox *)[self qt], (qt_QPixmap *) [arg1 qt]);
	return self;
}

- (QPixmap*) iconPixmap
{
	return (QPixmap*) [QtSupport objectForQtKey: qt_QMessageBox_iconPixmap((qt_QMessageBox *)[self qt]) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- setIconPixmap: (QPixmap *)arg1
{
	qt_QMessageBox_setIconPixmap((qt_QMessageBox *)[self qt], (qt_QPixmap *) [arg1 qt]);
	return self;
}

- (NSString *) buttonText: (int)button
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QMessageBox_buttonText((qt_QMessageBox *)[self qt], (int)button);
	return [NSString fromQString: _qstring];
}

- setButtonText: (int)button string: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QMessageBox_setButtonText((qt_QMessageBox *)[self qt], (int)button, (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- adjustSize
{
	qt_QMessageBox_adjustSize((qt_QMessageBox *)[self qt]);
	return self;
}

- (int) textFormat
{
	return (int) qt_QMessageBox_textFormat((qt_QMessageBox *)[self qt]);
}

- setTextFormat: (int)arg1
{
	qt_QMessageBox_setTextFormat((qt_QMessageBox *)[self qt], (int)arg1);
	return self;
}

+ (int) information: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0: (int)button0 button1: (int)button1 button2: (int)button2
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_information((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (int)button0, (int)button1, (int)button2);
}

+ (int) information: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0: (int)button0 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_information((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (int)button0, 0, 0);
}

+ (int) information: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0Text: (NSString *)button0Text button1Text: (NSString *)button1Text button2Text: (NSString *)button2Text defaultButtonNumber: (int)defaultButtonNumber escapeButtonNumber: (int)escapeButtonNumber
{
static qt_QString * _qstring_button2Text = 0L;
static qt_QString * _qstring_button1Text = 0L;
static qt_QString * _qstring_button0Text = 0L;
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_information1((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [button0Text toQString: &_qstring_button0Text], (qt_QString *) [button1Text toQString: &_qstring_button1Text], (qt_QString *) [button2Text toQString: &_qstring_button2Text], (int)defaultButtonNumber, (int)escapeButtonNumber);
}

+ (int) information: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_information1((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], qt_QString_null(), qt_QString_null(), qt_QString_null(), 0, -1);
}

+ (int) warning: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0: (int)button0 button1: (int)button1 button2: (int)button2
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_warning((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (int)button0, (int)button1, (int)button2);
}

+ (int) warning: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0: (int)button0 button1: (int)button1 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_warning((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (int)button0, (int)button1, 0);
}

+ (int) warning: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0Text: (NSString *)button0Text button1Text: (NSString *)button1Text button2Text: (NSString *)button2Text defaultButtonNumber: (int)defaultButtonNumber escapeButtonNumber: (int)escapeButtonNumber
{
static qt_QString * _qstring_button2Text = 0L;
static qt_QString * _qstring_button1Text = 0L;
static qt_QString * _qstring_button0Text = 0L;
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_warning1((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [button0Text toQString: &_qstring_button0Text], (qt_QString *) [button1Text toQString: &_qstring_button1Text], (qt_QString *) [button2Text toQString: &_qstring_button2Text], (int)defaultButtonNumber, (int)escapeButtonNumber);
}

+ (int) warning: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_warning1((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], qt_QString_null(), qt_QString_null(), qt_QString_null(), 0, -1);
}

+ (int) critical: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0: (int)button0 button1: (int)button1 button2: (int)button2
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_critical((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (int)button0, (int)button1, (int)button2);
}

+ (int) critical: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0: (int)button0 button1: (int)button1 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_critical((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (int)button0, (int)button1, 0);
}

+ (int) critical: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text button0Text: (NSString *)button0Text button1Text: (NSString *)button1Text button2Text: (NSString *)button2Text defaultButtonNumber: (int)defaultButtonNumber escapeButtonNumber: (int)escapeButtonNumber
{
static qt_QString * _qstring_button2Text = 0L;
static qt_QString * _qstring_button1Text = 0L;
static qt_QString * _qstring_button0Text = 0L;
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_critical1((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [button0Text toQString: &_qstring_button0Text], (qt_QString *) [button1Text toQString: &_qstring_button1Text], (qt_QString *) [button2Text toQString: &_qstring_button2Text], (int)defaultButtonNumber, (int)escapeButtonNumber);
}

+ (int) critical: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_critical1((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], qt_QString_null(), qt_QString_null(), qt_QString_null(), 0, -1);
}

+ about: (QWidget *)parent caption: (NSString *)caption text: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	qt_QMessageBox_about((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text]);
	return self;
}

+ aboutQt: (QWidget *)parent caption: (NSString *)caption
{
static qt_QString * _qstring_caption = 0L;
	qt_QMessageBox_aboutQt((qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption]);
	return self;
}

+ aboutQt: (QWidget *)parent 
{
	qt_QMessageBox_aboutQt((qt_QWidget *) [parent qt], qt_QString_null());
	return self;
}

+ (int) message: (NSString *)caption text: (NSString *)text buttonText: (NSString *)buttonText parent: (QWidget *)parent string: (NSString *)arg1
{
static qt_QString * _qstring_buttonText = 0L;
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_message((qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [buttonText toQString: &_qstring_buttonText], (qt_QWidget *) [parent qt], (char*) [arg1 cString]);
}

+ (int) message: (NSString *)caption text: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (int) qt_QMessageBox_message((qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], qt_QString_null(), 0, 0);
}

+ (BOOL) query: (NSString *)caption text: (NSString *)text yesButtonText: (NSString *)yesButtonText noButtonText: (NSString *)noButtonText parent: (QWidget *)parent string: (NSString *)arg1
{
static qt_QString * _qstring_noButtonText = 0L;
static qt_QString * _qstring_yesButtonText = 0L;
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (BOOL) qt_QMessageBox_query((qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [yesButtonText toQString: &_qstring_yesButtonText], (qt_QString *) [noButtonText toQString: &_qstring_noButtonText], (qt_QWidget *) [parent qt], (char*) [arg1 cString]);
}

+ (BOOL) query: (NSString *)caption text: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_caption = 0L;
	return (BOOL) qt_QMessageBox_query((qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [text toQString: &_qstring_text], qt_QString_null(), qt_QString_null(), 0, 0);
}

+ (QPixmap*) standardIcon: (int)icon int: (int)arg1
{
	return (QPixmap*) [QtSupport objectForQtKey: qt_QMessageBox_standardIcon((int)icon, (int)arg1) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

+ (QPixmap*) standardIcon: (int)icon
{
	return (QPixmap*) [QtSupport objectForQtKey: qt_QMessageBox_standardIcon1((int)icon) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- styleChanged: (QStyle*)arg1
{
	qt_QMessageBox_styleChanged((qt_QMessageBox *)[self qt], (qt_QStyle*) [arg1 qt]);
	return self;
}

+ (int) NoIcon
{
	return (int) QMESSAGEBOX_NoIcon;
}

+ (int) Information
{
	return (int) QMESSAGEBOX_Information;
}

+ (int) Warning
{
	return (int) QMESSAGEBOX_Warning;
}

+ (int) Critical
{
	return (int) QMESSAGEBOX_Critical;
}

+ (int) NoButton
{
	return (int) QMESSAGEBOX_NoButton;
}

+ (int) Ok
{
	return (int) QMESSAGEBOX_Ok;
}

+ (int) Cancel
{
	return (int) QMESSAGEBOX_Cancel;
}

+ (int) Yes
{
	return (int) QMESSAGEBOX_Yes;
}

+ (int) No
{
	return (int) QMESSAGEBOX_No;
}

+ (int) Abort
{
	return (int) QMESSAGEBOX_Abort;
}

+ (int) Retry
{
	return (int) QMESSAGEBOX_Retry;
}

+ (int) Ignore
{
	return (int) QMESSAGEBOX_Ignore;
}

+ (int) ButtonMask
{
	return (int) QMESSAGEBOX_ButtonMask;
}

+ (int) Default
{
	return (int) QMESSAGEBOX_Default;
}

+ (int) Escape
{
	return (int) QMESSAGEBOX_Escape;
}

+ (int) FlagMask
{
	return (int) QMESSAGEBOX_FlagMask;
}

@end
