/***************************************************************************
                            QStyleSheet.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_QStyleSheet.h>
#include <qtobjc/QStyleSheet.h>
#include <qtobjc/QStyleSheetItem.h>
#include <qtobjc/QFont.h>

@implementation  QStyleSheet


- initWithObject: (QObject *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QStyleSheet((qt_QObject *) [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: qt_new_QStyleSheet(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 parent] == nil) {
			qt_del_QStyleSheet((qt_QStyleSheet *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (QStyleSheetItem*) item: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (QStyleSheetItem*) [QtSupport objectForQtKey: qt_QStyleSheet_item((qt_QStyleSheet *)[self qt], (qt_QString *) [name toQString: &_qstring_name]) withClass: [QStyleSheetItem class] allocatedInObjcWorld: YES];
}

//- (QStyleSheetItem*) item: (NSString *)name
//{
//static qt_QString * _qstring_name = 0L;
//	return (QStyleSheetItem*) [QtSupport objectForQtKey: qt_QStyleSheet_item1((qt_QStyleSheet *)[self qt], (qt_QString *) [name toQString: &_qstring_name]) withClass: [QStyleSheetItem class] allocatedInObjcWorld: YES];
//}

- insert: (QStyleSheetItem*)item
{
	qt_QStyleSheet_insert((qt_QStyleSheet *)[self qt], (qt_QStyleSheetItem*) [item qt]);
	return self;
}

- scaleFont: (QFont *)font logicalSize: (int)logicalSize
{
	qt_QStyleSheet_scaleFont((qt_QStyleSheet *)[self qt], (qt_QFont *) [font qt], (int)logicalSize);
	return self;
}

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

+ (QStyleSheet*) defaultSheet
{
	return (QStyleSheet*) [QtSupport objectForQtKey: qt_QStyleSheet_defaultSheet() withClass: [QStyleSheet class] allocatedInObjcWorld: YES];
}

+ setDefaultSheet: (QStyleSheet*)arg1
{
	qt_QStyleSheet_setDefaultSheet((qt_QStyleSheet*) [arg1 qt]);
	return self;
}

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

//+ (NSString *) convertFromPlainText: (NSString *)arg1 mode: (int)mode
//{
//static qt_QString * _qstring = 0L;
//static qt_QString * _qstring_arg1 = 0L;
//	_qstring = qt_QStyleSheet_convertFromPlainText((qt_QString *) [arg1 toQString: &_qstring_arg1], mode);
//	return [NSString fromQString: _qstring];
//}

+ (BOOL) mightBeRichText: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	return (BOOL) qt_QStyleSheet_mightBeRichText((qt_QString *) [arg1 toQString: &_qstring_arg1]);
}

@end
