diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-10-05 18:12:45 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-10-05 18:12:45 +0000 |
commit | b23b8edce7cbd48165084dbd852875afeb800735 (patch) | |
tree | 6fce139d187944d762e804b4e868e8a40284a121 /style/qtcurve.h | |
parent | 70f7d26b3b2a811ad0000cc3a26e21142d34e39f (diff) | |
download | tde-style-qtcurve-b23b8edce7cbd48165084dbd852875afeb800735.tar.gz tde-style-qtcurve-b23b8edce7cbd48165084dbd852875afeb800735.zip |
Update qtcurve to latest upstream version
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kde-style-qtcurve@1182805 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'style/qtcurve.h')
-rw-r--r-- | style/qtcurve.h | 114 |
1 files changed, 84 insertions, 30 deletions
diff --git a/style/qtcurve.h b/style/qtcurve.h index f021dd3..cccfb8f 100644 --- a/style/qtcurve.h +++ b/style/qtcurve.h @@ -2,7 +2,7 @@ #define __QTCURVE_H__ /* - QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + QtCurve (C) Craig Drummond, 2003 - 2010 [email protected] ---- @@ -51,31 +51,30 @@ */ #include "config.h" +#ifdef QTC_QT_ONLY +#include "qtc_kstyle.h" +#else #include <kdeversion.h> #include <kstyle.h> +#endif #include <qcolor.h> #include <qpoint.h> #include <qpalette.h> #include <qpixmap.h> #include <qcache.h> +#include <qvaluelist.h> #include "common.h" class QTimer; class QSlider; -class HighContrastStyle : public KStyle -{ - Q_OBJECT - - public: - - HighContrastStyle(); - virtual ~HighContrastStyle() { } - - const char * className(); -}; +#ifdef QTC_QT_ONLY +#define BASE_STYLE QtCKStyle +#else +#define BASE_STYLE KStyle +#endif -class QtCurveStyle : public HighContrastStyle +class QtCurveStyle : public BASE_STYLE { Q_OBJECT @@ -96,6 +95,8 @@ class QtCurveStyle : public HighContrastStyle APP_TORA, APP_KONTACT, APP_OPERA, + APP_SYSTEMSETTINGS, + APP_KATE, APP_OTHER }; @@ -112,14 +113,29 @@ class QtCurveStyle : public HighContrastStyle HOVER_KICKER, HOVER_SW_UP, HOVER_SW_DOWN, - HOVER_CB_ARROW + HOVER_SW_ENTRY, + HOVER_CB_ARROW, + HOVER_CB_ENTRY }; + enum EntryColor + { + ENTRY_FOCUS, + ENTRY_MOUSE_OVER, + ENTRY_NONE + }; + +#ifdef QTC_STYLE_SUPPORT QtCurveStyle(const QString &name=QString()); +#else + QtCurveStyle(); +#endif + virtual ~QtCurveStyle(); void polish(QApplication *app); void polish(QPalette &pal); + QColorGroup setColorGroup(const QColorGroup &old, const QColorGroup &act, bool dis=false); void polish(QWidget *widget); void unPolish(QWidget *widget); void drawLightBevel(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, @@ -129,12 +145,16 @@ class QtCurveStyle : public HighContrastStyle void drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, int round, const QColor &fill, const QColor *custom=NULL, bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER) const; - void drawEtch(QPainter *p, const QRect &r, const QColorGroup &cg, bool top, bool bot, bool raised=false) const; + void drawGlow(QPainter *p, const QRect &r, const QColorGroup &cg, EWidget w, const QColor *cols=0) const; + void drawEtch(QPainter *p, const QRect &r, const QColorGroup &cg, bool raised=false, bool square=false) const; void drawBorder(const QColor &bgnd, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, int round, const QColor *custom=NULL, EWidget w=WIDGET_OTHER, - bool doCorners=true, EBorder borderProfile=BORDER_FLAT, bool blendBorderColors=true, int borderVal=QT_STD_BORDER) const; + bool doCorners=true, EBorder borderProfile=BORDER_FLAT, bool blendBorderColors=true, int borderVal=STD_BORDER) const; + void drawMdiIcon(QPainter *painter, const QColor &color, const QColor &shadow, const QRect &r, bool sunken, int margin, + SubControl button) const; + void drawWindowIcon(QPainter *painter, const QColor &color, const QRect &r, bool sunken, int margin, SubControl button) const; void drawEntryField(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, - bool highlight, int round, EWidget=WIDGET_OTHER) const; + EntryColor coloration, int round, EWidget=WIDGET_ENTRY) const; void drawArrow(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, QStyle::PrimitiveElement pe, bool small=false, bool checkActive=false) const; void drawPrimitive(PrimitiveElement, QPainter *, const QRect &, const QColorGroup &, @@ -159,32 +179,40 @@ class QtCurveStyle : public HighContrastStyle const QStyleOption & = QStyleOption::Default) const; int styleHint(StyleHint, const QWidget *widget= 0, const QStyleOption & = QStyleOption::Default, QStyleHintReturn *returnData= 0) const; + void drawItem(QPainter *p, const QRect &r, int flags, const QColorGroup &cg, bool enabled, + const QPixmap *pixmap, const QString &text, int len=-1, const QColor *penColor=0) const; protected: bool appIsNotEmbedded(QDialog *dlg); bool eventFilter(QObject *object, QEvent *event); - void drawMenuItem(QPainter *p, const QRect &r, const QColorGroup &cg, + void drawMenuItem(QPainter *p, const QRect &r, int flags, const QColorGroup &cg, bool mbi, int round, const QColor &bgnd, const QColor *cols) const; void drawProgress(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, int round, const QWidget *widget) const; - void drawBevelGradient(const QColor &base, bool increase, QPainter *p, QRect const &r, - bool horiz, double shadeTop, double shadeBot, bool sel, EAppearance bevApp, - EWidget w=WIDGET_OTHER) const; - void drawGradient(const QColor &top, const QColor &bot, bool increase, QPainter *p, - const QRect &r, bool horiz=true) const; + void drawBevelGradient(const QColor &base, QPainter *p, QRect const &r, + bool horiz, bool sel, EAppearance bevApp, EWidget w=WIDGET_OTHER) const; + void drawBevelGradientReal(const QColor &base, QPainter *p, QRect const &r, + bool horiz, bool sel, EAppearance bevApp, EWidget w=WIDGET_OTHER) const; + void drawGradient(const QColor &top, const QColor &bot, QPainter *p, const QRect &r, bool horiz=true) const; void drawSbSliderHandle(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, bool slider=false) const; void drawSliderHandle(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, QSlider *slider, bool tb=false) const; void drawSliderGroove(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, const QWidget *widget) const; - void drawMenuOrToolBarBackground(QPainter *p, const QRect &r, const QColorGroup &cg, bool menu=true, - bool horiz=true) const; + void drawMenuOrToolBarBackground(QPainter *p, const QRect &r, const QColorGroup &cg, bool menu=true, bool horiz=true) const; void drawHandleMarkers(QPainter *p, const QRect &r, SFlags flags, bool tb, ELine handles) const; + void drawHighlight(QPainter *p, const QRect &r, const QColorGroup &cg, bool horiz, bool inc) const; private: + static QColor shadowColor(const QColor col) + { + return qGray(col.rgb()) < 100 ? QColor(255, 255, 255) : QColor(0, 0, 0); + } + void shadeColors(const QColor &base, QColor *vals) const; const QColor * buttonColors(const QColorGroup &cg) const; + const QColor * checkRadioColors(const QColorGroup &cg, SFlags flags) const; const QColor * sliderColors(/*const QColorGroup &cg, */SFlags flags) const; const QColor * backgroundColors(const QColor &c) const; const QColor * backgroundColors(const QColorGroup &cg) const @@ -192,15 +220,28 @@ class QtCurveStyle : public HighContrastStyle const QColor * borderColors(SFlags flags, const QColor *use) const; const QColor * getSidebarButtons() const; void setMenuColors(const QColorGroup &cg); + const QColor * menuColors(const QColorGroup &cg, bool active) const; + void setDecorationColors(bool init=false); + const QColor * getMdiColors(const QColorGroup &cg, bool active) const; +#ifdef SET_MDI_WINDOW_BUTTON_POSITIONS + void readMdiPositions() const; +#endif bool redrawHoverWidget(const QPoint &pos); - const QColor & getFill(SFlags flags, const QColor *use) const; + const QColor & getFill(SFlags flags, const QColor *use, bool cr=false, bool darker=false) const; const QColor & getListViewFill(SFlags flags, const QColor *use) const; const QColor & getTabFill(bool current, bool highlight, const QColor *use) const; - + const QColor & menuStripeCol() const; + const QColor & checkRadioCol(SFlags flags, const QColorGroup &cg) const; + QColor shade(const QColor &a, float k) const; + void shade(const color &ca, color *cb, double k) const; + void drawDot(QPainter *p, const QRect &r, const QColor *cols) const; QPixmap * getPixelPixmap(const QColor col) const; QPixmap * getPixmap(const QColor col, EPixmap pix, double shade=1.0) const; + QPixmap * createStripePixmap(const QColor &col, bool forWindow) const; void setSbType(); bool isFormWidget(const QWidget *w) const { return itsKhtmlWidgets.contains(w); } + void resetHover(); + bool isWindowDragWidget(QObject *o, const QPoint &pos=QPoint()); private slots: @@ -208,25 +249,35 @@ class QtCurveStyle : public HighContrastStyle void progressBarDestroyed(QObject *bar); void sliderThumbMoved(int val); void khtmlWidgetDestroyed(QObject *o); + void hoverWidgetDestroyed(QObject *o); private: - Options opts; - QColor itsMenuitemCols[TOTAL_SHADES+1], + mutable Options opts; + QColor itsHighlightCols[TOTAL_SHADES+1], itsBackgroundCols[TOTAL_SHADES+1], itsMenubarCols[TOTAL_SHADES+1], + itsFocusCols[TOTAL_SHADES+1], *itsSliderCols, *itsDefBtnCols, *itsMouseOverCols, + *itsComboBtnCols, + *itsCheckRadioSelCols, + *itsSortedLvColors, + *itsProgressCols, itsButtonCols[TOTAL_SHADES+1], itsLighterPopupMenuBgndCol, itsCheckRadioCol; mutable QColor *itsSidebarButtonsCols; + mutable QColor *itsActiveMdiColors; + mutable QColor *itsMdiColors; + mutable QColor itsActiveMdiTextColor; + mutable QColor itsMdiTextColor; mutable QColor itsColoredButtonCols[TOTAL_SHADES+1]; mutable QColor itsColoredBackgroundCols[TOTAL_SHADES+1]; EApp itsThemedApp; mutable QCache<QPixmap> itsPixmapCache; -#if KDE_VERSION >= 0x30200 +#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200 bool itsIsTransKicker; #endif EHover itsHover; @@ -241,6 +292,9 @@ class QtCurveStyle : public HighContrastStyle QTimer *itsAnimationTimer; mutable bool itsActive, itsIsSpecialHover; + mutable QValueList<int> itsMdiButtons[2]; // 0=left, 1=right + QWidget *itsDragWidget; + bool itsDragWidgetHadMouseTracking; }; #endif |