00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef __HIGHCONTRAST_H
00038 #define __HIGHCONTRAST_H
00039
00040 #include <QtGui/QBitmap>
00041 #include <kdrawutil.h>
00042 #include <kpixmap.h>
00043 #include <kstyle.h>
00044
00045 class HighContrastStyle : public KStyle
00046 {
00047 Q_OBJECT
00048
00049 public:
00050 HighContrastStyle();
00051 virtual ~HighContrastStyle();
00052
00053 void polish( QPalette& pal );
00054
00055 void polish( QWidget* widget );
00056 void unPolish( QWidget* widget );
00057
00058 void drawKStylePrimitive( KStylePrimitive kpe,
00059 QPainter* p,
00060 const QWidget* widget,
00061 const QRect &r,
00062 const QColorGroup &cg,
00063 SFlags flags = Style_Default,
00064 const QStyleOption& = QStyleOption::Default ) const;
00065
00066 void drawPrimitive( PrimitiveElement pe,
00067 QPainter* p,
00068 const QRect &r,
00069 const QColorGroup &cg,
00070 SFlags flags = Style_Default,
00071 const QStyleOption& = QStyleOption::Default ) const;
00072
00073 void drawControl( ControlElement element,
00074 QPainter *p,
00075 const QWidget *widget,
00076 const QRect &r,
00077 const QColorGroup &cg,
00078 SFlags flags = Style_Default,
00079 const QStyleOption& = QStyleOption::Default ) const;
00080
00081 void drawControlMask( ControlElement element,
00082 QPainter *p,
00083 const QWidget *widget,
00084 const QRect &r,
00085 const QStyleOption& = QStyleOption::Default ) const;
00086
00087 void drawComplexControl( ComplexControl control,
00088 QPainter *p,
00089 const QWidget *widget,
00090 const QRect &r,
00091 const QColorGroup &cg,
00092 SFlags flags = Style_Default,
00093 SCFlags controls = SC_All,
00094 SCFlags active = SC_None,
00095 const QStyleOption& = QStyleOption::Default ) const;
00096
00097 void drawComplexControlMask( ComplexControl control,
00098 QPainter *p,
00099 const QWidget *widget,
00100 const QRect &r,
00101 const QStyleOption& = QStyleOption::Default ) const;
00102
00103 QRect querySubControlMetrics( ComplexControl control,
00104 const QWidget* widget,
00105 SubControl subcontrol,
00106 const QStyleOption& opt = QStyleOption::Default ) const;
00107
00108
00109 void drawItem( QPainter *p,
00110 const QRect &r,
00111 int flags,
00112 const QColorGroup &cg,
00113 bool enabled,
00114 const QPixmap *pixmap,
00115 const QString &text,
00116 int len = -1,
00117 const QColor *penColor = 0 ) const;
00118
00119 int pixelMetric( PixelMetric m,
00120 const QWidget *widget = 0 ) const;
00121
00122 int kPixelMetric( KStylePixelMetric m,
00123 const QWidget *widget = 0 ) const;
00124
00125 QSize sizeFromContents( ContentsType contents,
00126 const QWidget *widget,
00127 const QSize &contentSize,
00128 const QStyleOption& opt ) const;
00129
00130 QRect subRect (SubRect subrect, const QWidget * widget) const;
00131
00132 protected:
00133 bool eventFilter( QObject *object, QEvent *event );
00134
00135 QWidget *hoverWidget;
00136
00137 private:
00138 void setColorsNormal (QPainter* p, const QColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
00139 void setColorsButton (QPainter* p, const QColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
00140 void setColorsText (QPainter* p, const QColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
00141 void setColorsHighlight (QPainter* p, const QColorGroup& cg, int flags = Style_Enabled) const;
00142 void setColorsByState (QPainter* p, const QColorGroup& cg, const QColor& fg, const QColor& bg, int flags, int highlight) const;
00143
00144 void drawRect (QPainter* p, QRect r, int offset = 0, bool filled = true) const;
00145 void drawRoundRect (QPainter* p, QRect r, int offset = 0, bool filled = true) const;
00146 void drawEllipse (QPainter* p, QRect r, int offset = 0, bool filled = true) const;
00147 void drawArrow (QPainter* p, QRect r, PrimitiveElement arrow, int offset = 0) const;
00148
00149 int basicLineWidth;
00150
00151 HighContrastStyle( const HighContrastStyle & );
00152 HighContrastStyle& operator=( const HighContrastStyle & );
00153 };
00154
00155
00156
00157
00158 #endif