Source Code (Use browser search to find items of interest.)
Class Index
kwin'SystemButton (./kdebase/kwin/clients/system/systemclient.h:13)
class SystemButton : public QButton
{
public:
SystemButton(QWidget *parent=0, const char *name=0,
const unsigned char *bitmap=NULL);
void setBitmap(const unsigned char *bitmap);
void reset();
QSize sizeHint() const;
protected:
virtual void drawButton(QPainter *p);
void drawButtonLabel(QPainter *){;}
KPixmap aBackground, iBackground;
QBitmap deco;
};
kwin'SystemButton::SystemButton() (./kdebase/kwin/clients/laptop/laptopclient.cpp:106)
SystemButton::SystemButton(int w, int h, QWidget *parent, const char *name,
const unsigned char *bitmap)
: QButton(parent, name)
{
setFixedSize(w, h);
aBackground.resize(w, h);
iBackground.resize(w, h);
reset();
//resize(22, 12);
if(bitmap)
setBitmap(bitmap);
}
/*
QSize SystemButton::sizeHint() const
{
return(QSize(22, 12));
}*/
kwin'SystemButton::reset() (./kdebase/kwin/clients/laptop/laptopclient.cpp:126)
void SystemButton::reset()
{
QPainter p;
int w = width();
int h = height();
QColor hColor(options->color(Options::ButtonBg, true));
QColor lColor(options->color(Options::ButtonBlend, true));
KPixmapEffect::gradient(aBackground, hColor.light(150), lColor.dark(150),
KPixmapEffect::DiagonalGradient);
p.begin(&aBackground);
p.setPen(options->colorGroup(Options::ButtonBg, false).dark());
p.drawLine(0, 0, w-1, 0);
p.drawLine(0, 0, 0, w-1);
p.setPen(options->colorGroup(Options::ButtonBg, false).light());
p.drawLine(w-1, 0, w-1, h-1);
p.drawLine(0, h-1, w-1, h-1);
p.end();
hColor = (options->color(Options::ButtonBg, false));
lColor = (options->color(Options::ButtonBlend, false));
KPixmapEffect::gradient(iBackground, hColor.light(150), lColor.dark(150),
KPixmapEffect::DiagonalGradient);
p.begin(&iBackground);
p.setPen(options->colorGroup(Options::ButtonBg, false).light());
p.drawLine(0, 0, w-1, 0);
p.drawLine(0, 0, 0, h-1);
p.setPen(options->colorGroup(Options::ButtonBg, false).dark());
p.drawLine(w-1, 0, w-1, h-1);
p.drawLine(0, h-1, w-1, h-1);
p.end();
}
kwin'SystemButton::setBitmap() (./kdebase/kwin/clients/laptop/laptopclient.cpp:161)
void SystemButton::setBitmap(const unsigned char *bitmap)
{
deco = QBitmap(8, 8, bitmap, true);
deco.setMask(deco);
repaint();
}
kwin'SystemButton::drawButton() (./kdebase/kwin/clients/laptop/laptopclient.cpp:168)
void SystemButton::drawButton(QPainter *p)
{
if(isDown())
p->drawPixmap(0, 0, aBackground);
else
p->drawPixmap(0, 0, iBackground);
p->setPen(options->color(Options::ButtonFg, isDown()));
int xOff = (width()-8)/2;
int yOff = (height()-8)/2;
p->drawPixmap(isDown() ? xOff+1: xOff, isDown() ? yOff+1 : yOff, deco);
}
kwin'SystemButton::SystemButton() (./kdebase/kwin/clients/system/systemclient.cpp:76)
SystemButton::SystemButton(QWidget *parent, const char *name,
const unsigned char *bitmap)
: QButton(parent, name)
{
aBackground.resize(14, 14);
iBackground.resize(14, 14);
reset();
resize(14, 14);
if(bitmap)
setBitmap(bitmap);
}
kwin'SystemButton::sizeHint() (./kdebase/kwin/clients/system/systemclient.cpp:89)
QSize SystemButton::sizeHint() const
{
return(QSize(14, 14));
}
kwin'SystemButton::reset() (./kdebase/kwin/clients/system/systemclient.cpp:94)
void SystemButton::reset()
{
QPainter p;
QColor hColor(options->color(Options::ButtonBg, true));
QColor lColor(options->color(Options::ButtonBlend, true));
KPixmapEffect::gradient(aBackground, hColor.light(150), lColor.dark(150),
KPixmapEffect::DiagonalGradient);
hColor = (options->color(Options::ButtonBg, false));
lColor = (options->color(Options::ButtonBlend, false));
KPixmapEffect::gradient(iBackground, hColor.light(150), lColor.dark(150),
KPixmapEffect::DiagonalGradient);
KPixmap aInternal;
aInternal.resize(10, 10);
KPixmap iInternal;
iInternal.resize(10, 10);
KPixmapEffect::gradient(iInternal,
options->color(Options::ButtonBlend, true),
options->color(Options::ButtonBg, true),
KPixmapEffect::DiagonalGradient);
KPixmapEffect::gradient(aInternal,
options->color(Options::ButtonBg, false),
options->color(Options::ButtonBlend, false),
KPixmapEffect::DiagonalGradient);
p.begin(&iBackground);
p.drawPixmap(2, 2, iInternal);
p.setPen(options->color(Options::ButtonBg, false).light(120));
p.drawLine(0, 13, 13, 13);
p.drawLine(13, 0, 13, 13);
p.setPen(options->color(Options::ButtonBlend, false).dark(120));
p.drawLine(0, 0, 12, 0);
p.drawLine(0, 0, 0, 12);
p.end();
p.begin(&aBackground);
p.drawPixmap(2, 2, aInternal);
p.setPen(options->colorGroup(Options::ButtonBg, true).mid());
p.drawRect(0, 0, 14, 14);
p.end();
}
kwin'SystemButton::setBitmap() (./kdebase/kwin/clients/system/systemclient.cpp:140)
void SystemButton::setBitmap(const unsigned char *bitmap)
{
deco = QBitmap(8, 8, bitmap, true);
deco.setMask(deco);
repaint();
}
kwin'SystemButton::drawButton() (./kdebase/kwin/clients/system/systemclient.cpp:147)
void SystemButton::drawButton(QPainter *p)
{
if(isDown())
p->drawPixmap(0, 0, aBackground);
else
p->drawPixmap(0, 0, iBackground);
p->setPen(options->color(Options::ButtonFg, isDown()));
p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco);
}