kdedefault.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _KDE_DEFAULT_H
00014 #define _KDE_DEFAULT_H
00015
00016 #include <qbutton.h>
00017 #include <qbitmap.h>
00018 #include <qdatetime.h>
00019 #include <kpixmap.h>
00020 #include <kdecoration.h>
00021 #include <kdecorationfactory.h>
00022
00023 class QSpacerItem;
00024 class QBoxLayout;
00025 class QGridLayout;
00026
00027 namespace Default {
00028
00029 class KDEDefaultClient;
00030
00031 class KDEDefaultHandler: public KDecorationFactory
00032 {
00033 public:
00034 KDEDefaultHandler();
00035 ~KDEDefaultHandler();
00036 KDecoration* createDecoration( KDecorationBridge* b );
00037 bool reset( unsigned long changed );
00038 virtual QValueList< BorderSize > borderSizes() const;
00039
00040 private:
00041 unsigned long readConfig( bool update );
00042 void createPixmaps();
00043 void freePixmaps();
00044 void drawButtonBackground(KPixmap *pix,
00045 const QColorGroup &g, bool sunken);
00046 };
00047
00048
00049 class KDEDefaultButton : public QButton, public KDecorationDefines
00050 {
00051 public:
00052 KDEDefaultButton(KDEDefaultClient *parent=0, const char *name=0,
00053 bool largeButton=true, bool isLeftButton=true,
00054 bool isStickyButton=false, const unsigned char *bitmap=NULL,
00055 const QString& tip=NULL, const int realizeBtns = LeftButton);
00056 ~KDEDefaultButton();
00057
00058 ButtonState last_button;
00059 void turnOn( bool isOn );
00060 void setBitmap(const unsigned char *bitmap);
00061 QSize sizeHint() const;
00062
00063 protected:
00064 void enterEvent(QEvent *);
00065 void leaveEvent(QEvent *);
00066 void mousePressEvent( QMouseEvent* e );
00067 void mouseReleaseEvent( QMouseEvent* e );
00068 void drawButton(QPainter *p);
00069 void drawButtonLabel(QPainter*) {;}
00070
00071 QBitmap* deco;
00072 bool large;
00073 bool isLeft;
00074 bool isSticky;
00075 bool isMouseOver;
00076 KDEDefaultClient* client;
00077
00078 int realizeButtons;
00079 };
00080
00081
00082 class KDEDefaultClient : public KDecoration
00083 {
00084 Q_OBJECT
00085
00086 public:
00087 KDEDefaultClient( KDecorationBridge* b, KDecorationFactory* f );
00088 ~KDEDefaultClient() {;}
00089 void init();
00090 void borders( int&, int&, int&, int& ) const;
00091 void resize( const QSize& );
00092 QSize minimumSize() const;
00093 void reset( unsigned long changed );
00094
00095 protected:
00096 bool eventFilter( QObject*, QEvent* );
00097 void resizeEvent( QResizeEvent* );
00098 void paintEvent( QPaintEvent* );
00099 void showEvent( QShowEvent* );
00100 void mouseDoubleClickEvent( QMouseEvent * );
00101 void captionChange();
00102 void maximizeChange();
00103 void activeChange();
00104 void iconChange();
00105 void desktopChange();
00106 void shadeChange();
00107 Position mousePosition(const QPoint &) const;
00108
00109 protected slots:
00110 void slotMaximize();
00111 void slotAbove();
00112 void slotBelow();
00113 void slotShade();
00114 void menuButtonPressed();
00115 void menuButtonReleased();
00116 void keepAboveChange( bool );
00117 void keepBelowChange( bool );
00118
00119 private:
00120 void doShape();
00121 void calcHiddenButtons();
00122 bool mustDrawHandle() const;
00123 void addClientButtons( const QString& s, bool isLeft=true );
00124 bool isTool() const;
00125
00126 enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose,
00127 BtnMenu, BtnSticky, BtnAbove, BtnBelow, BtnShade, BtnCount };
00128 KDEDefaultButton* button[ KDEDefaultClient::BtnCount ];
00129 int lastButtonWidth;
00130 int titleHeight;
00131 bool largeButtons;
00132 QGridLayout* g;
00133 QBoxLayout* hb;
00134 QSpacerItem* titlebar;
00135 QSpacerItem* spacer;
00136 bool m_closing;
00137 };
00138
00139 }
00140
00141 #endif
00142
This file is part of the documentation for kwin Library Version 3.3.2.