00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KEXIUTILS_STYLEPROXY_H
00021 #define KEXIUTILS_STYLEPROXY_H
00022
00023 #include <qstyle.h>
00024 #include <qstylefactory.h>
00025 #include <qpixmap.h>
00026
00027 #include "kexiutils_export.h"
00028
00029 namespace KexiUtils {
00030
00032
00048 class KEXIUTILS_EXPORT StyleProxy : public QStyle
00049 {
00050 public:
00054 StyleProxy(QStyle* parentStyle);
00055 virtual ~StyleProxy();
00056
00057 QStyle* parentStyle() const;
00058 void setParentStyle(QStyle* style);
00059
00060 virtual void polish( QWidget *w ) { m_style->polish(w); }
00061 virtual void unPolish( QWidget *w ) { m_style->unPolish(w); }
00062
00063 virtual void polish( QApplication *a ) { m_style->polish(a); }
00064 virtual void unPolish( QApplication *a ) { m_style->unPolish(a); }
00065
00066 virtual void polish( QPalette &p ) { m_style->polish(p); };
00067
00068 virtual void polishPopupMenu( QPopupMenu* p ) { m_style->polishPopupMenu(p); }
00069
00070 virtual QRect itemRect( QPainter *p, const QRect &r,
00071 int flags, bool enabled, const QPixmap *pixmap, const QString &text, int len = -1 ) const
00072 {
00073 return m_style->itemRect( p, r, flags, enabled, pixmap, text, len );
00074 }
00075
00076 virtual void drawItem( QPainter *p, const QRect &r,
00077 int flags, const QColorGroup &g, bool enabled, const QPixmap *pixmap, const QString &text,
00078 int len = -1, const QColor *penColor = 0 ) const
00079 {
00080 m_style->drawItem( p, r, flags, g, enabled, pixmap, text, len, penColor );
00081 }
00082
00083 virtual void drawPrimitive( PrimitiveElement pe,
00084 QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags = Style_Default,
00085 const QStyleOption& option = QStyleOption::Default ) const
00086 {
00087 m_style->drawPrimitive( pe, p, r, cg, flags, option );
00088 }
00089
00090 virtual void drawControl( ControlElement element,
00091 QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg,
00092 SFlags how = Style_Default, const QStyleOption& option = QStyleOption::Default ) const
00093 {
00094 m_style->drawControl( element, p, widget, r, cg, how, option );
00095 }
00096
00097 virtual void drawControlMask( ControlElement element,
00098 QPainter *p, const QWidget *widget, const QRect &r,
00099 const QStyleOption& option = QStyleOption::Default ) const
00100 {
00101 m_style->drawControlMask( element, p, widget, r, option );
00102 }
00103
00104 virtual QRect subRect( SubRect r, const QWidget *widget ) const
00105 {
00106 return m_style->subRect( r, widget );
00107 }
00108
00109 virtual void drawComplexControl( ComplexControl control,
00110 QPainter *p, const QWidget *widget, const QRect &r,
00111 const QColorGroup &cg, SFlags how = Style_Default,
00112 #ifdef Q_QDOC
00113 SCFlags sub = SC_All,
00114 #else
00115 SCFlags sub = (uint)SC_All,
00116 #endif
00117 SCFlags subActive = SC_None, const QStyleOption& option = QStyleOption::Default ) const
00118 {
00119 drawComplexControl( control, p, widget, r, cg, how, sub, subActive, option );
00120 }
00121
00122 virtual void drawComplexControlMask( ComplexControl control,
00123 QPainter *p, const QWidget *widget, const QRect &r,
00124 const QStyleOption& option = QStyleOption::Default ) const
00125 {
00126 m_style->drawComplexControlMask( control, p, widget, r, option );
00127 }
00128
00129 virtual QRect querySubControlMetrics( ComplexControl control,
00130 const QWidget *widget, SubControl sc,
00131 const QStyleOption& option = QStyleOption::Default ) const
00132 {
00133 return m_style->querySubControlMetrics( control, widget, sc, option );
00134 }
00135
00136 virtual SubControl querySubControl( ComplexControl control,
00137 const QWidget *widget, const QPoint &pos,
00138 const QStyleOption& option = QStyleOption::Default ) const
00139 {
00140 return m_style->querySubControl( control, widget, pos, option );
00141 }
00142
00143 virtual int pixelMetric( PixelMetric metric,
00144 const QWidget *widget = 0 ) const
00145 {
00146 return m_style->pixelMetric( metric, widget );
00147 }
00148
00149 virtual QSize sizeFromContents( ContentsType contents,
00150 const QWidget *widget, const QSize &contentsSize,
00151 const QStyleOption& option = QStyleOption::Default ) const
00152 {
00153 return m_style->sizeFromContents( contents, widget, contentsSize, option );
00154 }
00155
00156 virtual int styleHint( StyleHint stylehint,
00157 const QWidget *widget = 0, const QStyleOption& option = QStyleOption::Default,
00158 QStyleHintReturn* returnData = 0 ) const
00159 {
00160 return m_style->styleHint( stylehint, widget, option, returnData );
00161 }
00162
00163 virtual QPixmap stylePixmap( StylePixmap stylepixmap,
00164 const QWidget *widget = 0,
00165 const QStyleOption& option = QStyleOption::Default ) const
00166 {
00167 return m_style->stylePixmap( stylepixmap, widget, option );
00168 }
00169
00170 protected:
00171 QStyle *m_style;
00172 };
00173 }
00174
00175 #endif