Back to index

kdeartwork  4.3.2
Public Member Functions | Protected Slots | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
IceWM::IceWMClient Class Reference

#include <icewm.h>

Collaboration diagram for IceWM::IceWMClient:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 IceWMClient (KDecorationBridge *bridge, KDecorationFactory *factory)
 ~IceWMClient ()
virtual void init ()
virtual void resize (const QSize &)
virtual bool eventFilter (QObject *o, QEvent *e)

Protected Slots

void slotMaximize ()
void menuButtonPressed ()
void menuButtonReleased ()
void toggleShade ()

Protected Member Functions

void resizeEvent (QResizeEvent *)
void paintEvent (QPaintEvent *)
void showEvent (QShowEvent *)
void mouseDoubleClickEvent (QMouseEvent *)
virtual void captionChange ()
virtual void maximizeChange ()
virtual void shadeChange ()
virtual void activeChange ()
Position mousePosition (const QPoint &) const
void renderMenuIcons ()
void iconChange ()
virtual void desktopChange ()
virtual void borders (int &, int &, int &, int &) const
virtual QSize minimumSize () const

Private Types

enum  Buttons {
  BtnSysMenu = 0, BtnClose, BtnMaximize, BtnMinimize,
  BtnHide, BtnRollup, BtnDepth, BtnCount
}

Private Member Functions

QString shortenCaption (const QString *s)
void calcHiddenButtons ()
int titleTextWidth (const QString &s)
void addClientButtons (const QString &s)
QSpacerItem * addPixmapSpacer (QPixmap *p[], QSizePolicy::SizeType=QSizePolicy::Maximum, int hsize=-1)

Private Attributes

IceWMButtonbutton [IceWMClient::BtnCount]
QPixmap * menuButtonWithIconPix [2]
QSpacerItem * titleSpacerJ
QSpacerItem * titleSpacerL
QSpacerItem * titleSpacerS
QSpacerItem * titleSpacerP
QSpacerItem * titlebar
QSpacerItem * titleSpacerM
QSpacerItem * titleSpacerB
QSpacerItem * titleSpacerR
QSpacerItem * titleSpacerQ
QBoxLayout * hb
QGridLayout * grid
bool m_closing

Detailed Description

Definition at line 136 of file icewm.h.


Member Enumeration Documentation

Enumerator:
BtnSysMenu 
BtnClose 
BtnMaximize 
BtnMinimize 
BtnHide 
BtnRollup 
BtnDepth 
BtnCount 

Definition at line 172 of file icewm.h.


Constructor & Destructor Documentation

IceWM::IceWMClient::IceWMClient ( KDecorationBridge *  bridge,
KDecorationFactory *  factory 
)

Definition at line 871 of file icewm.cpp.

    : KDecoration (bridge, factory),
      m_closing(false)
{
}

Definition at line 878 of file icewm.cpp.

{
       // Free the menu pixmaps if previously allocated
       if ( menuButtonWithIconPix[Active] )
              delete menuButtonWithIconPix[Active];
       if ( menuButtonWithIconPix[InActive] )
              delete menuButtonWithIconPix[InActive];
}

Member Function Documentation

void IceWM::IceWMClient::activeChange ( ) [protected, virtual]

Definition at line 1544 of file icewm.cpp.

{
       widget()->repaint(false);

    // Reset the button pixmaps.
       for(int i= IceWMClient::BtnSysMenu; i < IceWMClient::BtnCount; i++)
              if(button[i])
                     button[i]->repaint( false );
}
void IceWM::IceWMClient::addClientButtons ( const QString &  s) [private]

Definition at line 970 of file icewm.cpp.

{
       if (!s.isEmpty())
              for(unsigned int i = 0; i < s.length(); i++)
              {
                     switch ( s[i].latin1() )
                     {
                            case 's':
                                   // Create the menu icons, and render with the current mini-icon
                                   // if explicitly requested by the theme.
                                   if ( (validPixmaps(menuButtonPix) || showMenuButtonIcon) && !button[BtnSysMenu])
                                   {
                                          if (showMenuButtonIcon) {
                                                 renderMenuIcons();
                                                 button[BtnSysMenu] = new IceWMButton(this, "menu",
                                                        &menuButtonWithIconPix, false, i18n("Menu"), Qt::LeftButton|Qt::RightButton);
                                          }
                                          else
                                                 button[BtnSysMenu] = new IceWMButton(this, "menu",
                                                        &menuButtonPix, false, i18n("Menu"));

                                          connect( button[BtnSysMenu], SIGNAL(pressed()),
                                                         this, SLOT(menuButtonPressed()));
                                          connect( button[BtnSysMenu], SIGNAL(released()),
                                                         this, SLOT(menuButtonReleased()));
                                          hb->addWidget( button[BtnSysMenu] );
                                   }
                                   break;

                            case 'x':
                                   if ( validPixmaps(closePix) && !button[BtnClose] && isCloseable())
                                   {
                                          button[BtnClose] = new IceWMButton(this, "close",
                                                        &closePix, false, i18n("Close"));
                                          hb->addWidget( button[BtnClose] );
                                          connect( button[BtnClose], SIGNAL(clicked()),
                                                         this, SLOT(closeWindow()));
                                   }
                                   break;

                            case 'm':
                                   if ( validPixmaps(maximizePix) && !button[BtnMaximize] && isMaximizable() )
                                   {
                                          button[BtnMaximize] = new IceWMButton(this, "maximize",
                                                        &maximizePix, false, i18n("Maximize"), Qt::LeftButton|Qt::MidButton|Qt::RightButton);
                                          hb->addWidget( button[BtnMaximize] );
                                          connect( button[BtnMaximize], SIGNAL(clicked()),
                                                         this, SLOT(slotMaximize()));
                                   }
                                   break;

                            case 'i':
                                   if ( validPixmaps(minimizePix) && !button[BtnMinimize] &&
                                           isMinimizable() )
                                   {
                                          button[BtnMinimize] = new IceWMButton(this, "minimize",
                                                        &minimizePix, false, i18n("Minimize"));
                                          hb->addWidget( button[BtnMinimize] );
                                          connect( button[BtnMinimize], SIGNAL(clicked()),
                                                         this, SLOT(minimize()));
                                   }
                                   break;

                            /* Not yet implemented - how's hide useful anyway?
                            case 'h':
                                   if ( button[BtnHide]  && !button[BtnHide] )
                                          hb->addWidget( button[BtnHide] );
                                   break; */

                            case 'r':
                                   // NOTE: kwin doesn't have toggleShade() in clients.h !
                                if ( validPixmaps(rollupPix) && !button[BtnRollup] )
                                {
                                          button[BtnRollup] = new IceWMButton(this, "shade",
                                                 isSetShade() ? &rolldownPix : &rollupPix,
                                                                          false, i18n("Rollup"));
                                          hb->addWidget( button[BtnRollup] );
                                          connect( button[BtnRollup], SIGNAL(clicked()),
                                                         this, SLOT(toggleShade()));
                                   }
                                   break;

                            case 'd':
                                   // Make depth == on all desktops
                                   if ( validPixmaps(depthPix) && !button[BtnDepth] )
                                   {
                                          button[BtnDepth] = new IceWMButton(this, "on_all_desktops",
                                                        &depthPix, true, isOnAllDesktops()?i18n("Not on all desktops"):i18n("On all desktops"));
                                          button[BtnDepth]->turnOn( isOnAllDesktops() );
                                          hb->addWidget( button[BtnDepth] );
                                          connect( button[BtnDepth], SIGNAL(clicked()),
                                                         this, SLOT(toggleOnAllDesktops()));
                                   }
                                   break;
                     }
              }
}

Here is the call graph for this function:

Here is the caller graph for this function:

QSpacerItem * IceWM::IceWMClient::addPixmapSpacer ( QPixmap *  p[],
QSizePolicy::SizeType  s = QSizePolicy::Maximum,
int  hsize = -1 
) [private]

Definition at line 1070 of file icewm.cpp.

{
       QSpacerItem* sp;

       // Add a null spacer for zero image
       if ( p && p[Active] )
       {
              int w = (hsize == -1) ? p[Active]->width(): hsize;
              sp = new QSpacerItem( w, titleBarHeight, s, QSizePolicy::Fixed );
       }
       else
              sp = new QSpacerItem(0, 0, QSizePolicy::Maximum, QSizePolicy::Fixed );

       hb->addItem( sp );
       return sp;
}

Here is the caller graph for this function:

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

Definition at line 1149 of file icewm.cpp.

{
       left = borderSizeX;
       right = borderSizeX;
       if( titleBarOnTop ) {
              top = titleBarHeight + borderSizeY;
              bottom = borderSizeY;
       } else {
              top = borderSizeY;
              bottom = titleBarHeight + borderSizeY;
       }
}

Definition at line 1557 of file icewm.cpp.

{
       const int minwidth = 220; // Minimum width where all buttons are shown
       const int btn_width = 20; // Average width

       // Show/Hide buttons in this order - OnAllDesktops, Maximize, Menu, Rollup, Minimize, Close.
       IceWMButton* btnArray[] = { button[BtnDepth], button[BtnMaximize], button[BtnSysMenu],
                                                        button[BtnRollup], button[BtnMinimize], button[BtnClose] };

       int current_width = width();
       int count = 0;
       int i;

       // Find out how many buttons we have to hide.
       while (current_width < minwidth)
       {
              current_width += btn_width;
              count++;
       }

       // Bound the number of buttons to hide
       if (count > 6) count = 6;

       // Hide the required buttons...
       for(i = 0; i < count; i++)
       {
              if (btnArray[i] && btnArray[i]->isVisible() )
                     btnArray[i]->hide();
       }

       // Show the rest of the buttons...
       for(i = count; i < 6; i++)
       {
              if (btnArray[i] && (!btnArray[i]->isVisible()) )
                     btnArray[i]->show();
       }
}

Here is the caller graph for this function:

void IceWM::IceWMClient::captionChange ( ) [protected, virtual]

Definition at line 1509 of file icewm.cpp.

{
       QRect r( 0, borderSizeY, geometry().width(), titleBarHeight);

       titlebar->changeSize( titleTextWidth( caption() ), titleBarHeight,
                                            QSizePolicy::Preferred, QSizePolicy::Fixed );
       titlebar->invalidate();
    grid->activate();
    widget()->repaint( r, false );
}

Here is the call graph for this function:

void IceWM::IceWMClient::desktopChange ( ) [protected, virtual]

Definition at line 1497 of file icewm.cpp.

{
       if (button[BtnDepth])
       {
              button[BtnDepth]->turnOn( isOnAllDesktops() );
              button[BtnDepth]->repaint(false);
              button[BtnDepth]->setTipText(isOnAllDesktops() ? i18n("Not on all desktops") : i18n("On all desktops"));
       }
}

Here is the call graph for this function:

bool IceWM::IceWMClient::eventFilter ( QObject *  o,
QEvent *  e 
) [virtual]

Definition at line 1664 of file icewm.cpp.

{
       if( o != widget())
       return false;
       switch( e->type())
       {
       case QEvent::Resize:
              resizeEvent(static_cast< QResizeEvent* >( e ) );
              return true;
       case QEvent::Paint:
              paintEvent(static_cast< QPaintEvent* >( e ) );
              return true;
       case QEvent::MouseButtonDblClick:
              mouseDoubleClickEvent(static_cast< QMouseEvent* >( e ) );
              return true;
       case QEvent::MouseButtonPress:
              processMousePressEvent(static_cast< QMouseEvent* >( e ) );
              return true;
       default:
              break;
       }
       return false;
}

Here is the call graph for this function:

void IceWM::IceWMClient::iconChange ( ) [protected]

Definition at line 1482 of file icewm.cpp.

{
       if (validPixmaps(menuButtonPix) && showMenuButtonIcon)
       {
              if (button[BtnSysMenu])
              {
                     renderMenuIcons();
                     button[BtnSysMenu]->usePixmap( &menuButtonWithIconPix );
                     if (button[BtnSysMenu]->isVisible())
                            button[BtnSysMenu]->repaint(false);
              }
       }
}

Here is the call graph for this function:

void IceWM::IceWMClient::init ( ) [virtual]

Definition at line 888 of file icewm.cpp.

{
       createMainWidget( WNoAutoErase | WStaticContents );
       widget()->installEventFilter( this );

       // Set button pointers to null so we can track things
       for(int i= IceWMClient::BtnSysMenu; i < IceWMClient::BtnCount; i++)
              button[i] = NULL;

       // Make sure we can track the menu pixmaps too.
       menuButtonWithIconPix[Active] = NULL;
       menuButtonWithIconPix[InActive] = NULL;

       // No flicker thanks
       widget()->setBackgroundMode( NoBackground );

       // Pack the windowWrapper() window within a grid layout
       grid = new QGridLayout(widget(), 0, 0, 0);
       grid->setResizeMode(QLayout::FreeResize);
       grid->addRowSpacing(0, borderSizeY);      // Top grab bar

       // Do something IceWM can't do :)
       if (titleBarOnTop) {
              if( isPreview())
                     grid->addWidget( new QLabel( i18n( "<center><b>IceWM preview</b></center>" ), widget() ), 2, 1);
                else
                     grid->addItem( new QSpacerItem( 0, 0 ), 2, 1);
              // no shade flicker
       grid->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed,                                                                 QSizePolicy::Expanding ) );
    }
       else {
              // no shade flicker
       grid->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed,                                                                 QSizePolicy::Expanding ) );
              if( isPreview())
                     grid->addWidget( new QLabel( i18n( "<center><b>IceWM preview</b></center>" ), widget() ), 1, 1);
                else
                     grid->addItem( new QSpacerItem( 0, 0 ), 1, 1);
    }

       grid->setRowStretch(1, 10);
       grid->setRowStretch(2, 10);
       grid->setColStretch(1, 10);
       grid->addRowSpacing(3, borderSizeY);
       grid->addColSpacing(0, borderSizeX);
       grid->addColSpacing(2, borderSizeX);

       // Pack the titlebar with spacers and buttons
       hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
       hb->setResizeMode( QLayout::FreeResize );

       titleSpacerJ = addPixmapSpacer( titleJ );

       addClientButtons( *titleButtonsLeft );
       titleSpacerL = addPixmapSpacer( titleL );

       // Centre titlebar if required.
       QSizePolicy::SizeType spTitleBar;
       spTitleBar = titleBarCentered ? QSizePolicy::Expanding : QSizePolicy::Maximum;
       titleSpacerS = addPixmapSpacer( titleS, spTitleBar, 1 );
       titleSpacerP = addPixmapSpacer( titleP );

       titlebar = new QSpacerItem( titleTextWidth(caption()), titleBarHeight,
                                                        QSizePolicy::Preferred, QSizePolicy::Fixed );
       hb->addItem(titlebar);

       titleSpacerM = addPixmapSpacer( titleM );
       titleSpacerB = addPixmapSpacer( titleB, QSizePolicy::Expanding, 1 );
       titleSpacerR = addPixmapSpacer( titleR );

       addClientButtons( *titleButtonsRight );

       titleSpacerQ = addPixmapSpacer( titleQ );

       if (titleBarOnTop)
              grid->addLayout ( hb, 1, 1 );
       else
              grid->addLayout ( hb, 2, 1 );
}

Here is the call graph for this function:

void IceWM::IceWMClient::maximizeChange ( ) [protected, virtual]

Definition at line 1521 of file icewm.cpp.

{
       // Change the button pixmap to restore if required
       if (button[BtnMaximize] && validPixmaps(restorePix))
       {
              button[BtnMaximize]->usePixmap( (maximizeMode()==MaximizeFull) ? &restorePix : &maximizePix );
              button[BtnMaximize]->setTipText( (maximizeMode()==MaximizeFull) ? i18n("Restore") : i18n("Maximize"));
       }
}

Here is the call graph for this function:

void IceWM::IceWMClient::menuButtonPressed ( ) [protected, slot]

Definition at line 1632 of file icewm.cpp.

{
       static QTime t;
       static IceWMClient* lastClient = NULL;
       bool dbl = ( lastClient == this && t.elapsed() <= QApplication::doubleClickInterval());
       lastClient = this;
       t.start();

       if (dbl)
       {
              m_closing = true;
              return;
    }

       QPoint menuPoint ( button[BtnSysMenu]->rect().bottomLeft() );

       // Move to right if menu on rhs, otherwise on left
       // and make this depend on windowWrapper(), not button.

        KDecorationFactory* f = factory();
       showWindowMenu( button[BtnSysMenu]->mapToGlobal(menuPoint) );
        if( !f->exists( this )) // 'this' was deleted
            return;
       button[BtnSysMenu]->setDown(false);
}

Here is the caller graph for this function:

void IceWM::IceWMClient::menuButtonReleased ( ) [protected, slot]

Definition at line 1658 of file icewm.cpp.

{
       if (m_closing)
              closeWindow();
}

Here is the caller graph for this function:

QSize IceWM::IceWMClient::minimumSize ( ) const [protected, virtual]

Definition at line 1169 of file icewm.cpp.

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

Definition at line 1463 of file icewm.cpp.

{
       if( e->button() != Qt::LeftButton )
              return;

       QRect r;
       if (titleBarOnTop)
              r.setRect( borderSizeX, borderSizeY, width()-(2*borderSizeX), titleBarHeight);
       else
              r.setRect( borderSizeX, height()-borderSizeY-titleBarHeight,
                               width()-(2*borderSizeX), titleBarHeight);

       if (r.contains( e->pos() ) )
              titlebarDblClickOperation();

}

Here is the caller graph for this function:

IceWMClient::Position IceWM::IceWMClient::mousePosition ( const QPoint &  p) const [protected]

Definition at line 1597 of file icewm.cpp.

{
    int rangeX = cornerSizeX;
    int rangeY = cornerSizeY;
    int borderX = borderSizeX;
    int borderY = borderSizeY;

    Position m = PositionCenter;

    if ((p.x()  > borderX && p.x() < width()  - borderX) &&
           ( p.y() > borderY && p.y() < height() - borderY))
       return PositionCenter;

    if ( p.y() <= rangeY && p.x() <= rangeX)
              m = PositionTopLeft;
    else if ( p.y() >= height()-rangeY && p.x() >= width()-rangeX)
              m = PositionBottomRight;
    else if ( p.y() >= height()-rangeX && p.x() <= rangeX)
              m = PositionBottomLeft;
    else if ( p.y() <= rangeY && p.x() >= width()-rangeX)
              m = PositionTopRight;
    else if ( p.y() <= borderY )
              m = PositionTop;
    else if ( p.y() >= height()-borderY )
              m = PositionBottom;
    else if ( p.x() <= borderX )
              m = PositionLeft;
    else if ( p.x() >= width()-borderX )
       m = PositionRight;
    else
              m = PositionCenter;
       return m;
}
void IceWM::IceWMClient::paintEvent ( QPaintEvent *  ) [protected]

Definition at line 1207 of file icewm.cpp.

{
       QColor colorTitleShadow;
       QColor colorTitle;
       QColor c1;
       int rx, rw;

       QPainter p( widget() );
       int act = isActive() ? Active: InActive;

       // Determine titlebar shadow colors
       bool useShadow = isActive() ? useActiveShadow : useInActiveShadow;
       if ( useShadow )
              colorTitleShadow = isActive() ? *colorActiveTitleTextShadow : *colorInActiveTitleTextShadow;

       if ( themeTitleTextColors )
              colorTitle = isActive()? *colorActiveTitleBarText : *colorInActiveTitleBarText;
       else
              colorTitle = options()->color(ColorFont, isActive());

       // Obtain widget bounds.
       QRect r;
       r = widget()->rect();
       int fillWidth  = r.width()  - 2*borderSizeX;
       int y = r.y();
       int x = r.x();
       int w = r.width();
       int h = r.height();

       // Do we have pixmaps for the frame?
       if (validframe)
       {
              // Top corner
              p.drawPixmap(0, 0, *frameTL[ act ], 0, 0, cornerSizeX, borderSizeY);
              p.drawPixmap(0, 0, *frameTL[ act ], 0, 0, borderSizeX, cornerSizeY);

              // Top right corner
              p.drawPixmap(w-cornerSizeX, 0, *frameTR[ act ],
                                    frameTR[act]->width()-cornerSizeX, 0, cornerSizeX, borderSizeY);
              p.drawPixmap(w-borderSizeX, 0, *frameTR[ act ],
                                    frameTR[act]->width()-borderSizeX, 0, borderSizeX, cornerSizeY);

              // Top bar
              p.drawTiledPixmap( cornerSizeX, 0, w-(2*cornerSizeX), borderSizeY, *frameT[ act ] );

              // Left bar
              p.drawTiledPixmap( 0, cornerSizeY, borderSizeX, h-(2*cornerSizeY), *frameL[ act ] );

              // Right bar
              p.drawTiledPixmap( w-borderSizeX, cornerSizeY, borderSizeX, h-(2*cornerSizeY),
                                             *frameR[ act ],frameR[act]->width()-borderSizeX );

              // Bottom left corner
              p.drawPixmap(0, h-borderSizeY, *frameBL[ act ],
                                    0, frameBL[act]->height()-borderSizeY, cornerSizeX, borderSizeY);
              p.drawPixmap(0, h-cornerSizeY, *frameBL[ act ],
                                    0, frameBL[act]->height()-cornerSizeY, borderSizeX, cornerSizeY);

              // Bottom right corner
              p.drawPixmap(w-cornerSizeX, h-borderSizeY, *frameBR[ act ],
                                    frameBR[act]->width()-cornerSizeX, frameBR[act]->height()-borderSizeY,
                                    cornerSizeX, borderSizeY);

              p.drawPixmap(w-borderSizeX, h-cornerSizeY, *frameBR[ act ],
                                    frameBR[act]->width()-borderSizeX, frameBR[act]->height()-cornerSizeY,
                                    borderSizeX, cornerSizeY);

              // Bottom bar
              p.drawTiledPixmap(cornerSizeX, h-borderSizeY, w-(2*cornerSizeX), borderSizeY,
                                            *frameB[ act ], 0, frameB[ act ]->height()-borderSizeY );

              // Ensure uncovered areas during shading are painted with something
              p.setPen( *colorInActiveBorder );
              if (titleBarOnTop)
               p.drawLine( x+borderSizeX, y+h-borderSizeY-1,
                                          x+w-borderSizeX-1, y+h-borderSizeY-1);
              else
               p.drawLine( x+borderSizeX, y+borderSizeY,
                                          x+w-borderSizeX-1, y+borderSizeY);

       } else
       {
              // Draw a stock IceWM frame instead of a pixmap frame
              c1 = isActive() ? *colorActiveBorder : *colorInActiveBorder;

              if (themeLook == WARP3 || themeLook == MOTIF) {
                     draw3DRect(p, c1, x, y, w-1, h-1, true);
                     p.setPen(c1);
                     p.drawRect(x+1, y+1, w-2, h-2);
              } else {
                     p.setPen( c1.light(135) );
                     p.drawLine(0, 0, w-2, 0);
                     p.drawLine(0, 0, 0, h-2);

                     p.setPen(c1);
                     p.drawLine(1, 1, w-3, 1);
                     p.drawLine(1, 1, 1, h-3);

                     p.setPen( c1.dark(140) );
                     p.drawLine(1, h-2, w-2, h-2);
                     p.drawLine(w-2, 1, w-2, h-2);

                     p.setPen( Qt::black );
                     p.drawLine(w-1, 0, w-1, h-1);
                     p.drawLine(0, h-1, w-1, h-1);
              }


              // Fill frame border if required
              if (borderSizeX > 2)
              {
                     // Fill Vertical sizes
                     p.fillRect( x+2, y+2, borderSizeX-2, h-4, c1);
                     p.fillRect( w-borderSizeX, y+2, borderSizeX-2, h-4, c1);
              }

              if (borderSizeY > 2)
              {
                     // Fill horizontal frame parts
                     p.fillRect( x+borderSizeX, y+2, fillWidth, borderSizeY-2, c1);
                     p.fillRect( x+borderSizeX, h-borderSizeY, fillWidth, borderSizeY-2, c1);
              }

              if (themeLook == WARP3 || themeLook == MOTIF) {
                     draw3DRect(p, c1, x+borderSizeX-1, y+borderSizeY-1,
                                w+1-2*borderSizeX, h+1-2*borderSizeY, false);
              }
              if (themeLook == MOTIF && !isShade()) {
                     int xext = titleBarHeight + borderSizeX - 1;
                     int yext = titleBarHeight + borderSizeY - 1;

                     int xext2 = w-xext-2;
                     int yext2 = h-yext-2;

                     int bX = w - borderSizeX-1;
                     int bY = h - borderSizeY-1;

                     p.setPen( c1.dark(140) );
                     p.drawLine(xext, 0, xext, borderSizeY);
                     p.drawLine(xext2, 0, xext2, borderSizeY);
                     p.drawLine(xext, bY, xext, h-1);
                     p.drawLine(xext2, bY, xext2, h-1);

                     p.drawLine(0, yext, borderSizeX, yext);
                     p.drawLine(0, yext2, borderSizeX, yext2);
                     p.drawLine(bX, yext, w-1, yext);
                     p.drawLine(bX, yext2, w-1, yext2);

                     p.setPen( c1.light(135) );

                     ++xext; ++yext; ++xext2; ++yext2;

                     p.drawLine(xext, 0, xext, borderSizeY);
                     p.drawLine(xext2, 0, xext2, borderSizeY);
                     p.drawLine(xext, bY, xext, h-1);
                     p.drawLine(xext2, bY, xext2, h-1);

                     p.drawLine(0, yext, borderSizeX, yext);
                     p.drawLine(0, yext2, borderSizeX, yext2);
                     p.drawLine(bX, yext, w-1, yext);
                     p.drawLine(bX, yext2, w-1, yext2);


              }

              // Ensure uncovered areas during shading are painted with something
              p.setPen( *colorInActiveBorder );
              if (titleBarOnTop)
               p.drawLine( x+borderSizeX, y+h-borderSizeY-1,
                                          x+w-borderSizeX-1, y+h-borderSizeY-1);
              else
               p.drawLine( x+borderSizeX, y+borderSizeY,
                                          x+w-borderSizeX-1, y+borderSizeY);
       }

       // Draw the title elements, if we need to draw a titlebar.
       if (titleBarHeight > 0)
       {
              QPixmap* titleBuffer = new QPixmap( width()-(2*borderSizeX), titleBarHeight );
              QPainter p2( titleBuffer, this );
              titleBuffer->fill( act ? *colorActiveTitleBar : *colorInActiveTitleBar );

              r = titleSpacerJ->geometry();
              if (!r.isEmpty() && titleJ[ act ])
                     p2.drawPixmap( r.x()-borderSizeX, 0, *titleJ[ act ]);

              r = titleSpacerL->geometry();
              if (!r.isEmpty() && titleL[ act ])
                     p2.drawPixmap( r.x()-borderSizeX, 0, *titleL[ act ]);

              r = titleSpacerS->geometry();
              if (!r.isEmpty() && titleS[ act ])
                     p2.drawTiledPixmap( r.x()-borderSizeX, 0, r.width(), titleBarHeight, *titleS[ act ]);

              r = titleSpacerP->geometry();
              if (!r.isEmpty() && titleP[ act ])
                     p2.drawPixmap( r.x()-borderSizeX, 0, *titleP[ act ]);

              r = titlebar->geometry();
              if (!r.isEmpty() && titleT[ act ] )
                     p2.drawTiledPixmap( r.x()-borderSizeX, 0, r.width(), titleBarHeight, *titleT[ act ]);

              r = titleSpacerM->geometry();
              if (!r.isEmpty() && titleM[ act ])
                     p2.drawPixmap( r.x()-borderSizeX, 0, *titleM[ act ], 0, 0, r.width(), r.height());

              r = titleSpacerB->geometry();
              if (!r.isEmpty() && titleB[ act ])
                     p2.drawTiledPixmap( r.x()-borderSizeX, 0, r.width(), titleBarHeight, *titleB[ act ]);

              r = titleSpacerR->geometry();
              if (!r.isEmpty() && titleR[ act ])
                     p2.drawPixmap( r.x()-borderSizeX, 0, *titleR[ act ], 0, 0, r.width(), r.height());

              r = titleSpacerQ->geometry();
              if (!r.isEmpty() && titleQ[ act ])
                     p2.drawPixmap( r.x()-borderSizeX, 0, *titleQ[ act ], 0, 0, r.width(), r.height());

              p2.setFont( options()->font(true) );

              // Pre-compute as much as possible
              r = titlebar->geometry();
              rx = r.x() - borderSizeX;
              rw = width()-(2*borderSizeX)-r.x();

              // Paint a title text shadow if requested
              if ( useShadow )
              {
                     p2.setPen( colorTitleShadow );
                     p2.drawText(rx+1, 1, rw, titleBarHeight, AlignLeft|AlignVCenter, caption());
              }

              // Draw the title text
              p2.setPen( colorTitle );
              p2.drawText(rx, 0, rw, titleBarHeight, AlignLeft|AlignVCenter, caption());
              p2.end();

              bitBlt( widget(), borderSizeX, hb->geometry().y(), titleBuffer );

              delete titleBuffer;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1088 of file icewm.cpp.

{
       QPixmap miniIcon( icon().pixmap( QIcon::Small, QIcon::Normal) );

       if (!miniIcon.isNull())
                for(int i = 0; i < 2; i++) {
                       if ( menuButtonWithIconPix[i] )
                              delete menuButtonWithIconPix[i];

                       // Try to be more friendly to dodgy themes - icewm assumes a square menu button
                       // but some pixmap themes don't provide a square menu button.
                       int w = titleBarHeight;
                       if (validPixmaps(menuButtonPix) && menuButtonPix[i]->width() > w)
                               w = menuButtonPix[i]->width();
                       menuButtonWithIconPix[i] = new QPixmap(w, 2*titleBarHeight );
                       if (themeLook != WIN95)
                               menuButtonWithIconPix[i] -> fill((i==0) ? *colorInActiveButton : *colorActiveButton);
                       else
                               menuButtonWithIconPix[i] -> fill((i==0) ? *colorInActiveTitleBar : *colorActiveTitleBar);
                       QPainter pnt( menuButtonWithIconPix[i] );

                       if (themeLook > 0 && themeLook != WIN95 && themeLook != WARP4) {
                               draw3DRect(pnt, *colorActiveButton, 0, 0,
                                          w-1, titleBarHeight-1, true);
                               draw3DRect(pnt, *colorActiveButton, 0, titleBarHeight,
                                          w-1, 2*titleBarHeight-1, false);
                       }
                       if (validPixmaps(menuButtonPix)) {
                               pnt.drawPixmap(0, 0, *menuButtonPix[i]);
                       }
                       int offset = (titleBarHeight - miniIcon.width())/2;
                       if (offset<0) offset = 0;
                       // Paint the mini icon over the menu pixmap in the centre
                       pnt.drawPixmap( offset, offset, miniIcon );
                       pnt.drawPixmap( offset, titleBarHeight+offset, miniIcon );
                       pnt.end();
                }

}

Here is the call graph for this function:

Here is the caller graph for this function:

void IceWM::IceWMClient::resize ( const QSize &  s) [virtual]

Definition at line 1163 of file icewm.cpp.

{
       widget()->resize( s );
}
void IceWM::IceWMClient::resizeEvent ( QResizeEvent *  e) [protected]

Definition at line 1176 of file icewm.cpp.

{
       calcHiddenButtons();

       if (widget()->isVisibleToTLW())
       {
               widget()->update(widget()->rect());
              int dx = 0;
              int dy = 0;

              if ( e->oldSize().width() != widget()->width() )
                     dx = 32 + qAbs( e->oldSize().width() -  width() );

              if ( e->oldSize().height() != height() )
                     dy = 8 + qAbs( e->oldSize().height() -  height() );

              if ( dy )
                     widget()->update( 0, height() - dy + 1, width(), dy );

              if ( dx )
              {
                     widget()->update( width() - dx + 1, 0, dx, height() );
                     widget()->update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() - QPoint(1,0) ) );
                     widget()->update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
                     widget()->repaint(titlebar->geometry(), false);
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IceWM::IceWMClient::shadeChange ( ) [protected, virtual]

Definition at line 1532 of file icewm.cpp.

{
       // Change the button pixmap to rolldown if required
       if (button[BtnRollup] && validPixmaps(rolldownPix))
       {
              button[BtnRollup]->usePixmap( isSetShade() ? &rolldownPix : &rollupPix );
              button[BtnRollup]->setTipText( isSetShade() ? i18n("Rolldown") : i18n("Rollup"));
       }

}

Here is the call graph for this function:

QString IceWM::IceWMClient::shortenCaption ( const QString *  s) [private]
void IceWM::IceWMClient::showEvent ( QShowEvent *  ev) [protected]

Definition at line 1451 of file icewm.cpp.

{
       calcHiddenButtons();

       titlebar->changeSize( titleTextWidth(caption()), titleBarHeight,
                                            QSizePolicy::Preferred, QSizePolicy::Fixed );
       grid->activate();
       widget()->show();
       IceWMClient::showEvent(ev);
}

Here is the call graph for this function:

void IceWM::IceWMClient::slotMaximize ( ) [protected, slot]

Definition at line 1129 of file icewm.cpp.

{
       maximize(button[BtnMaximize]->last_button);
}

Here is the caller graph for this function:

int IceWM::IceWMClient::titleTextWidth ( const QString &  s) [private]

Definition at line 1139 of file icewm.cpp.

{
       // Obtains the actual width of the text, using the titlebar font
       QSize size;
       QFontMetrics fm( options()->font(true) );
       size = fm.size( 0, s );
       return size.width();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IceWM::IceWMClient::toggleShade ( ) [protected, slot]

Definition at line 1134 of file icewm.cpp.

{
        setShade(!isSetShade());
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 182 of file icewm.h.

QGridLayout* IceWM::IceWMClient::grid [private]

Definition at line 194 of file icewm.h.

QBoxLayout* IceWM::IceWMClient::hb [private]

Definition at line 193 of file icewm.h.

Definition at line 195 of file icewm.h.

Definition at line 183 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titlebar [private]

Definition at line 188 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titleSpacerB [private]

Definition at line 190 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titleSpacerJ [private]

Definition at line 184 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titleSpacerL [private]

Definition at line 185 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titleSpacerM [private]

Definition at line 189 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titleSpacerP [private]

Definition at line 187 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titleSpacerQ [private]

Definition at line 192 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titleSpacerR [private]

Definition at line 191 of file icewm.h.

QSpacerItem* IceWM::IceWMClient::titleSpacerS [private]

Definition at line 186 of file icewm.h.


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