Port tabbox from QFrame to Q3Frame.
svn path=/branches/work/kwin_composite/; revision=640446icc-effect-5.14.5
parent
1300c934e8
commit
908a3e708e
29
tabbox.cpp
29
tabbox.cpp
|
@ -24,7 +24,6 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <qdesktopwidget.h>
|
#include <qdesktopwidget.h>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <kstringhandler.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kglobalsettings.h>
|
#include <kglobalsettings.h>
|
||||||
|
@ -43,12 +42,14 @@ namespace KWinInternal
|
||||||
|
|
||||||
extern QPixmap* kwin_get_menu_pix_hack();
|
extern QPixmap* kwin_get_menu_pix_hack();
|
||||||
|
|
||||||
TabBox::TabBox( Workspace *ws, const char *name )
|
TabBox::TabBox( Workspace *ws )
|
||||||
: Q3Frame( 0, name, Qt::WNoAutoErase | Qt::X11BypassWindowManagerHint ), client(0), wspace(ws)
|
: QFrame( 0, Qt::X11BypassWindowManagerHint )
|
||||||
|
, client(0)
|
||||||
|
, wspace(ws)
|
||||||
{
|
{
|
||||||
setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
|
setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
|
||||||
setLineWidth(2);
|
setLineWidth(2);
|
||||||
setMargin(2);
|
setContentsMargins( 2, 2, 2, 2 );
|
||||||
|
|
||||||
showMiniIcon = false;
|
showMiniIcon = false;
|
||||||
|
|
||||||
|
@ -321,20 +322,18 @@ void TabBox::hideEvent( QHideEvent* )
|
||||||
/*!
|
/*!
|
||||||
Paints the tab box
|
Paints the tab box
|
||||||
*/
|
*/
|
||||||
void TabBox::drawContents( QPainter * )
|
void TabBox::paintEvent( QPaintEvent* e )
|
||||||
{
|
{
|
||||||
QRect r(contentsRect());
|
QFrame::paintEvent( e );
|
||||||
QPixmap pix(r.size()); // do double buffering to avoid flickers
|
|
||||||
pix.fill(this, 0, 0);
|
|
||||||
|
|
||||||
QPainter p;
|
QPainter p( this );
|
||||||
p.begin(&pix);
|
QRect r( contentsRect());
|
||||||
|
|
||||||
QPixmap* menu_pix = kwin_get_menu_pix_hack();
|
QPixmap* menu_pix = kwin_get_menu_pix_hack();
|
||||||
|
|
||||||
int iconWidth = showMiniIcon ? 16 : 32;
|
int iconWidth = showMiniIcon ? 16 : 32;
|
||||||
int x = 0;
|
int x = r.x();
|
||||||
int y = 0;
|
int y = r.y();
|
||||||
|
|
||||||
if ( mode () == WindowsMode )
|
if ( mode () == WindowsMode )
|
||||||
{
|
{
|
||||||
|
@ -388,7 +387,7 @@ void TabBox::drawContents( QPainter * )
|
||||||
else
|
else
|
||||||
s += (*it)->caption();
|
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
|
// draw text
|
||||||
if ( (*it) == currentClient() )
|
if ( (*it) == currentClient() )
|
||||||
|
@ -503,10 +502,6 @@ void TabBox::drawContents( QPainter * )
|
||||||
iDesktop++;
|
iDesktop++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.end();
|
|
||||||
|
|
||||||
QPainter localPainter( this );
|
|
||||||
localPainter.drawImage( QPoint( r.x(), r.y() ), pix.toImage() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabBox::hide()
|
void TabBox::hide()
|
||||||
|
|
14
tabbox.h
14
tabbox.h
|
@ -12,7 +12,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#ifndef KWIN_TABBOX_H
|
#ifndef KWIN_TABBOX_H
|
||||||
#define KWIN_TABBOX_H
|
#define KWIN_TABBOX_H
|
||||||
|
|
||||||
#include <Q3Frame>
|
#include <QFrame>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
@ -24,15 +24,14 @@ namespace KWinInternal
|
||||||
class Workspace;
|
class Workspace;
|
||||||
class Client;
|
class Client;
|
||||||
|
|
||||||
class TabBox : public Q3Frame
|
class TabBox : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TabBox( Workspace *ws, const char *name=0 );
|
TabBox( Workspace *ws );
|
||||||
~TabBox();
|
~TabBox();
|
||||||
|
|
||||||
Client* currentClient();
|
Client* currentClient();
|
||||||
void setCurrentClient( Client* c );
|
|
||||||
int currentDesktop();
|
int currentDesktop();
|
||||||
|
|
||||||
// DesktopMode and WindowsMode are based on the order in which the desktop
|
// DesktopMode and WindowsMode are based on the order in which the desktop
|
||||||
|
@ -53,18 +52,18 @@ class TabBox : public Q3Frame
|
||||||
Workspace* workspace() const;
|
Workspace* workspace() const;
|
||||||
|
|
||||||
void reconfigure();
|
void reconfigure();
|
||||||
|
void updateKeyMapping();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent( QShowEvent* );
|
void showEvent( QShowEvent* );
|
||||||
void hideEvent( QHideEvent* );
|
void hideEvent( QHideEvent* );
|
||||||
void drawContents( QPainter * );
|
void paintEvent( QPaintEvent* );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createClientList(ClientList &list, int desktop /*-1 = all*/, Client *start, bool chain);
|
void createClientList(ClientList &list, int desktop /*-1 = all*/, Client *start, bool chain);
|
||||||
void updateOutline();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Client* current_client;
|
Client* client;
|
||||||
Mode m;
|
Mode m;
|
||||||
Workspace* wspace;
|
Workspace* wspace;
|
||||||
ClientList clients;
|
ClientList clients;
|
||||||
|
@ -74,7 +73,6 @@ class TabBox : public Q3Frame
|
||||||
QTimer delayedShowTimer;
|
QTimer delayedShowTimer;
|
||||||
QString no_tasks;
|
QString no_tasks;
|
||||||
bool options_traverse_all;
|
bool options_traverse_all;
|
||||||
Window outline_left, outline_right, outline_top, outline_bottom;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue