Source Code (Use browser search to find items of interest.)

Class Index

kwin'NextButton (./kdebase/kwin/clients/kstep/nextclient.h:13)

class NextButton : public QButton
{
public:
    NextButton(QWidget *parent=0, const char *name=0,
                 const unsigned char *bitmap=NULL, int bw=0, int bh=0);
    void setBitmap(const unsigned char *bitmap, int bw, int bh);
    void reset();
protected:
    virtual void drawButton(QPainter *p);
    void drawButtonLabel(QPainter *){;}
    KPixmap aBackground, iBackground;
    QBitmap deco;
};


kwin'NextButton::NextButton() (./kdebase/kwin/clients/kstep/nextclient.cpp:109)

NextButton::NextButton(QWidget *parent, const char *name,
                       const unsigned char *bitmap, int bw, int bh)
    : QButton(parent, name)
{
    QPainter p;

    aBackground.resize(18, 18);
    iBackground.resize(18, 18);
    reset();
    resize(18, 18);

    if(bitmap)
        setBitmap(bitmap, bw, bh);
}


kwin'NextButton::reset() (./kdebase/kwin/clients/kstep/nextclient.cpp:124)

void NextButton::reset()
{
    QPainter p;

    QColor hColor(options->color(Options::ButtonBg, true));
    QColor lColor(options->color(Options::ButtonBlend, true));
    // only do this if we can dim/brighten equally
    if(hColor.red() < 226 && hColor.green() < 226 && hColor.blue() < 226)
        hColor.setRgb(hColor.red()+30, hColor.green()+30, hColor.blue()+30);
    if(lColor.red() > 29 && lColor.green() > 29 && lColor.blue() > 29)
        lColor.setRgb(lColor.red()-30, lColor.green()-30, lColor.blue()-30);
    KPixmapEffect::gradient(iBackground, hColor, lColor,
                            KPixmapEffect::DiagonalGradient);

    hColor = options->color(Options::ButtonBlend, false);
    lColor = options->color(Options::ButtonBg, false);
    if(hColor.red() > 29 && hColor.green() > 29 && hColor.blue() > 29)
        hColor.setRgb(hColor.red()-30, hColor.green()-30, hColor.blue()-30);
    if(lColor.red() < 226 && lColor.green() < 226 && lColor.blue() < 226)
        lColor.setRgb(lColor.red()+30, lColor.green()+30, lColor.blue()+30);
    KPixmapEffect::gradient(aBackground, hColor, lColor,
                            KPixmapEffect::DiagonalGradient);

    KPixmap aInternal;
    aInternal.resize(12, 12);
    KPixmap iInternal;
    iInternal.resize(12, 12);
    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(3, 3, iInternal);
    p.setPen(Qt::black);
    p.drawRect(0, 0, 18, 18);
    p.end();

    p.begin(&aBackground);
    p.drawPixmap(3, 3, aInternal);
    p.setPen(Qt::black);
    p.drawRect(0, 0, 18, 18);
    p.end();
}


kwin'NextButton::setBitmap() (./kdebase/kwin/clients/kstep/nextclient.cpp:173)

void NextButton::setBitmap(const unsigned char *bitmap, int w, int h)
{
    deco = QBitmap(w, h, bitmap, true);
    deco.setMask(deco);
    repaint();
}


kwin'NextButton::drawButton() (./kdebase/kwin/clients/kstep/nextclient.cpp:180)

void NextButton::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()? 5 : 4, isDown() ? 5 : 4, deco);
}