Port tabbox from QFrame to Q3Frame.

svn path=/branches/work/kwin_composite/; revision=640446
icc-effect-5.14.5
Philip Falkner 2007-03-08 04:44:06 +00:00
parent 1300c934e8
commit 908a3e708e
2 changed files with 18 additions and 25 deletions

View File

@ -24,7 +24,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QApplication>
#include <qdesktopwidget.h>
#include <QCursor>
#include <kstringhandler.h>
#include <stdarg.h>
#include <kdebug.h>
#include <kglobalsettings.h>
@ -43,12 +42,14 @@ namespace KWinInternal
extern QPixmap* kwin_get_menu_pix_hack();
TabBox::TabBox( Workspace *ws, const char *name )
: Q3Frame( 0, name, Qt::WNoAutoErase | Qt::X11BypassWindowManagerHint ), client(0), wspace(ws)
TabBox::TabBox( Workspace *ws )
: QFrame( 0, Qt::X11BypassWindowManagerHint )
, client(0)
, wspace(ws)
{
setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
setLineWidth(2);
setMargin(2);
setContentsMargins( 2, 2, 2, 2 );
showMiniIcon = false;
@ -321,20 +322,18 @@ void TabBox::hideEvent( QHideEvent* )
/*!
Paints the tab box
*/
void TabBox::drawContents( QPainter * )
void TabBox::paintEvent( QPaintEvent* e )
{
QRect r(contentsRect());
QPixmap pix(r.size()); // do double buffering to avoid flickers
pix.fill(this, 0, 0);
QFrame::paintEvent( e );
QPainter p;
p.begin(&pix);
QPainter p( this );
QRect r( contentsRect());
QPixmap* menu_pix = kwin_get_menu_pix_hack();
int iconWidth = showMiniIcon ? 16 : 32;
int x = 0;
int y = 0;
int x = r.x();
int y = r.y();
if ( mode () == WindowsMode )
{
@ -388,7 +387,7 @@ void TabBox::drawContents( QPainter * )
else
s += (*it)->caption();
s = KStringHandler::cPixelSqueeze(s, fontMetrics(), r.width() - 5 - iconWidth - 8);
s = fontMetrics().elidedText( s, Qt::ElideMiddle, r.width() - 5 - iconWidth - 8 );
// draw text
if ( (*it) == currentClient() )
@ -503,10 +502,6 @@ void TabBox::drawContents( QPainter * )
iDesktop++;
}
}
p.end();
QPainter localPainter( this );
localPainter.drawImage( QPoint( r.x(), r.y() ), pix.toImage() );
}
void TabBox::hide()

View File

@ -12,7 +12,7 @@ License. See the file "COPYING" for the exact licensing terms.
#ifndef KWIN_TABBOX_H
#define KWIN_TABBOX_H
#include <Q3Frame>
#include <QFrame>
#include <QTimer>
#include "utils.h"
@ -24,15 +24,14 @@ namespace KWinInternal
class Workspace;
class Client;
class TabBox : public Q3Frame
class TabBox : public QFrame
{
Q_OBJECT
public:
TabBox( Workspace *ws, const char *name=0 );
TabBox( Workspace *ws );
~TabBox();
Client* currentClient();
void setCurrentClient( Client* c );
int currentDesktop();
// DesktopMode and WindowsMode are based on the order in which the desktop
@ -53,18 +52,18 @@ class TabBox : public Q3Frame
Workspace* workspace() const;
void reconfigure();
void updateKeyMapping();
protected:
void showEvent( QShowEvent* );
void hideEvent( QHideEvent* );
void drawContents( QPainter * );
void paintEvent( QPaintEvent* );
private:
void createClientList(ClientList &list, int desktop /*-1 = all*/, Client *start, bool chain);
void updateOutline();
private:
Client* current_client;
Client* client;
Mode m;
Workspace* wspace;
ClientList clients;
@ -74,7 +73,6 @@ class TabBox : public Q3Frame
QTimer delayedShowTimer;
QString no_tasks;
bool options_traverse_all;
Window outline_left, outline_right, outline_top, outline_bottom;
};