2003-10-04 23:55:55 +00:00
|
|
|
/*
|
|
|
|
* Laptop KWin Client
|
|
|
|
*
|
2005-03-22 23:03:13 +00:00
|
|
|
* Copyright (c) 2005 Sandro Giessl <sandro@giessl.com>
|
2004-05-21 10:37:36 +00:00
|
|
|
* Ported to the kde3.2 API by Luciano Montanaro <mikelima@cirulla.net>
|
2003-10-04 23:55:55 +00:00
|
|
|
*/
|
2001-06-20 11:17:03 +00:00
|
|
|
#ifndef __KDECLIENT_H
|
|
|
|
#define __KDECLIENT_H
|
|
|
|
|
2006-05-13 16:33:18 +00:00
|
|
|
#include <QBitmap>
|
|
|
|
#include <QPixmap>
|
2005-03-22 23:03:13 +00:00
|
|
|
#include <kcommondecoration.h>
|
2003-09-17 08:53:04 +00:00
|
|
|
#include <kdecorationfactory.h>
|
|
|
|
|
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
|
|
|
|
2005-03-22 23:03:13 +00:00
|
|
|
class LaptopButton : public KCommonDecorationButton
|
2001-06-20 11:17:03 +00:00
|
|
|
{
|
|
|
|
public:
|
2005-03-22 23:03:13 +00:00
|
|
|
LaptopButton(ButtonType type, LaptopClient *parent, const char *name);
|
2001-06-20 11:17:03 +00:00
|
|
|
void setBitmap(const unsigned char *bitmap);
|
2005-03-22 23:03:13 +00:00
|
|
|
virtual void reset(unsigned long changed);
|
2001-06-20 11:17:03 +00:00
|
|
|
|
|
|
|
protected:
|
2005-08-17 09:15:59 +00:00
|
|
|
void paintEvent(QPaintEvent *);
|
2001-06-20 11:17:03 +00:00
|
|
|
virtual void drawButton(QPainter *p);
|
|
|
|
QBitmap deco;
|
|
|
|
};
|
|
|
|
|
2005-03-22 23:03:13 +00:00
|
|
|
class LaptopClient : public KCommonDecoration
|
2001-06-20 11:17:03 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-09-17 08:53:04 +00:00
|
|
|
LaptopClient( KDecorationBridge* b, KDecorationFactory* f );
|
2005-01-28 17:06:35 +00:00
|
|
|
~LaptopClient();
|
2005-03-22 23:03:13 +00:00
|
|
|
|
|
|
|
virtual QString visibleName() const;
|
|
|
|
virtual QString defaultButtonsLeft() const;
|
|
|
|
virtual QString defaultButtonsRight() const;
|
|
|
|
virtual bool decorationBehaviour(DecorationBehaviour behaviour) const;
|
|
|
|
virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const;
|
|
|
|
virtual KCommonDecorationButton *createButton(ButtonType type);
|
|
|
|
|
|
|
|
virtual QRegion cornerShape(WindowCorner corner);
|
|
|
|
|
2003-09-17 08:53:04 +00:00
|
|
|
void init();
|
2001-06-20 11:17:03 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent( QPaintEvent* );
|
2003-09-17 08:53:04 +00:00
|
|
|
void reset( unsigned long );
|
2001-06-20 11:17:03 +00:00
|
|
|
void updateActiveBuffer();
|
2006-01-05 16:55:09 +00:00
|
|
|
void captionChange();
|
2003-09-17 08:53:04 +00:00
|
|
|
private:
|
2004-07-28 17:06:21 +00:00
|
|
|
bool mustDrawHandle() const;
|
2003-09-17 08:53:04 +00:00
|
|
|
bool isTransient() const;
|
2001-06-20 11:17:03 +00:00
|
|
|
private:
|
2006-04-26 16:05:58 +00:00
|
|
|
QPixmap activeBuffer;
|
2001-06-20 11:17:03 +00:00
|
|
|
int lastBufferWidth;
|
2003-09-17 08:53:04 +00:00
|
|
|
bool bufferDirty;
|
|
|
|
};
|
|
|
|
|
|
|
|
class LaptopClientFactory : public QObject, public KDecorationFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LaptopClientFactory();
|
|
|
|
virtual ~LaptopClientFactory();
|
|
|
|
virtual KDecoration* createDecoration( KDecorationBridge* );
|
|
|
|
virtual bool reset( unsigned long changed );
|
2004-11-05 15:33:09 +00:00
|
|
|
virtual bool supports( Ability ability );
|
2005-07-28 14:59:42 +00:00
|
|
|
virtual QList< BorderSize > borderSizes() const;
|
2003-10-02 16:46:13 +00:00
|
|
|
private:
|
|
|
|
void findPreferredHandleSize();
|
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
|