2001-06-19 15:26:48 +00:00
|
|
|
#ifndef __MODSYSTEMCLIENT_H
|
|
|
|
#define __MODSYSTEMCLIENT_H
|
|
|
|
|
|
|
|
#include <qbutton.h>
|
|
|
|
#include <qbitmap.h>
|
|
|
|
#include <kpixmap.h>
|
2003-09-16 19:37:46 +00:00
|
|
|
#include <qbutton.h>
|
|
|
|
#include <kdecoration.h>
|
|
|
|
#include <kdecorationfactory.h>
|
|
|
|
|
2001-06-19 15:26:48 +00:00
|
|
|
class QLabel;
|
|
|
|
class QSpacerItem;
|
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
namespace ModernSystem {
|
2001-06-19 15:26:48 +00:00
|
|
|
|
2003-09-16 19:37:46 +00:00
|
|
|
class ModernSys;
|
2002-08-27 18:08:20 +00:00
|
|
|
|
2003-09-16 19:37:46 +00:00
|
|
|
class ModernButton : public QButton
|
2001-06-19 15:26:48 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2003-09-16 19:37:46 +00:00
|
|
|
ModernButton( ModernSys *parent=0, const char *name=0,
|
2004-07-25 12:39:32 +00:00
|
|
|
bool toggle = false, const unsigned char *bitmap=NULL,
|
2003-11-02 11:03:41 +00:00
|
|
|
const QString& tip=NULL, const int realizeBtns = LeftButton);
|
2001-06-19 15:26:48 +00:00
|
|
|
void setBitmap(const unsigned char *bitmap);
|
|
|
|
void reset();
|
|
|
|
QSize sizeHint() const;
|
2004-07-25 12:39:32 +00:00
|
|
|
void turnOn( bool isOn );
|
2001-06-19 15:26:48 +00:00
|
|
|
protected:
|
|
|
|
void mousePressEvent( QMouseEvent* e );
|
|
|
|
void mouseReleaseEvent( QMouseEvent* e );
|
|
|
|
|
|
|
|
virtual void drawButton(QPainter *p);
|
|
|
|
void drawButtonLabel(QPainter *){;}
|
|
|
|
QBitmap deco;
|
2003-09-16 19:37:46 +00:00
|
|
|
ModernSys* client;
|
2003-11-02 11:03:41 +00:00
|
|
|
|
|
|
|
int realizeButtons;
|
2001-06-19 15:26:48 +00:00
|
|
|
public:
|
2004-07-25 11:43:57 +00:00
|
|
|
ButtonState last_button;
|
2001-06-19 15:26:48 +00:00
|
|
|
};
|
|
|
|
|
2003-09-16 19:37:46 +00:00
|
|
|
class ModernSys : public KDecoration
|
2001-06-19 15:26:48 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2003-09-16 19:37:46 +00:00
|
|
|
ModernSys( KDecorationBridge* b, KDecorationFactory* f );
|
2001-06-19 15:26:48 +00:00
|
|
|
~ModernSys(){;}
|
2003-09-16 19:37:46 +00:00
|
|
|
void init();
|
2001-06-19 15:26:48 +00:00
|
|
|
protected:
|
2003-09-16 19:37:46 +00:00
|
|
|
bool eventFilter( QObject* o, QEvent* e );
|
2001-06-19 15:26:48 +00:00
|
|
|
void drawRoundFrame(QPainter &p, int x, int y, int w, int h);
|
|
|
|
void resizeEvent( QResizeEvent* );
|
|
|
|
void paintEvent( QPaintEvent* );
|
|
|
|
void showEvent( QShowEvent* );
|
|
|
|
void mouseDoubleClickEvent( QMouseEvent * );
|
2003-09-16 19:37:46 +00:00
|
|
|
void captionChange();
|
|
|
|
void maximizeChange();
|
2001-06-19 15:26:48 +00:00
|
|
|
void doShape();
|
|
|
|
void recalcTitleBuffer();
|
2003-09-16 19:37:46 +00:00
|
|
|
void activeChange();
|
2003-12-15 15:10:17 +00:00
|
|
|
Position mousePosition( const QPoint& ) const;
|
2003-09-16 19:37:46 +00:00
|
|
|
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-19 15:26:48 +00:00
|
|
|
protected slots:
|
|
|
|
void maxButtonClicked();
|
2004-07-25 12:39:32 +00:00
|
|
|
void slotAbove();
|
|
|
|
void slotBelow();
|
|
|
|
void slotShade();
|
|
|
|
void keepAboveChange( bool );
|
|
|
|
void keepBelowChange( bool );
|
2001-06-19 15:26:48 +00:00
|
|
|
private:
|
2004-07-25 12:39:32 +00:00
|
|
|
enum Buttons{ BtnClose = 0, BtnSticky, BtnMinimize, BtnMaximize, BtnHelp,
|
|
|
|
BtnAbove, BtnBelow, BtnShade,
|
|
|
|
BtnCount};
|
|
|
|
ModernButton* button[ModernSys::BtnCount];
|
2001-06-19 15:26:48 +00:00
|
|
|
QSpacerItem* titlebar;
|
|
|
|
QPixmap titleBuffer;
|
|
|
|
QString oldTitle;
|
|
|
|
};
|
|
|
|
|
2003-09-16 19:37:46 +00:00
|
|
|
class ModernSysFactory : public QObject, public KDecorationFactory
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ModernSysFactory();
|
|
|
|
virtual ~ModernSysFactory();
|
|
|
|
virtual KDecoration* createDecoration( KDecorationBridge* );
|
|
|
|
virtual bool reset( unsigned long changed );
|
2003-09-26 12:09:20 +00:00
|
|
|
QValueList< BorderSize > borderSizes() const;
|
|
|
|
private:
|
|
|
|
bool read_config();
|
2003-09-16 19:37:46 +00:00
|
|
|
};
|
|
|
|
|
2003-07-26 10:41:28 +00:00
|
|
|
}
|
2001-06-19 15:26:48 +00:00
|
|
|
|
|
|
|
#endif
|