2001-06-20 11:17:03 +00:00
|
|
|
#ifndef __KDECLIENT_H
|
|
|
|
#define __KDECLIENT_H
|
|
|
|
|
2003-09-17 08:53:04 +00:00
|
|
|
#include <qbutton.h>
|
2001-06-20 11:17:03 +00:00
|
|
|
#include <qbitmap.h>
|
|
|
|
#include <kpixmap.h>
|
2003-09-17 08:53:04 +00:00
|
|
|
#include <kdecoration.h>
|
|
|
|
#include <kdecorationfactory.h>
|
|
|
|
|
2001-06-20 11:17:03 +00:00
|
|
|
class QLabel;
|
|
|
|
class QSpacerItem;
|
2002-08-27 15:12:14 +00:00
|
|
|
class QBoxLayout;
|
2003-09-17 08:53:04 +00:00
|
|
|
class QGridLayout;
|
2001-06-20 11:17:03 +00:00
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
namespace Laptop {
|
2001-06-20 11:17:03 +00:00
|
|
|
|
2003-09-17 08:53:04 +00:00
|
|
|
class LaptopClient;
|
2002-08-27 18:08:20 +00:00
|
|
|
|
2003-09-17 08:53:04 +00:00
|
|
|
class LaptopClientButton : public QButton
|
2001-06-20 11:17:03 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-09-17 08:53:04 +00:00
|
|
|
LaptopClientButton(int w, int h, LaptopClient *parent=0, const char *name=0,
|
2001-07-01 10:10:17 +00:00
|
|
|
const unsigned char *bitmap=NULL, const QString& tip=NULL);
|
2001-06-20 11:17:03 +00:00
|
|
|
void setBitmap(const unsigned char *bitmap);
|
|
|
|
void reset();
|
|
|
|
QSize sizeHint() const;
|
|
|
|
int last_button;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mousePressEvent( QMouseEvent* e )
|
|
|
|
{
|
|
|
|
last_button = e->button();
|
|
|
|
QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() );
|
2003-09-17 08:53:04 +00:00
|
|
|
QButton::mousePressEvent( &me );
|
2001-06-20 11:17:03 +00:00
|
|
|
}
|
|
|
|
void mouseReleaseEvent( QMouseEvent* e )
|
|
|
|
{
|
|
|
|
last_button = e->button();
|
|
|
|
QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() );
|
2003-09-17 08:53:04 +00:00
|
|
|
QButton::mouseReleaseEvent( &me );
|
2001-06-20 11:17:03 +00:00
|
|
|
}
|
|
|
|
virtual void drawButton(QPainter *p);
|
|
|
|
void drawButtonLabel(QPainter *) {}
|
2003-09-17 08:53:04 +00:00
|
|
|
LaptopClient *client;
|
2001-06-20 11:17:03 +00:00
|
|
|
QSize defaultSize;
|
|
|
|
QBitmap deco;
|
|
|
|
};
|
|
|
|
|
2003-09-17 08:53:04 +00:00
|
|
|
class LaptopClient : public KDecoration
|
2001-06-20 11:17:03 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum Buttons{BtnHelp=0, BtnSticky, BtnMax, BtnIconify, BtnClose};
|
2003-09-17 08:53:04 +00:00
|
|
|
LaptopClient( KDecorationBridge* b, KDecorationFactory* f );
|
2001-06-20 11:17:03 +00:00
|
|
|
~LaptopClient() {}
|
2003-09-17 08:53:04 +00:00
|
|
|
void init();
|
2001-06-20 11:17:03 +00:00
|
|
|
protected:
|
2003-09-17 08:53:04 +00:00
|
|
|
bool eventFilter( QObject* o, QEvent* e );
|
2001-06-20 11:17:03 +00:00
|
|
|
void resizeEvent( QResizeEvent* );
|
|
|
|
void paintEvent( QPaintEvent* );
|
|
|
|
void showEvent( QShowEvent* );
|
|
|
|
void mouseDoubleClickEvent( QMouseEvent* );
|
2003-09-17 08:53:04 +00:00
|
|
|
void captionChange();
|
|
|
|
void maximizeChange();
|
2001-06-20 11:17:03 +00:00
|
|
|
void doShape();
|
2003-09-17 08:53:04 +00:00
|
|
|
void activeChange();
|
|
|
|
MousePosition mousePosition(const QPoint &) const;
|
|
|
|
void desktopChange();
|
|
|
|
void shadeChange();
|
|
|
|
void iconChange();
|
|
|
|
QSize minimumSize() const;
|
|
|
|
void resize( const QSize& );
|
|
|
|
void borders( int&, int&, int&, int& ) const;
|
|
|
|
void reset( unsigned long );
|
2001-06-20 11:17:03 +00:00
|
|
|
void calcHiddenButtons();
|
|
|
|
void updateActiveBuffer();
|
2003-09-17 08:53:04 +00:00
|
|
|
private:
|
|
|
|
bool isTool() const;
|
|
|
|
bool isTransient() const;
|
2001-06-20 11:17:03 +00:00
|
|
|
protected slots:
|
|
|
|
void slotMaximize();
|
|
|
|
private:
|
|
|
|
LaptopClientButton* button[5];
|
2003-09-17 08:53:04 +00:00
|
|
|
QGridLayout *g;
|
2002-08-27 15:12:14 +00:00
|
|
|
QBoxLayout* hb;
|
2003-09-17 08:53:04 +00:00
|
|
|
QSpacerItem* titlebar;
|
|
|
|
QSpacerItem* spacer;
|
2001-06-20 11:17:03 +00:00
|
|
|
KPixmap activeBuffer;
|
2003-09-17 08:53:04 +00:00
|
|
|
int lastButtonWidth;
|
2001-06-20 11:17:03 +00:00
|
|
|
int lastBufferWidth;
|
2003-09-17 08:53:04 +00:00
|
|
|
bool hiddenItems;
|
|
|
|
bool bufferDirty;
|
|
|
|
};
|
|
|
|
|
|
|
|
class LaptopClientFactory : public QObject, public KDecorationFactory
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
LaptopClientFactory();
|
|
|
|
virtual ~LaptopClientFactory();
|
|
|
|
virtual KDecoration* createDecoration( KDecorationBridge* );
|
|
|
|
virtual bool reset( unsigned long changed );
|
2001-06-20 11:17:03 +00:00
|
|
|
};
|
|
|
|
|
2003-07-26 10:41:28 +00:00
|
|
|
}
|
2001-06-20 11:17:03 +00:00
|
|
|
|
|
|
|
#endif
|