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