/***************************************************************************
                            QPushButton.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_QPushButton.h>
#include <qtobjc/QPushButton.h>
#include <qtobjc/QPoint.h>
#include <qtobjc/QRect.h>

#include <qtobjc/QPainter.h>
#include <qtobjc/QIconSet.h>
#include <qtobjc/QPopupMenu.h>

@implementation  QPushButton


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

- initWithWidget: (QWidget *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPushButton((qt_QWidget *) [parent qt], 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text parent: (QWidget *)parent name: (NSString *)name
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPushButton1((qt_QString *) [text toQString: &_qstring_text], (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text parent: (QWidget *)parent 
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPushButton1((qt_QString *) [text toQString: &_qstring_text], (qt_QWidget *) [parent qt], 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithIconSet: (QIconSet*)icon text: (NSString *)text parent: (QWidget *)parent name: (NSString *)name
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPushButton2((qt_QIconSet*) [icon qt], (qt_QString *) [text toQString: &_qstring_text], (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithIconSet: (QIconSet*)icon text: (NSString *)text parent: (QWidget *)parent 
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPushButton2((qt_QIconSet*) [icon qt], (qt_QString *) [text toQString: &_qstring_text], (qt_QWidget *) [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 parentWidget: YES] == nil) {
			qt_del_QPushButton((qt_QPushButton *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

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

- move: (int)x y: (int)y
{
	qt_QPushButton_move((qt_QPushButton *)[self qt], (int)x, (int)y);
	return self;
}

- move: (QPoint*)p
{
	qt_QPushButton_move1((qt_QPushButton *)[self qt], (qt_QPoint*) [p qt]);
	return self;
}

- resize: (int)w h: (int)h
{
	qt_QPushButton_resize((qt_QPushButton *)[self qt], (int)w, (int)h);
	return self;
}

- resize: (QSize *)arg1
{
	qt_QPushButton_resize1((qt_QPushButton *)[self qt], (qt_QSize *) [arg1 qt]);
	return self;
}

- setGeometry: (int)x y: (int)y w: (int)w h: (int)h
{
	qt_QPushButton_setGeometry((qt_QPushButton *)[self qt], (int)x, (int)y, (int)w, (int)h);
	return self;
}

- setGeometry: (QRect*)arg1
{
	qt_QPushButton_setGeometry1((qt_QPushButton *)[self qt], (qt_QRect*) [arg1 qt]);
	return self;
}

- setToggleButton: (BOOL)arg1
{
	qt_QPushButton_setToggleButton((qt_QPushButton *)[self qt], (int)arg1);
	return self;
}

- (BOOL) autoDefault
{
	return (BOOL) qt_QPushButton_autoDefault((qt_QPushButton *)[self qt]);
}

- setAutoDefault: (BOOL)autoDef
{
	qt_QPushButton_setAutoDefault((qt_QPushButton *)[self qt], (int)autoDef);
	return self;
}

- (BOOL) isDefault
{
	return (BOOL) qt_QPushButton_isDefault((qt_QPushButton *)[self qt]);
}

- setDefault: (BOOL)def
{
	qt_QPushButton_setDefault((qt_QPushButton *)[self qt], (int)def);
	return self;
}

- setIsMenuButton: (BOOL)enable
{
	qt_QPushButton_setIsMenuButton((qt_QPushButton *)[self qt], (int)enable);
	return self;
}

- (BOOL) isMenuButton
{
	return (BOOL) qt_QPushButton_isMenuButton((qt_QPushButton *)[self qt]);
}

- setPopup: (QPopupMenu*)popup
{
	qt_QPushButton_setPopup((qt_QPushButton *)[self qt], (qt_QPopupMenu*) [popup qt]);
	return self;
}

- (QPopupMenu*) popup
{
	return (QPopupMenu*) [QtSupport objectForQtKey: qt_QPushButton_popup((qt_QPushButton *)[self qt]) withClass: [QPopupMenu class] allocatedInObjcWorld: YES];
}

- setIconSet: (QIconSet*)arg1
{
	qt_QPushButton_setIconSet((qt_QPushButton *)[self qt], (qt_QIconSet*) [arg1 qt]);
	return self;
}

- (QIconSet*) iconSet
{
	return (QIconSet*) [QtSupport objectForQtKey: qt_QPushButton_iconSet((qt_QPushButton *)[self qt]) withClass: [QIconSet class] allocatedInObjcWorld: YES];
}

- setFlat: (BOOL)arg1
{
	qt_QPushButton_setFlat((qt_QPushButton *)[self qt], (int)arg1);
	return self;
}

- (BOOL) isFlat
{
	return (BOOL) qt_QPushButton_isFlat((qt_QPushButton *)[self qt]);
}

- setOn: (BOOL)arg1
{
	qt_QPushButton_setOn((qt_QPushButton *)[self qt], (int)arg1);
	return self;
}

- drawButton: (QPainter *)arg1
{
	qt_QPushButton_drawButton((qt_QPushButton *)[self qt], (qt_QPainter *) [arg1 qt]);
	return self;
}

- drawButtonLabel: (QPainter *)arg1
{
	qt_QPushButton_drawButtonLabel((qt_QPushButton *)[self qt], (qt_QPainter *) [arg1 qt]);
	return self;
}

- updateMask
{
	qt_QPushButton_updateMask((qt_QPushButton *)[self qt]);
	return self;
}

@end
