kwin Library API Documentation

laptopclient.h

00001 /* 00002 * Laptop KWin Client 00003 * 00004 * Ported to the kde3.2 API by Luciano Montanaro <mikelima@cirulla.net> 00005 */ 00006 #ifndef __KDECLIENT_H 00007 #define __KDECLIENT_H 00008 00009 #include <qbutton.h> 00010 #include <qbitmap.h> 00011 #include <kpixmap.h> 00012 #include <kdecoration.h> 00013 #include <kdecorationfactory.h> 00014 00015 class QLabel; 00016 class QSpacerItem; 00017 class QBoxLayout; 00018 class QGridLayout; 00019 00020 namespace Laptop { 00021 00022 class LaptopClient; 00023 00024 class LaptopButton : public QButton 00025 { 00026 public: 00027 LaptopButton(int w, int h, LaptopClient *parent=0, const char *name=0, 00028 const unsigned char *bitmap=NULL, const QString& tip=NULL, const int realizeBtns = LeftButton); 00029 void setBitmap(const unsigned char *bitmap); 00030 void reset(); 00031 QSize sizeHint() const; 00032 ButtonState last_button; 00033 00034 protected: 00035 void mousePressEvent( QMouseEvent* e ) 00036 { 00037 last_button = e->button(); 00038 QMouseEvent me ( e->type(), e->pos(), e->globalPos(), (e->button()&realizeButtons)?LeftButton:NoButton, e->state() ); 00039 QButton::mousePressEvent( &me ); 00040 } 00041 void mouseReleaseEvent( QMouseEvent* e ) 00042 { 00043 last_button = e->button(); 00044 QMouseEvent me ( e->type(), e->pos(), e->globalPos(), (e->button()&realizeButtons)?LeftButton:NoButton, e->state() ); 00045 QButton::mouseReleaseEvent( &me ); 00046 } 00047 virtual void drawButton(QPainter *p); 00048 void drawButtonLabel(QPainter *) {} 00049 LaptopClient *client; 00050 QSize defaultSize; 00051 QBitmap deco; 00052 int realizeButtons; 00053 }; 00054 00055 class LaptopClient : public KDecoration 00056 { 00057 Q_OBJECT 00058 public: 00059 enum Buttons{BtnHelp=0, BtnSticky, BtnMax, BtnIconify, BtnClose}; 00060 LaptopClient( KDecorationBridge* b, KDecorationFactory* f ); 00061 ~LaptopClient() {} 00062 void init(); 00063 protected: 00064 bool eventFilter( QObject* o, QEvent* e ); 00065 void resizeEvent( QResizeEvent* ); 00066 void paintEvent( QPaintEvent* ); 00067 void showEvent( QShowEvent* ); 00068 void mouseDoubleClickEvent( QMouseEvent* ); 00069 void captionChange(); 00070 void maximizeChange(); 00071 void doShape(); 00072 void activeChange(); 00073 Position mousePosition(const QPoint &) const; 00074 void desktopChange(); 00075 void shadeChange(); 00076 void iconChange(); 00077 QSize minimumSize() const; 00078 void resize( const QSize& ); 00079 void borders( int&, int&, int&, int& ) const; 00080 void reset( unsigned long ); 00081 void calcHiddenButtons(); 00082 void updateActiveBuffer(); 00083 private: 00084 bool mustDrawHandle() const; 00085 bool isTool() const; 00086 bool isTransient() const; 00087 protected slots: 00088 void slotMaximize(); 00089 private: 00090 LaptopButton* button[5]; 00091 QGridLayout *g; 00092 QBoxLayout* hb; 00093 QSpacerItem* titlebar; 00094 QSpacerItem* spacer; 00095 KPixmap activeBuffer; 00096 int lastButtonWidth; 00097 int lastBufferWidth; 00098 bool hiddenItems; 00099 bool bufferDirty; 00100 }; 00101 00102 class LaptopClientFactory : public QObject, public KDecorationFactory 00103 { 00104 public: 00105 LaptopClientFactory(); 00106 virtual ~LaptopClientFactory(); 00107 virtual KDecoration* createDecoration( KDecorationBridge* ); 00108 virtual bool reset( unsigned long changed ); 00109 virtual QValueList< BorderSize > borderSizes() const; 00110 private: 00111 void findPreferredHandleSize(); 00112 }; 00113 00114 } 00115 00116 #endif
KDE Logo
This file is part of the documentation for kwin Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 13 21:47:05 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003