/***************************************************************************
                            KXMLGUIBuilder.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_KXMLGUIBuilder.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KXMLGUIBuilder.h>
#include <kdeobjc/KInstance.h>
#include <kdeobjc/KXMLGUIClient.h>
#include <qtobjc/QDomElement.h>
#include <qtobjc/QWidget.h>


@implementation  KXMLGUIBuilder


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

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			kde_del_KXMLGUIBuilder((kde_KXMLGUIBuilder *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (KXMLGUIClient*) builderClient
{
	return (KXMLGUIClient*) [QtSupport objectForQtKey: kde_KXMLGUIBuilder_builderClient((kde_KXMLGUIBuilder *)[self qt]) withClass: [KXMLGUIClient class] allocatedInObjcWorld: YES];
}

- setBuilderClient: (KXMLGUIClient*)client
{
	kde_KXMLGUIBuilder_setBuilderClient((kde_KXMLGUIBuilder *)[self qt], (kde_KXMLGUIClient*) [client qt]);
	return self;
}

- (KInstance*) builderInstance
{
	return (KInstance*) [QtSupport objectForQtKey: kde_KXMLGUIBuilder_builderInstance((kde_KXMLGUIBuilder *)[self qt]) withClass: [KInstance class] allocatedInObjcWorld: YES];
}

- setBuilderInstance: (KInstance*)instance
{
	kde_KXMLGUIBuilder_setBuilderInstance((kde_KXMLGUIBuilder *)[self qt], (kde_KInstance*) [instance qt]);
	return self;
}

- (NSArray *) containerTags
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KXMLGUIBuilder_containerTags((kde_KXMLGUIBuilder *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (QWidget*) createContainer: (QWidget *)parent index: (int)index element: (QDomElement*)element identifier: (int)identifier
{
	return (QWidget*) [QtSupport objectForQtKey: kde_KXMLGUIBuilder_createContainer((kde_KXMLGUIBuilder *)[self qt], (qt_QWidget *) [parent qt], (int)index, (qt_QDomElement*) [element qt], (int)identifier) withClass: [QWidget class] allocatedInObjcWorld: YES];
}

- removeContainer: (QWidget *)container parent: (QWidget *)parent element: (QDomElement*)element identifier: (int)identifier
{
	kde_KXMLGUIBuilder_removeContainer((kde_KXMLGUIBuilder *)[self qt], (qt_QWidget *) [container qt], (qt_QWidget *) [parent qt], (qt_QDomElement*) [element qt], (int)identifier);
	return self;
}

- (NSArray *) customTags
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KXMLGUIBuilder_customTags((kde_KXMLGUIBuilder *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (int) createCustomElement: (QWidget *)parent index: (int)index element: (QDomElement*)element
{
	return (int) kde_KXMLGUIBuilder_createCustomElement((kde_KXMLGUIBuilder *)[self qt], (qt_QWidget *) [parent qt], (int)index, (qt_QDomElement*) [element qt]);
}

- removeCustomElement: (QWidget *)parent identifier: (int)identifier
{
	kde_KXMLGUIBuilder_removeCustomElement((kde_KXMLGUIBuilder *)[self qt], (qt_QWidget *) [parent qt], (int)identifier);
	return self;
}

- finalizeXMLGUI: (KXMLGUIClient*)client
{
	kde_KXMLGUIBuilder_finalizeGUI((kde_KXMLGUIBuilder *)[self qt], (kde_KXMLGUIClient*) [client qt]);
	return self;
}
- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


@end
