/***************************************************************************
                            KButtonBox.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 <kdec/kde_KButtonBox.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KButtonBox.h>
#include <qtobjc/QPushButton.h>


@implementation  KButtonBox


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

- initWithWidget: (QWidget *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KButtonBox((qt_QWidget *) [parent qt], [KButtonBox Horizontal], 0, 6)];
		[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_KButtonBox((kde_KButtonBox *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

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

- (QPushButton*) addButton: (NSString *)text noexpand: (BOOL)noexpand
{
static qt_QString * _qstring_text = 0L;
	return (QPushButton*) [QtSupport objectForQtKey: kde_KButtonBox_addButton((kde_KButtonBox *)[self qt], (qt_QString *) [text toQString: &_qstring_text], (int)noexpand) withClass: [QPushButton class] allocatedInObjcWorld: YES];
}

- (QPushButton*) addButton: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
	return (QPushButton*) [QtSupport objectForQtKey: kde_KButtonBox_addButton((kde_KButtonBox *)[self qt], (qt_QString *) [text toQString: &_qstring_text], 0) withClass: [QPushButton class] allocatedInObjcWorld: YES];
}

- (QPushButton*) addButton: (NSString *)text receiver: (QObject *)receiver slot: (NSString *)slot noexpand: (BOOL)noexpand
{
static qt_QString * _qstring_text = 0L;
	return (QPushButton*) [QtSupport objectForQtKey: kde_KButtonBox_addButton1((kde_KButtonBox *)[self qt], (qt_QString *) [text toQString: &_qstring_text], (qt_QObject *) [receiver qt], (char*) [slot cString], (int)noexpand) withClass: [QPushButton class] allocatedInObjcWorld: YES];
}

- (QPushButton*) addButton: (NSString *)text receiver: (QObject *)receiver slot: (NSString *)slot 
{
static qt_QString * _qstring_text = 0L;
	return (QPushButton*) [QtSupport objectForQtKey: kde_KButtonBox_addButton1((kde_KButtonBox *)[self qt], (qt_QString *) [text toQString: &_qstring_text], (qt_QObject *) [receiver qt], (char*) [slot cString], 0) withClass: [QPushButton class] allocatedInObjcWorld: YES];
}

- addStretch: (int)scale
{
	kde_KButtonBox_addStretch((kde_KButtonBox *)[self qt], (int)scale);
	return self;
}

- addStretch
{
	kde_KButtonBox_addStretch((kde_KButtonBox *)[self qt], 1);
	return self;
}

- layout
{
	kde_KButtonBox_layout((kde_KButtonBox *)[self qt]);
	return self;
}

- (QSize*) bestButtonSize
{
	return (QSize*) [QtSupport objectForQtKey: kde_KButtonBox_bestButtonSize((kde_KButtonBox *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- placeButtons
{
	kde_KButtonBox_placeButtons((kde_KButtonBox *)[self qt]);
	return self;
}

- (QSize*) buttonSizeHint: (QPushButton*)arg1
{
	return (QSize*) [QtSupport objectForQtKey: kde_KButtonBox_buttonSizeHint((kde_KButtonBox *)[self qt], (qt_QPushButton*) [arg1 qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

@end
