/***************************************************************************
                            KFontChooser.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_QStringList.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KFontChooser.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KFontChooser.h>
#include <qtobjc/QFont.h>


@implementation  KFontChooser


//- initWithWidget: (QWidget *)parent name: (NSString *)name onlyFixed: (BOOL)onlyFixed fontList: (NSArray *)fontList makeFrame: (BOOL)makeFrame visibleListSize: (int)visibleListSize diff: (BOOL)diff sizeIsRelativeState: (int*)sizeIsRelativeState
//{
//static qt_QStringList * _qlist_fontList = 0L;
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_KFontChooser((qt_QWidget *) [parent qt], (char*) [name cString], (int)onlyFixed, (qt_QStringList*) [fontList toQStringList: (void *)&_qlist_fontList], (int)makeFrame, (int)visibleListSize, (int)diff, (int*)sizeIsRelativeState)];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

//- init
//{
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_KFontChooser(0L, 0L, 0, qt_new_QStringList(), 1, 8, 0, 0L)];
//		[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_KFontChooser((kde_KFontChooser *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- enableColumn: (int)column state: (BOOL)state
{
	kde_KFontChooser_enableColumn((kde_KFontChooser *)[self qt], (int)column, (int)state);
	return self;
}

- setFont: (QFont *)font onlyFixed: (BOOL)onlyFixed
{
	kde_KFontChooser_setFont((kde_KFontChooser *)[self qt], (qt_QFont *) [font qt], (int)onlyFixed);
	return self;
}

- setFont: (QFont *)font 
{
	kde_KFontChooser_setFont((kde_KFontChooser *)[self qt], (qt_QFont *) [font qt], 0);
	return self;
}

- (int) fontDiffFlags
{
	return (int) kde_KFontChooser_fontDiffFlags((kde_KFontChooser *)[self qt]);
}

- (QFont*) font
{
	return (QFont*) [QtSupport objectForQtKey: kde_KFontChooser_font((kde_KFontChooser *)[self qt]) withClass: [QFont class] allocatedInObjcWorld: YES];
}

- setColor: (QColor *)col
{
	kde_KFontChooser_setColor((kde_KFontChooser *)[self qt], (qt_QColor *) [col qt]);
	return self;
}

- (QColor*) color
{
	return (QColor*) [QtSupport objectForQtKey: kde_KFontChooser_color((kde_KFontChooser *)[self qt]) withClass: [QColor class] allocatedInObjcWorld: YES];
}

- setBackgroundColor: (QColor *)col
{
	kde_KFontChooser_setBackgroundColor((kde_KFontChooser *)[self qt], (qt_QColor *) [col qt]);
	return self;
}

- (QColor*) backgroundColor
{
	return (QColor*) [QtSupport objectForQtKey: kde_KFontChooser_backgroundColor((kde_KFontChooser *)[self qt]) withClass: [QColor class] allocatedInObjcWorld: YES];
}

//- setSizeIsRelative: (int)relative
//{
//	kde_KFontChooser_setSizeIsRelative((kde_KFontChooser *)[self qt], (int)relative);
//	return self;
//}

- (int) sizeIsRelative
{
	return (int) kde_KFontChooser_sizeIsRelative((kde_KFontChooser *)[self qt]);
}

//- setCharset: (NSString *)charset
//{
//static qt_QString * _qstring_charset = 0L;
//	kde_KFontChooser_setCharset((kde_KFontChooser *)[self qt], (qt_QString *) [charset toQString: &_qstring_charset]);
//	return self;
//}

//- (NSString *) charset
//{
//static qt_QString * _qstring = 0L;
//	_qstring = kde_KFontChooser_charset((kde_KFontChooser *)[self qt]);
//	return [NSString fromQString: _qstring];
//}

- (NSString *) sampleText
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KFontChooser_sampleText((kde_KFontChooser *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setSampleText: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
	kde_KFontChooser_setSampleText((kde_KFontChooser *)[self qt], (qt_QString *) [text toQString: &_qstring_text]);
	return self;
}

- (QSize*) sizeHint
{
	return (QSize*) [QtSupport objectForQtKey: kde_KFontChooser_sizeHint((kde_KFontChooser *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

+ (NSString *) getXLFD: (QFont *)theFont
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KFontChooser_getXLFD((qt_QFont *) [theFont qt]);
	return [NSString fromQString: _qstring];
}

+ getFontList: (NSArray *)list fontListCriteria: (unsigned int)fontListCriteria
{
static qt_QStringList * _qlist_list = 0L;
	kde_KFontChooser_getFontList((qt_QStringList*) [list toQStringList: (void *)&_qlist_list], (unsigned int)fontListCriteria);
	return self;
}

+ (int) FamilyList
{
	return (int) KFONTCHOOSER_FamilyList;
}

+ (int) StyleList
{
	return (int) KFONTCHOOSER_StyleList;
}

+ (int) SizeList
{
	return (int) KFONTCHOOSER_SizeList;
}

+ (int) CharsetList
{
	return (int) KFONTCHOOSER_CharsetList;
}

+ (int) FontDiffFamily
{
	return (int) KFONTCHOOSER_FontDiffFamily;
}

+ (int) FontDiffStyle
{
	return (int) KFONTCHOOSER_FontDiffStyle;
}

+ (int) FontDiffSize
{
	return (int) KFONTCHOOSER_FontDiffSize;
}

+ (int) FixedWidthFonts
{
	return (int) KFONTCHOOSER_FixedWidthFonts;
}

+ (int) ScalableFonts
{
	return (int) KFONTCHOOSER_ScalableFonts;
}

+ (int) SmoothScalableFonts
{
	return (int) KFONTCHOOSER_SmoothScalableFonts;
}

@end
