patch by boud2
svn path=/trunk/kdebase/kwin/; revision=68706
This commit is contained in:
parent
025cb620a3
commit
1512bcd09f
2 changed files with 60 additions and 9 deletions
|
@ -175,10 +175,10 @@ static void create_pixmaps()
|
|||
|
||||
SystemButton::SystemButton(Client *parent, const char *name,
|
||||
const unsigned char *bitmap)
|
||||
: QButton(parent, name)
|
||||
: QToolButton(parent, name)
|
||||
{
|
||||
resize(14, 14);
|
||||
|
||||
connect( this, SIGNAL( clicked() ), this, SLOT( handleClicked() ) );
|
||||
if(bitmap)
|
||||
setBitmap(bitmap);
|
||||
client = parent;
|
||||
|
@ -239,8 +239,29 @@ void SystemButton::drawButton(QPainter *p)
|
|||
p->setPen(btnForeground);
|
||||
p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SystemButton::mousePressEvent( QMouseEvent* e )
|
||||
{
|
||||
last_button = e->button();
|
||||
QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() );
|
||||
QToolButton::mousePressEvent( &me );
|
||||
}
|
||||
|
||||
void SystemButton::mouseReleaseEvent( QMouseEvent* e )
|
||||
{
|
||||
QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() );
|
||||
QToolButton::mouseReleaseEvent( &me );
|
||||
}
|
||||
|
||||
void SystemButton::handleClicked()
|
||||
{
|
||||
emit clicked( last_button );
|
||||
}
|
||||
|
||||
|
||||
void SystemClient::slotReset()
|
||||
{
|
||||
if(aUpperGradient){
|
||||
|
@ -264,6 +285,21 @@ void SystemClient::slotReset()
|
|||
button[4]->reset();
|
||||
}
|
||||
|
||||
void SystemClient::maxButtonClicked( int button )
|
||||
{
|
||||
switch ( button ){
|
||||
case MidButton:
|
||||
maximize( MaximizeVertical );
|
||||
break;
|
||||
case RightButton:
|
||||
maximize( MaximizeHorizontal );
|
||||
break;
|
||||
default: //LeftButton:
|
||||
maximize( MaximizeFull );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SystemClient::SystemClient( Workspace *ws, WId w, QWidget *parent,
|
||||
const char *name )
|
||||
: Client( ws, w, parent, name, WResizeNoErase )
|
||||
|
@ -299,7 +335,7 @@ SystemClient::SystemClient( Workspace *ws, WId w, QWidget *parent,
|
|||
connect( button[0], SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) );
|
||||
connect( button[1], SIGNAL( clicked() ), this, ( SLOT( toggleSticky() ) ) );
|
||||
connect( button[2], SIGNAL( clicked() ), this, ( SLOT( iconify() ) ) );
|
||||
connect( button[3], SIGNAL( clicked() ), this, ( SLOT( maximize() ) ) );
|
||||
connect( button[3], SIGNAL( clicked(int) ), this, ( SLOT( maxButtonClicked(int) ) ) );
|
||||
|
||||
QHBoxLayout* hb = new QHBoxLayout(0);
|
||||
hb->setResizeMode(QLayout::FreeResize);
|
||||
|
|
|
@ -2,27 +2,42 @@
|
|||
#define __SYSTEMCLIENT_H
|
||||
|
||||
#include <qbutton.h>
|
||||
#include <qtoolbutton.h>
|
||||
|
||||
#include <qbitmap.h>
|
||||
#include <kpixmap.h>
|
||||
#include "../../client.h"
|
||||
|
||||
|
||||
class QLabel;
|
||||
class QSpacerItem;
|
||||
|
||||
|
||||
// get rid of autohide :P
|
||||
class SystemButton : public QButton
|
||||
class SystemButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SystemButton(Client *parent=0, const char *name=0,
|
||||
const unsigned char *bitmap=NULL);
|
||||
void setBitmap(const unsigned char *bitmap);
|
||||
void reset();
|
||||
QSize sizeHint() const;
|
||||
signals:
|
||||
void clicked( int );
|
||||
protected:
|
||||
virtual void drawButton(QPainter *p);
|
||||
void drawButtonLabel(QPainter *){;}
|
||||
QBitmap deco;
|
||||
Client *client;
|
||||
|
||||
void mousePressEvent( QMouseEvent* e );
|
||||
void mouseReleaseEvent( QMouseEvent* e );
|
||||
|
||||
private slots:
|
||||
void handleClicked();
|
||||
|
||||
private:
|
||||
int last_button;
|
||||
|
||||
};
|
||||
|
||||
class SystemClient : public Client
|
||||
|
@ -47,6 +62,9 @@ protected:
|
|||
void activeChange(bool);
|
||||
protected slots:
|
||||
void slotReset();
|
||||
private slots:
|
||||
void maxButtonClicked( int );
|
||||
|
||||
private:
|
||||
SystemButton* button[5];
|
||||
QSpacerItem* titlebar;
|
||||
|
@ -55,7 +73,4 @@ private:
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue