#include <qpixmap.h>
#include <qstylefactory.h>
#include <qstyle.h>
#include "proxystyle.h"

ProxyStyle::ProxyStyle(const QString& style)
	: QStyle(), style(QStyleFactory::create(style))
{
}

ProxyStyle::~ProxyStyle()
{
	delete style;
}


void ProxyStyle::polish ( QWidget * widget )
{
	style->polish( widget );
}

void ProxyStyle::unPolish ( QWidget * widget )
{
	style->unPolish( widget );
}

void ProxyStyle::polish ( QApplication * app )
{
	style->polish( app );
}

void ProxyStyle::unPolish ( QApplication * app )
{
	style->unPolish( app );
}

void ProxyStyle::polish ( QPalette & palette )
{
	style->polish( palette );
}

void ProxyStyle::polishPopupMenu ( QPopupMenu * popupmenu )
{
	style->polishPopupMenu( popupmenu );
}

QRect ProxyStyle::itemRect ( QPainter * p, const QRect & r, int flags, bool enabled, const QPixmap * pixmap, const QString & text, int len ) const
{
	return style->itemRect( p, r, flags, enabled, pixmap, text, len );
}

void ProxyStyle::drawItem ( QPainter * p, const QRect & r, int flags, const QColorGroup & g, bool enabled, const QPixmap * pixmap, const QString & text, int len, const QColor * penColor ) const
{
	style->drawItem( p, r, flags, g, enabled, pixmap, text, len, penColor );
}

void ProxyStyle::drawPrimitive ( PrimitiveElement pe, QPainter * p, const QRect & r, const QColorGroup & cg, SFlags flags, const QStyleOption & opt ) const
{
	style->drawPrimitive( pe, p, r, cg, flags, opt );
}

void ProxyStyle::drawControl ( ControlElement element, QPainter * p, const QWidget * widget, const QRect & r, const QColorGroup & cg, SFlags how, const QStyleOption & opt ) const
{
	style->drawControl( element, p, widget, r, cg, how, opt );
}

void ProxyStyle::drawControlMask ( ControlElement element, QPainter * p, const QWidget * widget, const QRect & r, const QStyleOption & opt ) const
{
	style->drawControlMask( element, p, widget, r, opt );
}

QRect ProxyStyle::subRect ( SubRect subrect, const QWidget * widget ) const
{
	return style->subRect( subrect, widget );
}

void ProxyStyle::drawComplexControl ( ComplexControl control, QPainter * p, const QWidget * widget, const QRect & r, const QColorGroup & cg, SFlags how, SCFlags sub, SCFlags subActive, const QStyleOption & opt ) const
{
	style->drawComplexControl( control, p, widget, r, cg, how, sub, subActive, opt );
}

void ProxyStyle::drawComplexControlMask ( ComplexControl control, QPainter * p, const QWidget * widget, const QRect & r, const QStyleOption & opt ) const
{
	style->drawComplexControlMask( control, p, widget, r, opt );
}

QRect ProxyStyle::querySubControlMetrics ( ComplexControl control, const QWidget * widget, SubControl subcontrol, const QStyleOption & opt ) const
{
	return style->querySubControlMetrics( control, widget, subcontrol, opt );
}

QStyle::SubControl ProxyStyle::querySubControl ( ComplexControl control, const QWidget * widget, const QPoint & pos, const QStyleOption & opt ) const
{
	return style->querySubControl( control, widget, pos, opt );
}

int ProxyStyle::pixelMetric ( PixelMetric metric, const QWidget * widget ) const
{
	return style->pixelMetric( metric, widget );
}

QSize ProxyStyle::sizeFromContents ( ContentsType contents, const QWidget * widget, const QSize & contentsSize, const QStyleOption & opt ) const
{
	return style->sizeFromContents( contents, widget, contentsSize, opt );
}

int ProxyStyle::styleHint ( StyleHint stylehint, const QWidget * widget, const QStyleOption & opt, QStyleHintReturn * returnData ) const
{
	return style->styleHint( stylehint, widget, opt, returnData );
}

QPixmap ProxyStyle::stylePixmap ( StylePixmap stylepixmap, const QWidget * widget, const QStyleOption & opt ) const
{
	return style->stylePixmap( stylepixmap, widget, opt );
}
