laptopclient.h
00001
00002
00003
00004
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 int 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 isTool() const;
00085 bool isTransient() const;
00086 protected slots:
00087 void slotMaximize();
00088 private:
00089 LaptopButton* button[5];
00090 QGridLayout *g;
00091 QBoxLayout* hb;
00092 QSpacerItem* titlebar;
00093 QSpacerItem* spacer;
00094 KPixmap activeBuffer;
00095 int lastButtonWidth;
00096 int lastBufferWidth;
00097 bool hiddenItems;
00098 bool bufferDirty;
00099 };
00100
00101 class LaptopClientFactory : public QObject, public KDecorationFactory
00102 {
00103 public:
00104 LaptopClientFactory();
00105 virtual ~LaptopClientFactory();
00106 virtual KDecoration* createDecoration( KDecorationBridge* );
00107 virtual bool reset( unsigned long changed );
00108 virtual QValueList< BorderSize > borderSizes() const;
00109 private:
00110 void findPreferredHandleSize();
00111 };
00112
00113 }
00114
00115 #endif
This file is part of the documentation for kwin Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Apr 11 13:44:53 2004 by
doxygen 1.3.6-20040222 written by
Dimitri van Heesch, © 1997-2003