/***************************************************************************
                            QFont.m -  description
                             -------------------
    begin                : Wed Nov 21 12:08:37 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 12:08:37 2001, 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 <qtc/qt_QFont.h>
#include <qtobjc/QFont.h>

@implementation  QFont

- (void *) qt
{
	return _qt;
}

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

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

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


- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QFont()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)family pointSize: (int)pointSize weight: (int)weight italic: (BOOL)italic
{
static qt_QString * _qstring_family = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QFont1((qt_QString *) [family toQString: &_qstring_family], (int)pointSize, (int)weight, (int)italic)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)family 
{
static qt_QString * _qstring_family = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QFont1((qt_QString *) [family toQString: &_qstring_family], 12, [QFont Normal], 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- copyWithZone: (NSZone *) zone
{
	QFont * aCopy;
	aCopy = [[(QFont *)[[self class] allocWithZone: zone] setQt: qt_new_QFont2([self qt])] init];
	[aCopy setAllocatedInObjcWorld: YES];
	[QtSupport setObject: aCopy forQtKey: [aCopy qt]];
	return aCopy;
}

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

- (NSString *) family
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QFont_family((qt_QFont *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setFamily: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QFont_setFamily((qt_QFont *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- (int) pointSize
{
	return (int) qt_QFont_pointSize((qt_QFont *)[self qt]);
}

- (float) pointSizeFloat
{
	return (float) qt_QFont_pointSizeFloat((qt_QFont *)[self qt]);
}

- setPointSize: (int)arg1
{
	qt_QFont_setPointSize((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- setPointSizeFloat: (float)arg1
{
	qt_QFont_setPointSizeFloat((qt_QFont *)[self qt], (float)arg1);
	return self;
}

- (int) pixelSize
{
	return (int) qt_QFont_pixelSize((qt_QFont *)[self qt]);
}

- setPixelSize: (int)arg1
{
	qt_QFont_setPixelSize((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- setPixelSizeFloat: (float)arg1
{
	qt_QFont_setPixelSizeFloat((qt_QFont *)[self qt], (float)arg1);
	return self;
}

- (int) weight
{
	return (int) qt_QFont_weight((qt_QFont *)[self qt]);
}

- setWeight: (int)arg1
{
	qt_QFont_setWeight((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- (BOOL) bold
{
	return (BOOL) qt_QFont_bold((qt_QFont *)[self qt]);
}

- setBold: (BOOL)arg1
{
	qt_QFont_setBold((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- (BOOL) italic
{
	return (BOOL) qt_QFont_italic((qt_QFont *)[self qt]);
}

- setItalic: (BOOL)arg1
{
	qt_QFont_setItalic((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- (BOOL) underline
{
	return (BOOL) qt_QFont_underline((qt_QFont *)[self qt]);
}

- setUnderline: (BOOL)arg1
{
	qt_QFont_setUnderline((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- (BOOL) strikeOut
{
	return (BOOL) qt_QFont_strikeOut((qt_QFont *)[self qt]);
}

- setStrikeOut: (BOOL)arg1
{
	qt_QFont_setStrikeOut((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- (BOOL) fixedPitch
{
	return (BOOL) qt_QFont_fixedPitch((qt_QFont *)[self qt]);
}

- setFixedPitch: (BOOL)arg1
{
	qt_QFont_setFixedPitch((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- (int) styleHint
{
	return (int) qt_QFont_styleHint((qt_QFont *)[self qt]);
}

- (int) styleStrategy
{
	return (int) qt_QFont_styleStrategy((qt_QFont *)[self qt]);
}

- setStyleHint: (int)arg1 int: (int)arg2
{
	qt_QFont_setStyleHint((qt_QFont *)[self qt], (int)arg1, (int)arg2);
	return self;
}

- setStyleHint: (int)arg1 
{
	qt_QFont_setStyleHint((qt_QFont *)[self qt], (int)arg1, [QFont PreferDefault]);
	return self;
}

- setStyleStrategy: (int)s
{
	qt_QFont_setStyleStrategy((qt_QFont *)[self qt], (int)s);
	return self;
}

- (BOOL) rawMode
{
	return (BOOL) qt_QFont_rawMode((qt_QFont *)[self qt]);
}

- setRawMode: (BOOL)arg1
{
	qt_QFont_setRawMode((qt_QFont *)[self qt], (int)arg1);
	return self;
}

- (BOOL) exactMatch
{
	return (BOOL) qt_QFont_exactMatch((qt_QFont *)[self qt]);
}

- (BOOL) isCopyOf: (QFont *)arg1
{
	return (BOOL) qt_QFont_isCopyOf((qt_QFont *)[self qt], (qt_QFont *) [arg1 qt]);
}

//- (void*) handle
//{
//	return (void*) qt_QFont_handle((qt_QFont *)[self qt]);
//}

//- (int) handle
//{
//	return (int) qt_QFont_handle1((qt_QFont *)[self qt]);
//}

- setRawName: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QFont_setRawName((qt_QFont *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- (NSString *) rawName
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QFont_rawName((qt_QFont *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) key
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QFont_key((qt_QFont *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) toString
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QFont_toString((qt_QFont *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) fromString: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	return (BOOL) qt_QFont_fromString((qt_QFont *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
}

//- qwsRenderToDisk: (BOOL)all
//{
//	qt_QFont_qwsRenderToDisk((qt_QFont *)[self qt], (int)all);
//	return self;
//}

//- qwsRenderToDisk
//{
//	qt_QFont_qwsRenderToDisk((qt_QFont *)[self qt], 1);
//	return self;
//}

- (NSString *) defaultFamily
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QFont_defaultFamily((qt_QFont *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) lastResortFamily
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QFont_lastResortFamily((qt_QFont *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) lastResortFont
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QFont_lastResortFont((qt_QFont *)[self qt]);
	return [NSString fromQString: _qstring];
}

+ (NSString *) substitute: (NSString *)arg1
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_arg1 = 0L;
	_qstring = qt_QFont_substitute((qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return [NSString fromQString: _qstring];
}

+ (NSArray *) substitutes: (NSString *)arg1
{
static qt_QStringList * _qlist = 0L;
static qt_QString * _qstring_arg1 = 0L;
	_qlist = qt_QFont_substitutes((qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

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

+ insertSubstitution: (NSString *)arg1 string: (NSString *)arg2
{
static qt_QString * _qstring_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
	qt_QFont_insertSubstitution((qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QString *) [arg2 toQString: &_qstring_arg2]);
	return self;
}

+ insertSubstitutions: (NSString *)arg1 array: (NSArray *)arg2
{
static qt_QStringList * _qlist_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
	qt_QFont_insertSubstitutions((qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QStringList*) [arg2 toQStringList: (void *)&_qlist_arg2]);
	return self;
}

+ removeSubstitution: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QFont_removeSubstitution((qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

+ initialize
{
	qt_QFont_initialize();
	return self;
}

+ cleanup
{
	qt_QFont_cleanup();
	return self;
}

+ cacheStatistics
{
	qt_QFont_cacheStatistics();
	return self;
}

+ (QFont*) defaultFont
{
	return (QFont*) [QtSupport objectForQtKey: qt_QFont_defaultFont() withClass: [QFont class] allocatedInObjcWorld: YES];
}

+ setDefaultFont: (QFont *)arg1
{
	qt_QFont_setDefaultFont((qt_QFont *) [arg1 qt]);
	return self;
}

- (BOOL) dirty
{
	return (BOOL) qt_QFont_dirty((qt_QFont *)[self qt]);
}

- (int) deciPointSize
{
	return (int) qt_QFont_deciPointSize((qt_QFont *)[self qt]);
}

+ (int) Helvetica
{
	return (int) QFONT_Helvetica;
}

+ (int) SansSerif
{
	return (int) QFONT_SansSerif;
}

+ (int) Times
{
	return (int) QFONT_Times;
}

+ (int) Serif
{
	return (int) QFONT_Serif;
}

+ (int) Courier
{
	return (int) QFONT_Courier;
}

+ (int) TypeWriter
{
	return (int) QFONT_TypeWriter;
}

+ (int) OldEnglish
{
	return (int) QFONT_OldEnglish;
}

+ (int) Decorative
{
	return (int) QFONT_Decorative;
}

+ (int) System
{
	return (int) QFONT_System;
}

+ (int) AnyStyle
{
	return (int) QFONT_AnyStyle;
}

+ (int) PreferDefault
{
	return (int) QFONT_PreferDefault;
}

+ (int) PreferBitmap
{
	return (int) QFONT_PreferBitmap;
}

+ (int) PreferDevice
{
	return (int) QFONT_PreferDevice;
}

+ (int) PreferOutline
{
	return (int) QFONT_PreferOutline;
}

+ (int) ForceOutline
{
	return (int) QFONT_ForceOutline;
}

+ (int) PreferMatch
{
	return (int) QFONT_PreferMatch;
}

+ (int) PreferQuality
{
	return (int) QFONT_PreferQuality;
}

+ (int) PreferAntialias
{
	return (int) QFONT_PreferAntialias;
}

+ (int) NoAntialias
{
	return (int) QFONT_NoAntialias;
}

+ (int) Light
{
	return (int) QFONT_Light;
}

+ (int) Normal
{
	return (int) QFONT_Normal;
}

+ (int) DemiBold
{
	return (int) QFONT_DemiBold;
}

+ (int) Bold
{
	return (int) QFONT_Bold;
}

+ (int) Black
{
	return (int) QFONT_Black;
}

+ (int) Latin
{
	return (int) QFONT_Latin;
}

+ (int) Greek
{
	return (int) QFONT_Greek;
}

+ (int) Cyrillic
{
	return (int) QFONT_Cyrillic;
}

+ (int) Armenian
{
	return (int) QFONT_Armenian;
}

+ (int) Georgian
{
	return (int) QFONT_Georgian;
}

+ (int) Runic
{
	return (int) QFONT_Runic;
}

+ (int) Ogham
{
	return (int) QFONT_Ogham;
}

+ (int) SpacingModifiers
{
	return (int) QFONT_SpacingModifiers;
}

+ (int) CombiningMarks
{
	return (int) QFONT_CombiningMarks;
}

+ (int) Hebrew
{
	return (int) QFONT_Hebrew;
}

+ (int) Arabic
{
	return (int) QFONT_Arabic;
}

+ (int) Syriac
{
	return (int) QFONT_Syriac;
}

+ (int) Thaana
{
	return (int) QFONT_Thaana;
}

+ (int) Devanagari
{
	return (int) QFONT_Devanagari;
}

+ (int) Bengali
{
	return (int) QFONT_Bengali;
}

+ (int) Gurmukhi
{
	return (int) QFONT_Gurmukhi;
}

+ (int) Gujarati
{
	return (int) QFONT_Gujarati;
}

+ (int) Oriya
{
	return (int) QFONT_Oriya;
}

+ (int) Tamil
{
	return (int) QFONT_Tamil;
}

+ (int) Telugu
{
	return (int) QFONT_Telugu;
}

+ (int) Kannada
{
	return (int) QFONT_Kannada;
}

+ (int) Malayalam
{
	return (int) QFONT_Malayalam;
}

+ (int) Sinhala
{
	return (int) QFONT_Sinhala;
}

+ (int) Thai
{
	return (int) QFONT_Thai;
}

+ (int) Lao
{
	return (int) QFONT_Lao;
}

+ (int) Tibetan
{
	return (int) QFONT_Tibetan;
}

+ (int) Myanmar
{
	return (int) QFONT_Myanmar;
}

+ (int) Khmer
{
	return (int) QFONT_Khmer;
}

+ (int) Han
{
	return (int) QFONT_Han;
}

+ (int) Hiragana
{
	return (int) QFONT_Hiragana;
}

+ (int) Katakana
{
	return (int) QFONT_Katakana;
}

+ (int) Hangul
{
	return (int) QFONT_Hangul;
}

+ (int) Bopomofo
{
	return (int) QFONT_Bopomofo;
}

+ (int) Yi
{
	return (int) QFONT_Yi;
}

+ (int) Ethiopic
{
	return (int) QFONT_Ethiopic;
}

+ (int) Cherokee
{
	return (int) QFONT_Cherokee;
}

+ (int) CanadianAboriginal
{
	return (int) QFONT_CanadianAboriginal;
}

+ (int) Mongolian
{
	return (int) QFONT_Mongolian;
}

+ (int) CurrencySymbols
{
	return (int) QFONT_CurrencySymbols;
}

+ (int) LetterlikeSymbols
{
	return (int) QFONT_LetterlikeSymbols;
}

+ (int) NumberForms
{
	return (int) QFONT_NumberForms;
}

+ (int) MathematicalOperators
{
	return (int) QFONT_MathematicalOperators;
}

+ (int) TechnicalSymbols
{
	return (int) QFONT_TechnicalSymbols;
}

+ (int) GeometricSymbols
{
	return (int) QFONT_GeometricSymbols;
}

+ (int) MiscellaneousSymbols
{
	return (int) QFONT_MiscellaneousSymbols;
}

+ (int) EnclosedAndSquare
{
	return (int) QFONT_EnclosedAndSquare;
}

+ (int) Braille
{
	return (int) QFONT_Braille;
}

+ (int) Unicode
{
	return (int) QFONT_Unicode;
}

+ (int) NScripts
{
	return (int) QFONT_NScripts;
}

+ (int) UnknownScript
{
	return (int) QFONT_UnknownScript;
}

+ (int) NoScript
{
	return (int) QFONT_NoScript;
}

+ (int) HanX11
{
	return (int) QFONT_HanX11;
}

+ (int) LatinBasic
{
	return (int) QFONT_LatinBasic;
}

+ (int) LatinExtendedA_2
{
	return (int) QFONT_LatinExtendedA_2;
}

+ (int) LatinExtendedA_3
{
	return (int) QFONT_LatinExtendedA_3;
}

+ (int) LatinExtendedA_4
{
	return (int) QFONT_LatinExtendedA_4;
}

+ (int) LatinExtendedA_14
{
	return (int) QFONT_LatinExtendedA_14;
}

+ (int) LatinExtendedA_15
{
	return (int) QFONT_LatinExtendedA_15;
}

+ (int) LastPrivateScript
{
	return (int) QFONT_LastPrivateScript;
}

@end
