Back to index

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

#include <systemclient.h>

List of all members.

Public Member Functions

 SystemClient (KDecorationBridge *bridge, KDecorationFactory *factory)
 ~SystemClient ()
virtual Position mousePosition (const QPoint &p) const
virtual void resize (const QSize &)
virtual void init ()
virtual QString visibleName () const
virtual QString defaultButtonsLeft () const
virtual QString defaultButtonsRight () const
virtual KCommonDecorationButton * createButton (ButtonType type)

Protected Member Functions

virtual void shadeChange ()
virtual QSize minimumSize () const
virtual void borders (int &, int &, int &, int &) const
virtual void reset (unsigned long changed)
void drawRoundFrame (QPainter &p, int x, int y, int w, int h)
void paintEvent (QPaintEvent *)
void showEvent (QShowEvent *)
void mouseDoubleClickEvent (QMouseEvent *)
void doShape ()
void recalcTitleBuffer ()

Private Attributes

QSpacerItem * titlebar
QPixmap titleBuffer
QString oldTitle

Detailed Description

Definition at line 46 of file systemclient.h.


Constructor & Destructor Documentation

System::SystemClient::SystemClient ( KDecorationBridge *  bridge,
KDecorationFactory *  factory 
)

Definition at line 326 of file systemclient.cpp.

    : KCommonDecoration(bridge, factory)
{}

Definition at line 330 of file systemclient.cpp.

{
}

Member Function Documentation

void System::SystemClient::borders ( int &  left,
int &  right,
int &  top,
int &  bottom 
) const [protected, virtual]

Definition at line 544 of file systemclient.cpp.

{
    left = 4;
    right = 4;
    top =  18;
    bottom = 8;

/*    if ((maximizeMode()==MaximizeFull) && !options()->moveResizeMaximizedWindows()) {
        left = right = bottom = 0;
        top = 1 + titleHeight + (borderSize-1);
    }*/
}
KCommonDecorationButton * System::SystemClient::createButton ( ButtonType  type) [virtual]

Definition at line 349 of file systemclient.cpp.

{
    switch (type) {
        case OnAllDesktopsButton:
            return new SystemButton(this, "sticky", NULL);

        case HelpButton:
            return new SystemButton(this, "help", question_bits);

        case MinButton:
            return new SystemButton(this, "iconify", iconify_bits);

        case MaxButton:
            return new SystemButton(this, "maximize", maximize_bits);

        case CloseButton:
            return new SystemButton(this, "close", NULL);


        default:
            return 0;
    }
}
QString System::SystemClient::defaultButtonsLeft ( ) const [virtual]

Definition at line 339 of file systemclient.cpp.

{
    return "X";
}
QString System::SystemClient::defaultButtonsRight ( ) const [virtual]

Definition at line 344 of file systemclient.cpp.

{
    return "HSIA";
}
void System::SystemClient::doShape ( ) [protected]

Definition at line 503 of file systemclient.cpp.

{
    // using a bunch of QRect lines seems much more efficent than bitmaps or
    // point arrays

    QRegion mask;
    kRoundMaskRegion(mask, 0, 0, width(), height());
    setMask(mask);
}

Here is the caller graph for this function:

void System::SystemClient::drawRoundFrame ( QPainter &  p,
int  x,
int  y,
int  w,
int  h 
) [protected]

Definition at line 456 of file systemclient.cpp.

{
   kDrawRoundButton(&p, x, y, w, h,
                    options()->colorGroup(KDecorationOptions::ColorFrame, isActive()), false);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void System::SystemClient::init ( ) [virtual]

Definition at line 373 of file systemclient.cpp.

{
    //TODO ?????
    KCommonDecoration::init();
}
QSize System::SystemClient::minimumSize ( ) const [protected, virtual]

Definition at line 407 of file systemclient.cpp.

{
   return widget()->minimumSize();
}
void System::SystemClient::mouseDoubleClickEvent ( QMouseEvent *  e) [protected]

Definition at line 526 of file systemclient.cpp.

{
   if ( e->button() == Qt::LeftButton && titlebar->geometry().contains( e->pos() ) )
      titlebarDblClickOperation();
}
KDecoration::Position System::SystemClient::mousePosition ( const QPoint &  p) const [virtual]

Definition at line 539 of file systemclient.cpp.

void System::SystemClient::paintEvent ( QPaintEvent *  ) [protected]

Definition at line 463 of file systemclient.cpp.

{
    QPainter p(widget());
    QRect t = titlebar->geometry();

    QBrush fillBrush(widget()->palette().brush(QPalette::Background).pixmap() ?
                     widget()->palette().brush(QPalette::Background) :
                     options()->color(KDecorationOptions::ColorFrame, isActive()).
                     brush(QPalette::Button));

    p.fillRect(1, 18, width()-2, height()-19, fillBrush);

    t.setTop( 2 );
    t.setLeft( t.left() + 4 );
    t.setRight( t.right() - 2 );

    if(isActive())
        p.drawPixmap(0, 0, titleBuffer);
    else{
        if(iUpperGradient)
            p.drawTiledPixmap(0, 0, width(), 18, *iUpperGradient);
        else
            p.fillRect(0, 0, width(), 18, fillBrush);
        p.setPen(options()->color(KDecorationOptions::ColorFont, isActive()));
        p.setFont(options()->font(isActive()));
        p.drawText(t, Qt::AlignCenter, caption() );
    }

    p.setPen(options()->color(KDecorationOptions::ColorFrame, isActive()).light());
    p.drawLine(width()-20, height()-7, width()-10,  height()-7);
    p.drawLine(width()-20, height()-5, width()-10,  height()-5);
    p.setPen(options()->color(KDecorationOptions::ColorFrame, isActive()).dark());
    p.drawLine(width()-20, height()-6, width()-10,  height()-6);
    p.drawLine(width()-20, height()-4, width()-10,  height()-4);

    drawRoundFrame(p, 0, 0, width(), height());
}

Here is the call graph for this function:

Definition at line 413 of file systemclient.cpp.

{
    if(oldTitle == caption() && width() == titleBuffer.width())
        return;
    QFontMetrics fm(options()->font(true));
    titleBuffer.resize(width(), 18);
    QPainter p;
    p.begin(&titleBuffer);
    if(aUpperGradient)
        p.drawTiledPixmap(0, 0, width(), 18, *aUpperGradient);
    else
        p.fillRect(0, 0, width(), 18,
                   options()->colorGroup(KDecorationOptions::ColorFrame, true).
                   brush(QPalette::Button));

    QRect t = titlebar->geometry();
    t.setTop( 2 );
    t.setLeft( t.left() + 4 );
    t.setRight( t.right() - 2 );

    QRegion r(t.x(), 0, t.width(), 18);
    r -= QRect(t.x()+((t.width()-fm.width(caption()))/2)-4,
               0, fm.width(caption())+8, 18);
    p.setClipRegion(r);
    int i, ly;
    for(i=0, ly=4; i < 4; ++i, ly+=3){
        p.setPen(options()->color(KDecorationOptions::ColorTitleBar, true).light(150));
        p.drawLine(0, ly, width()-1, ly);
        p.setPen(options()->color(KDecorationOptions::ColorTitleBar, true).dark(120));
        p.drawLine(0, ly+1, width()-1, ly+1);
    }
    p.setClipRect(t);
    p.setPen(options()->color(KDecorationOptions::ColorFont, true));
    p.setFont(options()->font(true));

    p.drawText(t.x()+((t.width()-fm.width(caption()))/2)-4,
               0, fm.width(caption())+8, 18, Qt::AlignCenter, caption());
    p.setClipping(false);
    p.end();
    oldTitle = caption();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void System::SystemClient::reset ( unsigned long  changed) [protected, virtual]

Definition at line 380 of file systemclient.cpp.

{
#if 0
    titleBuffer.resize(0, 0);
    recalcTitleBuffer();
#endif
    KCommonDecoration::reset(changed);
}

Here is the call graph for this function:

virtual void System::SystemClient::resize ( const QSize &  ) [virtual]
virtual void System::SystemClient::shadeChange ( ) [inline, protected, virtual]

Definition at line 62 of file systemclient.h.

{};
void System::SystemClient::showEvent ( QShowEvent *  ) [protected]

Definition at line 513 of file systemclient.cpp.

{
//    Client::showEvent(ev);
    doShape();
    widget()->show();
//    widget()->repaint();
}

Here is the call graph for this function:

QString System::SystemClient::visibleName ( ) const [virtual]

Definition at line 334 of file systemclient.cpp.

{
    return i18n( "System++" );
}

Member Data Documentation

QString System::SystemClient::oldTitle [private]

Definition at line 76 of file systemclient.h.

QSpacerItem* System::SystemClient::titlebar [private]

Definition at line 74 of file systemclient.h.

Definition at line 75 of file systemclient.h.


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