/***************************************************************************
                            QCDEStyle.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_QCDEStyle.h>
#include <qtobjc/QCDEStyle.h>
#include <qtobjc/QRect.h>
#include <qtobjc/QWidget.h>

#include <qtobjc/QPainter.h>
#include <qtobjc/QColorGroup.h>
#include <qtobjc/QBrush.h>

@implementation  QCDEStyle


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

- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCDEStyle(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_QCDEStyle((qt_QCDEStyle *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (int) pixelMetric: (int)metric widget: (QWidget *)widget
{
	return (int) qt_QCDEStyle_pixelMetric((qt_QCDEStyle *)[self qt], (int)metric, (qt_QWidget *) [widget qt]);
}

- (int) pixelMetric: (int)metric 
{
	return (int) qt_QCDEStyle_pixelMetric((qt_QCDEStyle *)[self qt], (int)metric, 0);
}

- drawControl: (int)element p: (QPainter *)p widget: (QWidget *)widget r: (QRect*)r cg: (QColorGroup *)cg how: (int)how int: (int)arg1
{
	qt_QCDEStyle_drawControl((qt_QCDEStyle *)[self qt], (int)element, (qt_QPainter *) [p qt], (qt_QWidget *) [widget qt], (qt_QRect*) [r qt], (qt_QColorGroup *) [cg qt], (int)how, (int)arg1);
	return self;
}

- drawControl: (int)element p: (QPainter *)p widget: (QWidget *)widget r: (QRect*)r cg: (QColorGroup *)cg
{
	qt_QCDEStyle_drawControl((qt_QCDEStyle *)[self qt], (int)element, (qt_QPainter *) [p qt], (qt_QWidget *) [widget qt], (qt_QRect*) [r qt], (qt_QColorGroup *) [cg qt], [QCDEStyle Style_Default], 0);
	return self;
}

- drawPrimitive: (int)pe p: (QPainter *)p r: (QRect*)r cg: (QColorGroup *)cg flags: (int)flags int: (int)arg1
{
	qt_QCDEStyle_drawPrimitive((qt_QCDEStyle *)[self qt], (int)pe, (qt_QPainter *) [p qt], (qt_QRect*) [r qt], (qt_QColorGroup *) [cg qt], (int)flags, (int)arg1);
	return self;
}

- drawPrimitive: (int)pe p: (QPainter *)p r: (QRect*)r cg: (QColorGroup *)cg
{
	qt_QCDEStyle_drawPrimitive((qt_QCDEStyle *)[self qt], (int)pe, (qt_QPainter *) [p qt], (qt_QRect*) [r qt], (qt_QColorGroup *) [cg qt], [QCDEStyle Style_Default], 0);
	return self;
}

@end
