/***************************************************************************
                            QButtonGroup.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_QButtonGroup.h>
#include <qtobjc/QButtonGroup.h>
#include <qtobjc/QButton.h>

@implementation  QButtonGroup


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

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

- initWithText: (NSString *)title 
{
static qt_QString * _qstring_title = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QButtonGroup1((qt_QString *) [title toQString: &_qstring_title], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

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

- initWithInt: (int)columns o: (int)o title: (NSString *)title parent: (QWidget *)parent name: (NSString *)name
{
static qt_QString * _qstring_title = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QButtonGroup3((int)columns, (int)o, (qt_QString *) [title toQString: &_qstring_title], (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)columns o: (int)o title: (NSString *)title 
{
static qt_QString * _qstring_title = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QButtonGroup3((int)columns, (int)o, (qt_QString *) [title toQString: &_qstring_title], 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_QButtonGroup((qt_QButtonGroup *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) isExclusive
{
	return (BOOL) qt_QButtonGroup_isExclusive((qt_QButtonGroup *)[self qt]);
}

- (BOOL) isRadioButtonExclusive
{
	return (BOOL) qt_QButtonGroup_isRadioButtonExclusive((qt_QButtonGroup *)[self qt]);
}

- setExclusive: (BOOL)arg1
{
	qt_QButtonGroup_setExclusive((qt_QButtonGroup *)[self qt], (int)arg1);
	return self;
}

- setRadioButtonExclusive: (BOOL)arg1
{
	qt_QButtonGroup_setRadioButtonExclusive((qt_QButtonGroup *)[self qt], (int)arg1);
	return self;
}

- (int) insert: (QButton *)arg1 identifier: (int)identifier
{
	return (int) qt_QButtonGroup_insert((qt_QButtonGroup *)[self qt], (qt_QButton *) [arg1 qt], (int)identifier);
}

- (int) insert: (QButton *)arg1 
{
	return (int) qt_QButtonGroup_insert((qt_QButtonGroup *)[self qt], (qt_QButton *) [arg1 qt], -1);
}

- remove: (QButton *)arg1
{
	qt_QButtonGroup_remove((qt_QButtonGroup *)[self qt], (qt_QButton *) [arg1 qt]);
	return self;
}

- (QButton*) find: (int)identifier
{
	return (QButton*) [QtSupport objectForQtKey: qt_QButtonGroup_find((qt_QButtonGroup *)[self qt], (int)identifier) withClass: [QButton class] allocatedInObjcWorld: YES];
}

- (int) id: (QButton *)arg1
{
	return (int) qt_QButtonGroup_id((qt_QButtonGroup *)[self qt], (qt_QButton *) [arg1 qt]);
}

- (int) count
{
	return (int) qt_QButtonGroup_count((qt_QButtonGroup *)[self qt]);
}

- setButton: (int)identifier
{
	qt_QButtonGroup_setButton((qt_QButtonGroup *)[self qt], (int)identifier);
	return self;
}

- moveFocus: (int)arg1
{
	qt_QButtonGroup_moveFocus((qt_QButtonGroup *)[self qt], (int)arg1);
	return self;
}

- (QButton*) selected
{
	return (QButton*) [QtSupport objectForQtKey: qt_QButtonGroup_selected((qt_QButtonGroup *)[self qt]) withClass: [QButton class] allocatedInObjcWorld: YES];
}

- buttonPressed
{
	qt_QButtonGroup_buttonPressed((qt_QButtonGroup *)[self qt]);
	return self;
}

- buttonReleased
{
	qt_QButtonGroup_buttonReleased((qt_QButtonGroup *)[self qt]);
	return self;
}

- buttonClicked
{
	qt_QButtonGroup_buttonClicked((qt_QButtonGroup *)[self qt]);
	return self;
}

- buttonToggled: (BOOL)on
{
	qt_QButtonGroup_buttonToggled((qt_QButtonGroup *)[self qt], (int)on);
	return self;
}

@end
