/***************************************************************************
                            KIconDialog.m -  description
                             -------------------
    begin                : Thu Mar 21 01:01:29 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Thu Mar 21 01:01:29 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_KIconDialog.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KIconDialog.h>
#include <kdeobjc/KIconLoader.h>


@implementation  KIconDialog


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

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

- initWithIconLoader: (KIconLoader*)loader 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KIconDialog1((kde_KIconLoader*) [loader qt], 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) {
			kde_del_KIconDialog((kde_KIconDialog *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setStrictIconSize: (BOOL)b
{
	kde_KIconDialog_setStrictIconSize((kde_KIconDialog *)[self qt], (int)b);
	return self;
}

- (BOOL) strictIconSize
{
	return (BOOL) kde_KIconDialog_strictIconSize((kde_KIconDialog *)[self qt]);
}

- setIconSize: (int)size
{
	kde_KIconDialog_setIconSize((kde_KIconDialog *)[self qt], (int)size);
	return self;
}

- (int) iconSize
{
	return (int) kde_KIconDialog_iconSize((kde_KIconDialog *)[self qt]);
}

- (NSString *) selectIcon: (int)group context: (int)context user: (BOOL)user
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconDialog_selectIcon((kde_KIconDialog *)[self qt], (int)group, (int)context, (int)user);
	return [NSString fromQString: _qstring];
}

- setup: (int)group context: (int)context strictIconSize: (BOOL)strictIconSize iconSize: (int)iconSize user: (BOOL)user
{
	kde_KIconDialog_setup((kde_KIconDialog *)[self qt], (int)group, (int)context, (int)strictIconSize, (int)iconSize, (int)user);
	return self;
}

- setup: (int)group 
{
	kde_KIconDialog_setup((kde_KIconDialog *)[self qt], (int)group, [KIcon Application], 0, 0, 0);
	return self;
}

- (NSString *) openDialog
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconDialog_openDialog((kde_KIconDialog *)[self qt]);
	return [NSString fromQString: _qstring];
}

+ (NSString *) getIcon: (int)group context: (int)context strictIconSize: (BOOL)strictIconSize iconSize: (int)iconSize user: (BOOL)user parent: (QWidget *)parent caption: (NSString *)caption
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_caption = 0L;
	_qstring = kde_KIconDialog_getIcon((int)group, (int)context, (int)strictIconSize, (int)iconSize, (int)user, (qt_QWidget *) [parent qt], (qt_QString *) [caption toQString: &_qstring_caption]);
	return [NSString fromQString: _qstring];
}

- virtual_hook: (int)identifier data: (void*)data
{
	kde_KIconDialog_virtual_hook((kde_KIconDialog *)[self qt], (int)identifier, (void*)data);
	return self;
}

@end
