redmond.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __KDE_REDMOND_H
00019 #define __KDE_REDMOND_H
00020
00021 #include <qvariant.h>
00022 #include <qbutton.h>
00023 #include <qbitmap.h>
00024 #include <kpixmap.h>
00025 #include <kdecoration.h>
00026 #include <kdecorationfactory.h>
00027
00028 class QLabel;
00029 class QSpacerItem;
00030 class QBoxLayout;
00031
00032 namespace Redmond {
00033
00034 class RedmondDeco;
00035
00036 class RedmondButton : public QButton
00037 {
00038 Q_OBJECT
00039 public:
00040 RedmondButton(RedmondDeco *parent=0, const char *name=0,
00041 const unsigned char *bitmap=NULL,
00042 bool menuButton=false, bool isMini=false, int size = 16,
00043 const QString& tip=NULL, const int realizeBtns = LeftButton);
00044 void setBitmap(const unsigned char *bitmap);
00045 void setPixmap(const QPixmap &p);
00046 void reset();
00047
00048 QSize sizeHint() const;
00049 ButtonState last_button;
00050
00051 protected:
00052 void mousePressEvent(QMouseEvent* e);
00053 void mouseReleaseEvent(QMouseEvent* e);
00054 virtual void drawButton(QPainter *p);
00055 void drawButtonLabel(QPainter *){;}
00056
00057 QBitmap deco;
00058 QPixmap pix;
00059 bool menuBtn;
00060 bool miniBtn;
00061 RedmondDeco *client;
00062 int size;
00063
00064 int realizeButtons;
00065 };
00066
00067
00068 class RedmondDeco : public KDecoration
00069 {
00070 Q_OBJECT
00071
00072 public:
00073 RedmondDeco(KDecorationBridge *, KDecorationFactory *);
00074 ~RedmondDeco() {;}
00075 void init();
00076
00077 protected:
00078 void resizeEvent(QResizeEvent*);
00079 void paintEvent(QPaintEvent*);
00080 void showEvent(QShowEvent*);
00081 void mouseDoubleClickEvent(QMouseEvent *);
00082 void captionChange(const QString& name);
00083 void maximizeChange(bool m);
00084 void activeChange(bool);
00085 void iconChange();
00086 void calcHiddenButtons();
00087
00088
00089 Position mousePosition(const QPoint &) const;
00090 void borders(int &, int &, int &, int &) const;
00091 void resize(const QSize &);
00092 QSize minimumSize() const;
00093 void activeChange();
00094 void captionChange();
00095 void maximizeChange();
00096 void desktopChange();
00097 void shadeChange();
00098 bool eventFilter(QObject *, QEvent *);
00099
00100 protected slots:
00101 void slotReset();
00102 void slotMaximize();
00103 void menuButtonPressed();
00104
00105 private:
00106 enum Buttons{ BtnHelp=0, BtnMax, BtnMin, BtnClose, BtnMenu, BtnCount };
00107
00108 RedmondButton* button[RedmondDeco::BtnCount];
00109 int lastButtonWidth;
00110 int titleHeight;
00111 QSpacerItem* titlebar;
00112 bool hiddenItems;
00113 QBoxLayout* hb;
00114 bool smallButtons;
00115 };
00116
00117 class RedmondDecoFactory : public QObject, public KDecorationFactory
00118 {
00119 Q_OBJECT
00120 public:
00121 RedmondDecoFactory();
00122 virtual ~RedmondDecoFactory();
00123 virtual KDecoration *createDecoration(KDecorationBridge *);
00124 virtual bool reset(unsigned long);
00125 virtual bool supports( Ability ability );
00126 virtual QValueList< BorderSize > borderSizes() const;
00127 private:
00128 void readConfig();
00129 };
00130
00131 }
00132
00133 #endif
00134
This file is part of the documentation for kwin Library Version 3.4.1.