Eneboo - Documentación para desarrolladores
|
00001 /* Bluecurve style class definition 00002 * (c) 2002 Red Hat, Inc. 00003 * 00004 * Authors: Bernhard Rosenkraenzer <bero@redhat.com> 00005 * Preston Brown <pbrown@redhat.com> 00006 * 00007 * Released under the GNU General Public License (GPL) version 2. 00008 */ 00009 #ifndef _BLUECURVE_H_ 00010 #define _BLUECURVE_H_ 1 00011 00012 #ifdef QT_PLUGIN 00013 # define Q_EXPORT_STYLE_BLUECURVE 00014 #else 00015 # define Q_EXPORT_STYLE_BLUECURVE Q_EXPORT 00016 #endif // QT_PLUGIN 00017 00018 #include <qcommonstyle.h> 00019 #include <qcolor.h> 00020 #include <qpalette.h> 00021 #include <qintcache.h> 00022 00023 class Q_EXPORT_STYLE_BLUECURVE BluecurveStyle : public QCommonStyle 00024 { 00025 Q_OBJECT 00026 QStyle *basestyle; 00027 00028 public: 00029 BluecurveStyle(); 00030 virtual ~BluecurveStyle(); 00031 00032 void polish(QWidget *widget); 00033 void unPolish(QWidget *widget); 00034 00035 void polishPopupMenu( QPopupMenu * ); 00036 00037 void drawPrimitive(PrimitiveElement, QPainter *, const QRect &, 00038 const QColorGroup &, SFlags = Style_Default, 00039 const QStyleOption & = QStyleOption::Default) const; 00040 00041 void drawControl(ControlElement, QPainter *, const QWidget *, 00042 const QRect &, const QColorGroup &, 00043 SFlags = Style_Default, 00044 const QStyleOption & = QStyleOption::Default) const; 00045 00046 void drawControlMask(ControlElement, QPainter *, const QWidget *, 00047 const QRect &, 00048 const QStyleOption & = QStyleOption::Default) const; 00049 00050 QRect subRect(SubRect, const QWidget *) const; 00051 00052 void drawComplexControl(ComplexControl, QPainter *, const QWidget *, 00053 const QRect &, const QColorGroup &, 00054 SFlags = Style_Default, 00055 SCFlags = SC_All, SCFlags = SC_None, 00056 const QStyleOption & = QStyleOption::Default) const; 00057 00058 QRect querySubControlMetrics(ComplexControl, const QWidget *, 00059 SubControl, const QStyleOption & = QStyleOption::Default) const; 00060 00061 SubControl querySubControl(ComplexControl, const QWidget *, const QPoint &, 00062 const QStyleOption &data = QStyleOption::Default) const; 00063 00064 int pixelMetric(PixelMetric, const QWidget * = 0) const; 00065 00066 QSize sizeFromContents(ContentsType, const QWidget *, const QSize &, 00067 const QStyleOption & = QStyleOption::Default) const; 00068 00069 int styleHint(StyleHint, const QWidget * = 0, 00070 const QStyleOption & = QStyleOption::Default, 00071 QStyleHintReturn * = 0 ) const; 00072 00073 QPixmap stylePixmap(StylePixmap stylepixmap, 00074 const QWidget* widget = 0, 00075 const QStyleOption& = QStyleOption::Default) const; 00076 protected: 00077 struct BluecurveColorData { 00078 QRgb buttonColor; 00079 QRgb spotColor; 00080 00081 QColor shades[8]; 00082 QColor spots[3]; 00083 00084 QPixmap *radioPix[8]; 00085 QPixmap *radioMask; 00086 00087 QPixmap *checkPix[6]; 00088 00089 ~BluecurveColorData(); 00090 00091 bool isGroup (const QColorGroup &cg) { 00092 return cg.button().rgb() == buttonColor && cg.highlight().rgb() == spotColor; 00093 } 00094 }; 00095 00096 bool eventFilter(QObject *object, QEvent *event); 00097 void drawGradientBox(QPainter *p, QRect const &r, 00098 const QColorGroup &cg, 00099 const BluecurveColorData *cdata, 00100 bool horiz, 00101 double shade1, double shade2) const; 00102 void drawGradient(QPainter *p, QRect const &r, 00103 const QColorGroup &cg, 00104 double shade1, double shade2, 00105 bool horiz) const; 00106 00107 void getShade (const QColorGroup &cg, int shadenr, QColor &res) const; 00108 void drawTextRect (QPainter *p, const QRect &r, 00109 const QColorGroup &cg, QStyle::SFlags flags, 00110 const QBrush *fill = 0) const; 00111 void drawLightBevel(QPainter *p, const QRect &r, 00112 const QColorGroup &cg, 00113 QStyle::SFlags flags, 00114 const QBrush *fill = 0) const; 00115 00116 BluecurveColorData *realizeData (const QColorGroup &cg) const; 00117 const BluecurveColorData *lookupData (const QColorGroup &cg) const; 00118 00119 00120 QIntCache<BluecurveColorData> m_dataCache; 00121 static const double shadeFactors[8]; 00122 }; 00123 #endif