Back to index

kdeartwork  4.3.2
cdeclient.h
Go to the documentation of this file.
00001 /*
00002  *     CDE KWin client - emulates the look and feel
00003  *     of dtwm, the CDE window manager.
00004  *
00005  *     Copyright (c) 2000-2001, 2002
00006  *            Chris Lee       <lee@azsites.com>
00007  *            Lennart Kudling <kudling@kde.org>
00008  *            Fredrik Höglund <fredrik@kde.org>
00009  *
00010  *     Copyright (c) 2003
00011  *            Luciano Montanaro <mikelima@cirulla.net>
00012  *
00013  *     Originally based on the KStep client.
00014  *
00015  *     Distributed under the terms of the BSD license.
00016  */
00017 
00018 #ifndef __CDECLIENT_H
00019 #define __CDECLIENT_H
00020 
00021 #include <q3button.h>
00022 #include <qbitmap.h>
00023 //Added by qt3to4:
00024 #include <QPaintEvent>
00025 #include <QEvent>
00026 #include <QBoxLayout>
00027 #include <QLabel>
00028 #include <Q3ValueList>
00029 #include <QShowEvent>
00030 #include <QVBoxLayout>
00031 #include <QResizeEvent>
00032 #include <QMouseEvent>
00033 #include <kpixmap.h>
00034 #include <kdecoration.h>
00035 #include <kdecorationfactory.h>
00036 #include <kcommondecoration.h>
00037 class QLabel;
00038 class QBoxLayout;
00039 class QVBoxLayout;
00040 class QSpacerItem;
00041 
00042 namespace CDE {
00043 
00044 class CdeClient;
00045 
00046 enum Buttons { BtnMenu=0, BtnHelp, BtnIconify, BtnMax, BtnClose, BtnCount };
00047 
00048 class CdeButton : public Q3Button
00049 {
00050 public:
00051     CdeButton( CdeClient* parent=0, const char* name=0, int btnType=0,
00052                const QString& tip=NULL, int realize_btns = Qt::LeftButton );
00053     void reset();
00054     Qt::ButtonState lastButton() { return last_button; }
00055 
00056 protected:
00057     void mousePressEvent(QMouseEvent *e);
00058     void mouseReleaseEvent(QMouseEvent *e);
00059     virtual void drawButton(QPainter *p);
00060 
00061 private:
00062     CdeClient *m_parent;
00063     int m_btnType;
00064     int m_realize_buttons;
00065     ButtonState last_button;
00066 };
00067 
00068 class CdeClient : public KDecoration
00069 {
00070     Q_OBJECT
00071 public:
00072     CdeClient(KDecorationBridge *b, KDecorationFactory *f);
00073     ~CdeClient() {};
00074     void init();
00075 
00076 protected:
00077     bool eventFilter(QObject *o, QEvent *e);
00078     void resizeEvent( QResizeEvent* );
00079     void paintEvent( QPaintEvent* );
00080 
00081     void showEvent(QShowEvent *);
00082     void addClientButtons( const QString& );
00083     void mouseDoubleClickEvent( QMouseEvent* );
00084     void captionChange();
00085     void desktopChange();
00086     void activeChange();
00087     void shadeChange();
00088     void iconChange();
00089     QSize minimumSize() const;
00090     void resize(const QSize &size);
00091     void borders(int &left, int &right, int &top, int &bottom) const;
00092     void mousePressEvent( QMouseEvent* );
00093     void mouseReleaseEvent( QMouseEvent* );
00094     void maximizeChange();
00095     Position mousePosition( const QPoint& p ) const;
00096 
00097 protected slots:
00098     void menuButtonPressed();
00099     void menuButtonReleased();
00100     void maximizeButtonClicked();
00101 
00102 private:
00103     CdeButton* button[BtnCount];
00104     QVBoxLayout* mainLayout;
00105     QBoxLayout*  titleLayout;
00106     QSpacerItem* titlebar;
00107     bool titlebarPressed;
00108     bool closing;
00109 };
00110 
00111 class CdeClientFactory: public QObject, public KDecorationFactory
00112 {
00113 public:
00114     CdeClientFactory();
00115     virtual ~CdeClientFactory();
00116     virtual KDecoration *createDecoration(KDecorationBridge *);
00117     virtual bool supports( Ability ability );
00118     virtual bool reset(unsigned long changed);
00119 
00120     Q3ValueList< CdeClientFactory::BorderSize > borderSizes() const;
00121 
00122 };
00123 
00124 }
00125 
00126 #endif
00127