Source Code (Use browser search to find items of interest.)
Class Index
kdelibs'KThemePixmap (./kdelibs/kdeui/kthemebase.h:38)
class KThemePixmap : public KPixmap
{
public:
enum BorderType{Top=0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft,
BottomRight};
KThemePixmap(bool timer = true);
KThemePixmap(const KThemePixmap &p);
~KThemePixmap();
QPixmap* border(BorderType type);
void setBorder(BorderType type, const QPixmap &p);
void updateAccessed();
bool isOld();
protected:
QTime *t;
QPixmap *b[8];
};
inline QPixmap* KThemePixmap::border(BorderType type)
{
return(b[type]);
}
inline void KThemePixmap::setBorder(BorderType type, const QPixmap &p)
{
if(b[type]){
warning("KThemePixmap: Overwriting existing border!");
delete(b[type]);
}
b[type] = new QPixmap(p);
}
inline void KThemePixmap::updateAccessed()
{
if (t)
t->start();
}
inline bool KThemePixmap::isOld()
{
return(t ? t->elapsed() >= 300000 : false);
}
/**
* A very simple pixmap cache for theme plugins. QPixmapCache is not used
* since it uses QString keys which are not needed. All the information we
* need can be encoded in a numeric key. Using QIntCache instead allows us to
* skip the string operations.
*
* This class is mostly just inline methods that do bit operations on a key
* composed of the widget ID, width and/or height, and then calls
* QIntCache::find().
*
* One other thing to note is that full, horizontal, and vertically scaled
* pixmaps are not used interchangeably. For example, if you insert a fully
* scaled pixmap that is 32x32 then request a horizontally scaled pixmap with
* a width of 32, they will not match. This is because a pixmap that has been
* inserted into the cache has already been scaled at some point and it is
* very likely the vertical height was not originally 32. Thus the pixmap
* will be wrong when drawn, even though the horizontal width matches.
*
* @author Daniel M. Duley <mosfet@kde.org>
*
*/
kdelibs'KThemePixmap::KThemePixmap() (./kdelibs/kdeui/kthemebase.cpp:1205)
KThemePixmap::KThemePixmap(bool timer)
: KPixmap()
{
if(timer){
t = new QTime;
t->start();
}
else
t = NULL;
int i;
for(i=0; i < 8; ++i)
b[i] = NULL;
}
kdelibs'KThemePixmap::KThemePixmap() (./kdelibs/kdeui/kthemebase.cpp:1219)
KThemePixmap::KThemePixmap(const KThemePixmap &p)
:KPixmap(p)
{
if(p.t){
t = new QTime;
t->start();
}
else
t = NULL;
int i;
for(i=0; i < 8; ++i)
if(p.b[i])
b[i] = new QPixmap(*p.b[i]);
else
b[i] = NULL;
}
kdelibs'KThemePixmap::~KThemePixmap() (./kdelibs/kdeui/kthemebase.cpp:1238)
KThemePixmap::~KThemePixmap()
{
if(t)
delete t;
int i;
for(i=0; i < 8; ++i)
if(b[i])
delete b[i];
}
kdelibs'KThemePixmap::isOld() (./kdelibs/kdeui/kthemebase.h:76)
inline bool KThemePixmap::isOld()
{
return(t ? t->elapsed() >= 300000 : false);
}
/**
* A very simple pixmap cache for theme plugins. QPixmapCache is not used
* since it uses QString keys which are not needed. All the information we
* need can be encoded in a numeric key. Using QIntCache instead allows us to
* skip the string operations.
*
* This class is mostly just inline methods that do bit operations on a key
* composed of the widget ID, width and/or height, and then calls
* QIntCache::find().
*
* One other thing to note is that full, horizontal, and vertically scaled
* pixmaps are not used interchangeably. For example, if you insert a fully
* scaled pixmap that is 32x32 then request a horizontally scaled pixmap with
* a width of 32, they will not match. This is because a pixmap that has been
* inserted into the cache has already been scaled at some point and it is
* very likely the vertical height was not originally 32. Thus the pixmap
* will be wrong when drawn, even though the horizontal width matches.
*
* @author Daniel M. Duley <mosfet@kde.org>
*
*/