parent
025cb620a3
commit
1512bcd09f
|
@ -175,10 +175,10 @@ static void create_pixmaps()
|
||||||
|
|
||||||
SystemButton::SystemButton(Client *parent, const char *name,
|
SystemButton::SystemButton(Client *parent, const char *name,
|
||||||
const unsigned char *bitmap)
|
const unsigned char *bitmap)
|
||||||
: QButton(parent, name)
|
: QToolButton(parent, name)
|
||||||
{
|
{
|
||||||
resize(14, 14);
|
resize(14, 14);
|
||||||
|
connect( this, SIGNAL( clicked() ), this, SLOT( handleClicked() ) );
|
||||||
if(bitmap)
|
if(bitmap)
|
||||||
setBitmap(bitmap);
|
setBitmap(bitmap);
|
||||||
client = parent;
|
client = parent;
|
||||||
|
@ -239,8 +239,29 @@ void SystemButton::drawButton(QPainter *p)
|
||||||
p->setPen(btnForeground);
|
p->setPen(btnForeground);
|
||||||
p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco);
|
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()
|
void SystemClient::slotReset()
|
||||||
{
|
{
|
||||||
if(aUpperGradient){
|
if(aUpperGradient){
|
||||||
|
@ -264,6 +285,21 @@ void SystemClient::slotReset()
|
||||||
button[4]->reset();
|
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,
|
SystemClient::SystemClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
const char *name )
|
const char *name )
|
||||||
: Client( ws, w, parent, name, WResizeNoErase )
|
: 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[0], SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) );
|
||||||
connect( button[1], SIGNAL( clicked() ), this, ( SLOT( toggleSticky() ) ) );
|
connect( button[1], SIGNAL( clicked() ), this, ( SLOT( toggleSticky() ) ) );
|
||||||
connect( button[2], SIGNAL( clicked() ), this, ( SLOT( iconify() ) ) );
|
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);
|
QHBoxLayout* hb = new QHBoxLayout(0);
|
||||||
hb->setResizeMode(QLayout::FreeResize);
|
hb->setResizeMode(QLayout::FreeResize);
|
||||||
|
|
|
@ -2,27 +2,42 @@
|
||||||
#define __SYSTEMCLIENT_H
|
#define __SYSTEMCLIENT_H
|
||||||
|
|
||||||
#include <qbutton.h>
|
#include <qbutton.h>
|
||||||
|
#include <qtoolbutton.h>
|
||||||
|
|
||||||
#include <qbitmap.h>
|
#include <qbitmap.h>
|
||||||
#include <kpixmap.h>
|
#include <kpixmap.h>
|
||||||
#include "../../client.h"
|
#include "../../client.h"
|
||||||
|
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QSpacerItem;
|
class QSpacerItem;
|
||||||
|
|
||||||
|
class SystemButton : public QToolButton
|
||||||
// get rid of autohide :P
|
|
||||||
class SystemButton : public QButton
|
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SystemButton(Client *parent=0, const char *name=0,
|
SystemButton(Client *parent=0, const char *name=0,
|
||||||
const unsigned char *bitmap=NULL);
|
const unsigned char *bitmap=NULL);
|
||||||
void setBitmap(const unsigned char *bitmap);
|
void setBitmap(const unsigned char *bitmap);
|
||||||
void reset();
|
void reset();
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
|
signals:
|
||||||
|
void clicked( int );
|
||||||
protected:
|
protected:
|
||||||
virtual void drawButton(QPainter *p);
|
virtual void drawButton(QPainter *p);
|
||||||
void drawButtonLabel(QPainter *){;}
|
void drawButtonLabel(QPainter *){;}
|
||||||
QBitmap deco;
|
QBitmap deco;
|
||||||
Client *client;
|
Client *client;
|
||||||
|
|
||||||
|
void mousePressEvent( QMouseEvent* e );
|
||||||
|
void mouseReleaseEvent( QMouseEvent* e );
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int last_button;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SystemClient : public Client
|
class SystemClient : public Client
|
||||||
|
@ -47,6 +62,9 @@ protected:
|
||||||
void activeChange(bool);
|
void activeChange(bool);
|
||||||
protected slots:
|
protected slots:
|
||||||
void slotReset();
|
void slotReset();
|
||||||
|
private slots:
|
||||||
|
void maxButtonClicked( int );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SystemButton* button[5];
|
SystemButton* button[5];
|
||||||
QSpacerItem* titlebar;
|
QSpacerItem* titlebar;
|
||||||
|
@ -55,7 +73,4 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue