Back to index

kdeartwork  4.3.2
systemclient.h
Go to the documentation of this file.
00001 /********************************************************************
00002 This program is free software; you can redistribute it and/or modify
00003 it under the terms of the GNU General Public License as published by
00004 the Free Software Foundation; either version 2 of the License, or
00005 (at your option) any later version.
00006 
00007 This program is distributed in the hope that it will be useful,
00008 but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 GNU General Public License for more details.
00011 
00012 You should have received a copy of the GNU General Public License
00013 along with this program.  If not, see <http://www.gnu.org/licenses/>.
00014 *********************************************************************/
00015 
00016 #ifndef __SYSTEMCLIENT_H
00017 #define __SYSTEMCLIENT_H
00018 
00019 #include <qvariant.h>
00020 #include <qbitmap.h>
00021 #include <q3button.h>
00022 //Added by qt3to4:
00023 #include <QPixmap>
00024 #include <QPaintEvent>
00025 #include <QEvent>
00026 #include <QBoxLayout>
00027 #include <QLabel>
00028 #include <Q3ValueList>
00029 #include <QShowEvent>
00030 #include <QResizeEvent>
00031 #include <QMouseEvent>
00032 
00033 #include <kpixmap.h>
00034 #include <kdecorationfactory.h>
00035 #include <kcommondecoration.h>
00036 
00037 class QLabel;
00038 class QSpacerItem;
00039 class QBoxLayout;
00040 
00041 namespace System {
00042 
00043 class SystemButton;
00044 
00045 
00046 class SystemClient : public KCommonDecoration
00047 {
00048    Q_OBJECT
00049    public:
00050       SystemClient(KDecorationBridge* bridge, KDecorationFactory* factory);
00051       ~SystemClient();
00052       virtual Position mousePosition(const QPoint& p) const;
00053       virtual void resize(const QSize&);
00054       virtual void init();
00055 
00056       virtual QString visibleName() const ;
00057       virtual QString defaultButtonsLeft() const ;
00058       virtual QString defaultButtonsRight() const ;
00059       virtual KCommonDecorationButton *createButton(ButtonType type);
00060 
00061    protected:
00062       virtual void shadeChange() {};
00063       virtual QSize minimumSize() const;
00064       virtual void borders(int&, int&, int&, int&) const;
00065       virtual void reset( unsigned long changed );
00066       void drawRoundFrame(QPainter &p, int x, int y, int w, int h);
00067       void paintEvent( QPaintEvent* );
00068       void showEvent( QShowEvent* );
00069       void mouseDoubleClickEvent( QMouseEvent * );
00070       void doShape();
00071       void recalcTitleBuffer();
00072 
00073    private:
00074       QSpacerItem* titlebar;
00075       QPixmap titleBuffer;
00076       QString oldTitle;
00077 };
00078 
00079 class SystemButton : public KCommonDecorationButton
00080 {
00081    public:
00082       SystemButton(SystemClient *parent=0, const char *name=0,
00083                    const unsigned char *bitmap=NULL);
00084          virtual ~SystemButton() { }
00085       void setBitmap(const unsigned char *bitmap);
00086       virtual void reset(unsigned long changed);
00087       QSize sizeHint() const;
00088    protected:
00089       virtual void drawButton(QPainter *p);
00090       void drawButtonLabel(QPainter *){}
00091       QBitmap deco;
00092 
00093    private:
00094       SystemClient* client;
00095 };
00096 
00097 
00098 class SystemDecoFactory : public QObject, public KDecorationFactory
00099 {
00100    Q_OBJECT
00101    public:
00102       SystemDecoFactory();
00103       virtual ~SystemDecoFactory();
00104       virtual KDecoration *createDecoration(KDecorationBridge *);
00105       virtual bool reset(unsigned long);
00106       virtual bool supports( Ability ability );
00107       virtual QList< BorderSize > borderSizes() const;
00108    private:
00109       void readConfig();
00110 };
00111 
00112 
00113 
00114 }
00115 
00116 #endif