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

@implementation  KFontCombo


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

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

- initWithArray: (NSArray *)fonts parent: (QWidget *)parent name: (NSString *)name
{
static qt_QStringList * _qlist_fonts = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KFontCombo1((qt_QStringList*) [fonts toQStringList: (void *)&_qlist_fonts], (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithArray: (NSArray *)fonts parent: (QWidget *)parent 
{
static qt_QStringList * _qlist_fonts = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KFontCombo1((qt_QStringList*) [fonts toQStringList: (void *)&_qlist_fonts], (qt_QWidget *) [parent qt], 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_KFontCombo((kde_KFontCombo *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setFonts: (NSArray *)fonts
{
static qt_QStringList * _qlist_fonts = 0L;
	kde_KFontCombo_setFonts((kde_KFontCombo *)[self qt], (qt_QStringList*) [fonts toQStringList: (void *)&_qlist_fonts]);
	return self;
}

- setCurrentFont: (NSString *)family
{
static qt_QString * _qstring_family = 0L;
	kde_KFontCombo_setCurrentFont((kde_KFontCombo *)[self qt], (qt_QString *) [family toQString: &_qstring_family]);
	return self;
}

- (NSString *) currentFont
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KFontCombo_currentFont((kde_KFontCombo *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setBold: (BOOL)bold
{
	kde_KFontCombo_setBold((kde_KFontCombo *)[self qt], (int)bold);
	return self;
}

- (BOOL) bold
{
	return (BOOL) kde_KFontCombo_bold((kde_KFontCombo *)[self qt]);
}

- setItalic: (BOOL)bold
{
	kde_KFontCombo_setItalic((kde_KFontCombo *)[self qt], (int)bold);
	return self;
}

- (BOOL) italic
{
	return (BOOL) kde_KFontCombo_italic((kde_KFontCombo *)[self qt]);
}

- setUnderline: (BOOL)bold
{
	kde_KFontCombo_setUnderline((kde_KFontCombo *)[self qt], (int)bold);
	return self;
}

- (BOOL) underline
{
	return (BOOL) kde_KFontCombo_underline((kde_KFontCombo *)[self qt]);
}

- setStrikeOut: (BOOL)bold
{
	kde_KFontCombo_setStrikeOut((kde_KFontCombo *)[self qt], (int)bold);
	return self;
}

- (BOOL) strikeOut
{
	return (BOOL) kde_KFontCombo_strikeOut((kde_KFontCombo *)[self qt]);
}

- setSize: (int)size
{
	kde_KFontCombo_setSize((kde_KFontCombo *)[self qt], (int)size);
	return self;
}

- (int) size
{
	return (int) kde_KFontCombo_size((kde_KFontCombo *)[self qt]);
}

- setCurrentItem: (int)i
{
	kde_KFontCombo_setCurrentItem((kde_KFontCombo *)[self qt], (int)i);
	return self;
}

+ (BOOL) displayFonts
{
	return (BOOL) kde_KFontCombo_displayFonts();
}

- updateFonts
{
	kde_KFontCombo_updateFonts((kde_KFontCombo *)[self qt]);
	return self;
}

@end
