KStyles
helper.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __OXYGEN_HELPER_H
00022 #define __OXYGEN_HELPER_H
00023
00024 #include <ksharedconfig.h>
00025 #include <kcomponentdata.h>
00026
00027 #include <QtGui/QColor>
00028 #include <QtGui/QPixmap>
00029 #include <QtGui/QLinearGradient>
00030 #include <QtCore/QCache>
00031
00032 #define _glowBias 0.9 // not likely to be configurable
00033
00034
00035 class OxygenHelper
00036 {
00037 public:
00038 explicit OxygenHelper(const QByteArray &componentName);
00039 virtual ~OxygenHelper() {}
00040
00041 KSharedConfigPtr config() const;
00042 void reloadConfig();
00043
00044 void renderWindowBackground(QPainter *p, const QRect &clipRect, const QWidget *widget, const QPalette & pal);
00045 virtual void invalidateCaches();
00046
00047 static bool lowThreshold(const QColor &color);
00048
00049 static QColor alphaColor(QColor color, double alpha);
00050
00051 QColor calcLightColor(const QColor &color) const;
00052 QColor calcDarkColor(const QColor &color) const;
00053 QColor calcShadowColor(const QColor &color) const;
00054
00055 QColor backgroundColor(const QColor &color, int height, int y);
00056
00057 QColor backgroundRadialColor(const QColor &color) const;
00058 QColor backgroundTopColor(const QColor &color) const;
00059 QColor backgroundBottomColor(const QColor &color) const;
00060
00061 QPixmap verticalGradient(const QColor &color, int height);
00062 QPixmap radialGradient(const QColor &color, int width);
00063
00064 QLinearGradient decoGradient(const QRect &r, const QColor &color);
00065
00066 QPixmap windecoButton(const QColor &color, bool pressed, int size = 21);
00067
00068 void drawFloatFrame(QPainter *p, const QRect r, const QColor &color) const;
00069
00070 protected:
00071 void drawShadow(QPainter&, const QColor&, int size) const;
00072 static QPixmap glow(const QColor&, int size, int rsize);
00073
00074 static const double _shadowGain;
00075
00076 KComponentData _componentData;
00077 KSharedConfigPtr _config;
00078 qreal _contrast;
00079 qreal _bgcontrast;
00080
00081 QCache<quint64, QPixmap> m_backgroundCache;
00082 QCache<quint64, QPixmap> m_windecoButtonCache;
00083 };
00084
00085 #endif // __OXYGEN_HELPER_H