Back to index

kdeartwork  4.3.2
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
System::SystemButton Class Reference

#include <systemclient.h>

Collaboration diagram for System::SystemButton:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SystemButton (SystemClient *parent=0, const char *name=0, const unsigned char *bitmap=NULL)
virtual ~SystemButton ()
void setBitmap (const unsigned char *bitmap)
virtual void reset (unsigned long changed)
QSize sizeHint () const

Protected Member Functions

virtual void drawButton (QPainter *p)
void drawButtonLabel (QPainter *)

Protected Attributes

QBitmap deco

Private Attributes

SystemClientclient

Detailed Description

Definition at line 79 of file systemclient.h.


Constructor & Destructor Documentation

System::SystemButton::SystemButton ( SystemClient parent = 0,
const char *  name = 0,
const unsigned char *  bitmap = NULL 
)

Definition at line 213 of file systemclient.cpp.

: KCommonDecorationButton(parent->widget(), name)
{
   setBackgroundMode( Qt::NoBackground );
   setCursor(Qt::ArrowCursor);
   resize(14, 14);
   if(bitmap)
      setBitmap(bitmap);
   client = parent;
}

Here is the call graph for this function:

virtual System::SystemButton::~SystemButton ( ) [inline, virtual]

Definition at line 84 of file systemclient.h.

{ }

Member Function Documentation

void System::SystemButton::drawButton ( QPainter *  p) [protected, virtual]

Definition at line 283 of file systemclient.cpp.

{
    if(btnPixDown){
        if(client->isActive())
            p->drawPixmap(0, 0, isDown() ? *btnPixDown : *btnPix);
        else
            p->drawPixmap(0, 0, isDown() ? *iBtnPixDown : *iBtnPix);
    }
    else{
        QColorGroup g = KDecoration::options()->color(KDecorationOptions::ColorFrame,
                                            client->isActive());
        int x2 = width()-1;
        int y2 = height()-1;
        // outer frame
        p->setPen(g.mid());
        p->drawLine(0, 0, x2, 0);
        p->drawLine(0, 0, 0, y2);
        p->setPen(g.light());
        p->drawLine(x2, 0, x2, y2);
        p->drawLine(0, x2, y2, x2);
        p->setPen(g.dark());
        p->drawRect(1, 1, width()-2, height()-2);
        // inner frame
        g = KDecoration::options()->colorGroup(KDecorationOptions::ColorButtonBg, client->isActive());
        p->fillRect(3, 3, width()-6, height()-6, g.background());
        p->setPen(isDown() ? g.mid() : g.light());
        p->drawLine(2, 2, x2-2, 2);
        p->drawLine(2, 2, 2, y2-2);
        p->setPen(isDown() ? g.light() : g.mid());
        p->drawLine(x2-2, 2, x2-2, y2-2);
        p->drawLine(2, x2-2, y2-2, x2-2);

    }

    if(!deco.isNull()){
        p->setPen(*btnForeground);
        p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco);
    }
}

Here is the call graph for this function:

void System::SystemButton::drawButtonLabel ( QPainter *  ) [inline, protected]

Definition at line 90 of file systemclient.h.

{}
void System::SystemButton::reset ( unsigned long  changed) [virtual]

Definition at line 231 of file systemclient.cpp.

{
  if (changed&DecorationReset || changed&ManualReset || changed&SizeChange || changed&StateChange) {
    switch (type() ) {
      case CloseButton:
        setBitmap(close_bits);
        break;
      case HelpButton:
        setBitmap(question_bits);
        break;
      case MinButton:
        setBitmap(iconify_bits);
        break;
      case MaxButton:
        setBitmap( isOn() ? unmaximize_bits : maximize_bits );
        break;
      case OnAllDesktopsButton:
        setBitmap( isOn() ? unsticky_bits : sticky_bits );
        break;
      case ShadeButton:
        setBitmap( isOn() ? shade_on_bits : shade_off_bits );
        break;
      default:
        setBitmap(0);
        break;
    }

    this->update();
  }
#if 0
  static unsigned char iconify_bits[] = {
    0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00};

static unsigned char maximize_bits[] = {
    0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00};

static unsigned char r_minmax_bits[] = {
    0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f};

static unsigned char l_minmax_bits[] = {
    0x30, 0x18, 0xcc, 0xe6, 0xf3, 0xf9, 0xfc, 0xfc};

#endif
}

Here is the call graph for this function:

void System::SystemButton::setBitmap ( const unsigned char *  bitmap)

Definition at line 276 of file systemclient.cpp.

{
    deco = QBitmap(8, 8, bitmap, true);
    deco.setMask(deco);
    repaint();
}

Here is the caller graph for this function:

Definition at line 226 of file systemclient.cpp.

{
    return(QSize(14, 14));
}

Member Data Documentation

Definition at line 94 of file systemclient.h.

QBitmap System::SystemButton::deco [protected]

Definition at line 91 of file systemclient.h.


The documentation for this class was generated from the following files: