/***************************************************************************
                            QButton.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_QButton.h>
#include <qtobjc/QButton.h>
#include <qtobjc/QKeySequence.h>
#include <qtobjc/QPoint.h>

#include <qtobjc/QPainter.h>
#include <qtobjc/QPixmap.h>

@implementation  QButton


- initWithWidget: (QWidget *)parent name: (NSString *)name f: (int)f
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QButton((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: qt_new_QButton(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_QButton((qt_QButton *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

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

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

- (QPixmap*) pixmap
{
	return (QPixmap*) [QtSupport objectForQtKey: qt_QButton_pixmap((qt_QButton *)[self qt]) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- setPixmap: (QPixmap *)arg1
{
	qt_QButton_setPixmap((qt_QButton *)[self qt], (qt_QPixmap *) [arg1 qt]);
	return self;
}

- (QKeySequence*) accel
{
	return (QKeySequence*) [QtSupport objectForQtKey: qt_QButton_accel((qt_QButton *)[self qt]) withClass: [QKeySequence class] allocatedInObjcWorld: YES];
}

- setAccel: (QKeySequence*)arg1
{
	qt_QButton_setAccel((qt_QButton *)[self qt], (qt_QKeySequence*) [arg1 qt]);
	return self;
}

- (BOOL) isToggleButton
{
	return (BOOL) qt_QButton_isToggleButton((qt_QButton *)[self qt]);
}

- (int) toggleType
{
	return (int) qt_QButton_toggleType((qt_QButton *)[self qt]);
}

- setDown: (BOOL)arg1
{
	qt_QButton_setDown((qt_QButton *)[self qt], (int)arg1);
	return self;
}

- (BOOL) isDown
{
	return (BOOL) qt_QButton_isDown((qt_QButton *)[self qt]);
}

- (BOOL) isOn
{
	return (BOOL) qt_QButton_isOn((qt_QButton *)[self qt]);
}

- (int) state
{
	return (int) qt_QButton_state((qt_QButton *)[self qt]);
}

- (BOOL) autoResize
{
	return (BOOL) qt_QButton_autoResize((qt_QButton *)[self qt]);
}

- setAutoResize: (BOOL)arg1
{
	qt_QButton_setAutoResize((qt_QButton *)[self qt], (int)arg1);
	return self;
}

- (BOOL) autoRepeat
{
	return (BOOL) qt_QButton_autoRepeat((qt_QButton *)[self qt]);
}

- setAutoRepeat: (BOOL)arg1
{
	qt_QButton_setAutoRepeat((qt_QButton *)[self qt], (int)arg1);
	return self;
}

- (BOOL) isExclusiveToggle
{
	return (BOOL) qt_QButton_isExclusiveToggle((qt_QButton *)[self qt]);
}

- (QButtonGroup*) group
{
	return (QButtonGroup*) [QtSupport objectForQtKey: qt_QButton_group((qt_QButton *)[self qt]) withClass: [QButtonGroup class] allocatedInObjcWorld: YES];
}

- animateClick
{
	qt_QButton_animateClick((qt_QButton *)[self qt]);
	return self;
}

- toggle
{
	qt_QButton_toggle((qt_QButton *)[self qt]);
	return self;
}

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

- setToggleType: (int)arg1
{
	qt_QButton_setToggleType((qt_QButton *)[self qt], (int)arg1);
	return self;
}

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

- setState: (int)arg1
{
	qt_QButton_setState((qt_QButton *)[self qt], (int)arg1);
	return self;
}

- (BOOL) hitButton: (QPoint*)pos
{
	return (BOOL) qt_QButton_hitButton((qt_QButton *)[self qt], (qt_QPoint*) [pos qt]);
}

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

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

- enabledChange: (BOOL)arg1
{
	qt_QButton_enabledChange((qt_QButton *)[self qt], (int)arg1);
	return self;
}

+ (int) SingleShot
{
	return (int) QBUTTON_SingleShot;
}

+ (int) Toggle
{
	return (int) QBUTTON_Toggle;
}

+ (int) Tristate
{
	return (int) QBUTTON_Tristate;
}

+ (int) Off
{
	return (int) QBUTTON_Off;
}

+ (int) NoChange
{
	return (int) QBUTTON_NoChange;
}

+ (int) On
{
	return (int) QBUTTON_On;
}

@end
