modernsys.h
00001
00002 #ifndef __MODSYSTEMCLIENT_H
00003 #define __MODSYSTEMCLIENT_H
00004
00005 #include <qbutton.h>
00006 #include <qbitmap.h>
00007 #include <kpixmap.h>
00008 #include <qbutton.h>
00009 #include <kdecoration.h>
00010 #include <kdecorationfactory.h>
00011
00012 class QLabel;
00013 class QSpacerItem;
00014
00015 namespace ModernSystem {
00016
00017 class ModernSys;
00018
00019 class ModernButton : public QButton
00020 {
00021 Q_OBJECT
00022 public:
00023 ModernButton( ModernSys *parent=0, const char *name=0,
00024 const unsigned char *bitmap=NULL,
00025 const QString& tip=NULL, const int realizeBtns = LeftButton);
00026 void setBitmap(const unsigned char *bitmap);
00027 void reset();
00028 QSize sizeHint() const;
00029 protected:
00030 void mousePressEvent( QMouseEvent* e );
00031 void mouseReleaseEvent( QMouseEvent* e );
00032
00033 virtual void drawButton(QPainter *p);
00034 void drawButtonLabel(QPainter *){;}
00035 QBitmap deco;
00036 ModernSys* client;
00037
00038 int realizeButtons;
00039 public:
00040 int last_button;
00041 };
00042
00043 class ModernSys : public KDecoration
00044 {
00045 Q_OBJECT
00046 public:
00047 ModernSys( KDecorationBridge* b, KDecorationFactory* f );
00048 ~ModernSys(){;}
00049 void init();
00050 protected:
00051 bool eventFilter( QObject* o, QEvent* e );
00052 void drawRoundFrame(QPainter &p, int x, int y, int w, int h);
00053 void resizeEvent( QResizeEvent* );
00054 void paintEvent( QPaintEvent* );
00055 void showEvent( QShowEvent* );
00056 void mouseDoubleClickEvent( QMouseEvent * );
00057 void captionChange();
00058 void maximizeChange();
00059 void doShape();
00060 void recalcTitleBuffer();
00061 void activeChange();
00062 Position mousePosition( const QPoint& ) const;
00063 void desktopChange();
00064 void shadeChange();
00065 void iconChange();
00066 QSize minimumSize() const;
00067 void resize( const QSize& );
00068 void borders( int&, int&, int&, int& ) const;
00069 void reset( unsigned long );
00070 protected slots:
00071 void maxButtonClicked();
00072 private:
00073 enum Buttons{ BtnClose = 0, BtnSticky, BtnMinimize, BtnMaximize, BtnHelp };
00074 ModernButton* button[5];
00075 QSpacerItem* titlebar;
00076 QPixmap titleBuffer;
00077 QString oldTitle;
00078 };
00079
00080 class ModernSysFactory : public QObject, public KDecorationFactory
00081 {
00082 Q_OBJECT
00083 public:
00084 ModernSysFactory();
00085 virtual ~ModernSysFactory();
00086 virtual KDecoration* createDecoration( KDecorationBridge* );
00087 virtual bool reset( unsigned long changed );
00088 QValueList< BorderSize > borderSizes() const;
00089 private:
00090 bool read_config();
00091 };
00092
00093 }
00094
00095 #endif
This file is part of the documentation for kwin Library Version 3.2.2.