modernsys.h
00001 #ifndef __MODSYSTEMCLIENT_H
00002 #define __MODSYSTEMCLIENT_H
00003
00004 #include <qbutton.h>
00005 #include <qbitmap.h>
00006 #include <kpixmap.h>
00007 #include <qbutton.h>
00008 #include <kdecoration.h>
00009 #include <kdecorationfactory.h>
00010
00011 class QLabel;
00012 class QSpacerItem;
00013
00014 namespace ModernSystem {
00015
00016 class ModernSys;
00017
00018 class ModernButton : public QButton
00019 {
00020 Q_OBJECT
00021 public:
00022 ModernButton( ModernSys *parent=0, const char *name=0,
00023 bool toggle = false, const unsigned char *bitmap=NULL,
00024 const QString& tip=NULL, const int realizeBtns = LeftButton);
00025 void setBitmap(const unsigned char *bitmap);
00026 void reset();
00027 QSize sizeHint() const;
00028 void turnOn( bool isOn );
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 ButtonState 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 void slotAbove();
00073 void slotBelow();
00074 void slotShade();
00075 void keepAboveChange( bool );
00076 void keepBelowChange( bool );
00077 private:
00078 enum Buttons{ BtnClose = 0, BtnSticky, BtnMinimize, BtnMaximize, BtnHelp,
00079 BtnAbove, BtnBelow, BtnShade,
00080 BtnCount};
00081 ModernButton* button[ModernSys::BtnCount];
00082 QSpacerItem* titlebar;
00083 QPixmap titleBuffer;
00084 QString oldTitle;
00085 };
00086
00087 class ModernSysFactory : public QObject, public KDecorationFactory
00088 {
00089 Q_OBJECT
00090 public:
00091 ModernSysFactory();
00092 virtual ~ModernSysFactory();
00093 virtual KDecoration* createDecoration( KDecorationBridge* );
00094 virtual bool reset( unsigned long changed );
00095 QValueList< BorderSize > borderSizes() const;
00096 private:
00097 bool read_config();
00098 };
00099
00100 }
00101
00102 #endif
This file is part of the documentation for kwin Library Version 3.3.90.