00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __OXYGEN_STYLE_HELPER_H
00021 #define __OXYGEN_STYLE_HELPER_H
00022
00023 #include "lib/helper.h"
00024 #include "tileset.h"
00025
00026 class SlabCache {
00027 public:
00028 SlabCache() {}
00029 ~SlabCache() {}
00030
00031 QCache<quint64, QPixmap> m_roundSlabCache;
00032 QCache<quint64, TileSet> m_slabCache;
00033 };
00034
00035 class OxygenStyleHelper : public OxygenHelper
00036 {
00037 public:
00038 explicit OxygenStyleHelper(const QByteArray &componentName);
00039 virtual ~OxygenStyleHelper() {}
00040
00041 virtual void invalidateCaches();
00042
00043 QColor calcMidColor(const QColor &color) const;
00044
00045 static void fillSlab(QPainter&, const QRect&, int size = 7);
00046 static void fillHole(QPainter&, const QRect&, int size = 7);
00047
00048 QPixmap roundSlab(const QColor&, double shade, int size = 7);
00049 QPixmap roundSlabFocused(const QColor&, const QColor &glowColor, double shade, int size = 7);
00050
00051
00052 TileSet *slab(const QColor&, double shade, int size = 7);
00053 TileSet *slabFocused(const QColor&, const QColor &glowColor, double shade, int size = 7);
00054 TileSet *slabSunken(const QColor&, double shade, int size = 7);
00055 TileSet *slabInverted(const QColor&, double shade, int size = 7);
00056
00057 TileSet *slope(const QColor&, double shade, int size = 7);
00058
00059 TileSet *hole(const QColor&, double shade, int size = 7);
00060 TileSet *holeFlat(const QColor&, double shade, int size = 7);
00061 TileSet *holeFocused(const QColor&, const QColor &glowColor, double shade, int size = 7);
00062
00063 TileSet *groove(const QColor&, double shade, int size = 7);
00064
00065 TileSet *slitFocused(const QColor&);
00066
00067 TileSet *verticalScrollBar(const QColor&, int width, int offset, int size = 6);
00068 TileSet *horizontalScrollBar(const QColor&, int width, int offset, int size = 6);
00069
00070 TileSet *progressBar(const QColor&, QRect rect, Qt::Orientation orient = Qt::Horizontal, int size = 6);
00071
00072 protected:
00073 SlabCache* slabCache(const QColor&);
00074
00075 void drawInverseShadow(QPainter&, const QColor&, int pad, int size, double fuzz) const;
00076 void drawInverseGlow(QPainter&, const QColor&, int pad, int size, int rsize) const;
00077 void drawHole(QPainter&, const QColor&, double shade, int r = 7) const;
00078 void drawSlab(QPainter&, const QColor&, double shade) const;
00079
00080 static const double _slabThickness;
00081
00082 QCache<quint64, SlabCache> m_slabCache;
00083 QCache<quint64, TileSet> m_slabSunkenCache;
00084 QCache<quint64, TileSet> m_slabInvertedCache;
00085 QCache<quint64, TileSet> m_holeCache;
00086 QCache<quint64, TileSet> m_holeFlatCache;
00087 QCache<quint64, TileSet> m_slopeCache;
00088 QCache<quint64, TileSet> m_grooveCache;
00089 QCache<quint64, TileSet> m_slitCache;
00090 QCache<quint64, TileSet> m_verticalScrollBarCache;
00091 QCache<quint64, TileSet> m_horizontalScrollBarCache;
00092 QCache<quint64, TileSet> m_progressBarCache;
00093 };
00094
00095 #endif // __OXYGEN_STYLE_HELPER_H