diff --git a/tabbox.cpp b/tabbox.cpp index a1048eabb7..2a1a721bb1 100644 --- a/tabbox.cpp +++ b/tabbox.cpp @@ -24,7 +24,6 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include -#include #include #include #include @@ -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() diff --git a/tabbox.h b/tabbox.h index 36fe7fda94..31f69ff9cc 100644 --- a/tabbox.h +++ b/tabbox.h @@ -12,7 +12,7 @@ License. See the file "COPYING" for the exact licensing terms. #ifndef KWIN_TABBOX_H #define KWIN_TABBOX_H -#include +#include #include #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; };