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 #ifndef __HIGHCOLOR_H
00029 #define __HIGHCOLOR_H
00030
00031 #include <QtGui/QBitmap>
00032 #include <kdrawutil.h>
00033 #include <kpixmap.h>
00034 #include <kstyle.h>
00035
00036
00037 enum GradientType{ VSmall=0, VMed, VLarge, HMed, HLarge, GradientCount };
00038
00039 class GradientSet
00040 {
00041 public:
00042 GradientSet(const QColor &baseColor);
00043 ~GradientSet();
00044
00045 KPixmap* gradient(GradientType type);
00046 QColor* color() { return(&c); }
00047 private:
00048 KPixmap *gradients[5];
00049 QColor c;
00050 };
00051
00052
00053 class QMenu;
00054
00055 class HighColorStyle : public KStyle
00056 {
00057 Q_OBJECT
00058
00059 public:
00060 enum StyleType { HighColor = 0, Default, B3 };
00061
00062 HighColorStyle( StyleType );
00063 virtual ~HighColorStyle();
00064
00065 void polish( QWidget* widget );
00066 void unPolish( QWidget* widget );
00067
00068 void renderMenuBlendPixmap( KPixmap& pix, const QColorGroup &cg,
00069 const QMenu* popup ) const;
00070
00071 void drawKStylePrimitive( KStylePrimitive kpe,
00072 QPainter* p,
00073 const QWidget* widget,
00074 const QRect &r,
00075 const QColorGroup &cg,
00076 SFlags flags = Style_Default,
00077 const QStyleOption& = QStyleOption::Default ) const;
00078
00079 void drawPrimitive( PrimitiveElement pe,
00080 QPainter* p,
00081 const QRect &r,
00082 const QColorGroup &cg,
00083 SFlags flags = Style_Default,
00084 const QStyleOption& = QStyleOption::Default ) const;
00085
00086 void drawControl( ControlElement element,
00087 QPainter *p,
00088 const QWidget *widget,
00089 const QRect &r,
00090 const QColorGroup &cg,
00091 SFlags flags = Style_Default,
00092 const QStyleOption& = QStyleOption::Default ) const;
00093
00094 void drawControlMask( ControlElement element,
00095 QPainter *p,
00096 const QWidget *widget,
00097 const QRect &r,
00098 const QStyleOption& = QStyleOption::Default ) const;
00099
00100 void drawComplexControl( ComplexControl control,
00101 QPainter *p,
00102 const QWidget *widget,
00103 const QRect &r,
00104 const QColorGroup &cg,
00105 SFlags flags = Style_Default,
00106 SCFlags controls = SC_All,
00107 SCFlags active = SC_None,
00108 const QStyleOption& = QStyleOption::Default ) const;
00109
00110 void drawComplexControlMask( ComplexControl control,
00111 QPainter *p,
00112 const QWidget *widget,
00113 const QRect &r,
00114 const QStyleOption& = QStyleOption::Default ) const;
00115
00116 void drawItem( QPainter *p,
00117 const QRect &r,
00118 int flags,
00119 const QColorGroup &cg,
00120 bool enabled,
00121 const QPixmap *pixmap,
00122 const QString &text,
00123 int len = -1,
00124 const QColor *penColor = 0 ) const;
00125
00126 int pixelMetric( PixelMetric m,
00127 const QWidget *widget = 0 ) const;
00128
00129 QSize sizeFromContents( ContentsType contents,
00130 const QWidget *widget,
00131 const QSize &contentSize,
00132 const QStyleOption& opt ) const;
00133
00134 QRect subRect( SubRect r,
00135 const QWidget *widget ) const;
00136
00137
00138 QPixmap stylePixmap( StylePixmap stylepixmap,
00139 const QWidget *widget = 0,
00140 const QStyleOption& = QStyleOption::Default ) const;
00141
00142 protected:
00143 bool eventFilter( QObject *object, QEvent *event );
00144
00145 void renderGradient( QPainter* p,
00146 const QRect& r,
00147 QColor clr,
00148 bool horizontal,
00149 int px=0,
00150 int py=0,
00151 int pwidth=-1,
00152 int pheight=-1 ) const;
00153
00154 QWidget *hoverWidget;
00155 StyleType type;
00156 bool highcolor;
00157 mutable bool selectionBackground;
00158
00159 private:
00160
00161 HighColorStyle( const HighColorStyle & );
00162 HighColorStyle& operator=( const HighColorStyle & );
00163 };
00164
00165
00166
00167 #endif