/***************************************************************************
                            KIconTheme.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_KIconTheme.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KIconTheme.h>

@implementation  KIconTheme

- (void *) qt
{
	return _qt;
}

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

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

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


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

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

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

- (NSString *) name
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_name((kde_KIconTheme *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) description
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_description((kde_KIconTheme *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) example
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_example((kde_KIconTheme *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) screenshot
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_screenshot((kde_KIconTheme *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) linkOverlay
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_linkOverlay((kde_KIconTheme *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) zipOverlay
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_zipOverlay((kde_KIconTheme *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) lockOverlay
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_lockOverlay((kde_KIconTheme *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) dir
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_dir((kde_KIconTheme *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSArray *) inherits
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KIconTheme_inherits((kde_KIconTheme *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (BOOL) isValid
{
	return (BOOL) kde_KIconTheme_isValid((kde_KIconTheme *)[self qt]);
}

- (int) depth
{
	return (int) kde_KIconTheme_depth((kde_KIconTheme *)[self qt]);
}

- (int) defaultSize: (int)group
{
	return (int) kde_KIconTheme_defaultSize((kde_KIconTheme *)[self qt], (int)group);
}

- (NSArray *) queryIcons: (int)size context: (int)context
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KIconTheme_queryIcons((kde_KIconTheme *)[self qt], (int)size, (int)context);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (NSArray *) queryIconsByContext: (int)size context: (int)context
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KIconTheme_queryIconsByContext((kde_KIconTheme *)[self qt], (int)size, (int)context);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (KIcon*) iconPath: (NSString *)name size: (int)size match: (int)match
{
static qt_QString * _qstring_name = 0L;
	return (KIcon*) [QtSupport objectForQtKey: kde_KIconTheme_iconPath((kde_KIconTheme *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (int)size, (int)match) withClass: [KIcon class] allocatedInObjcWorld: YES];
}

+ (NSArray *) list
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KIconTheme_list();
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

+ (NSString *) current
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconTheme_current();
	return [NSString fromQString: _qstring];
}

+ reconfigure
{
	kde_KIconTheme_reconfigure();
	return self;
}

@end
