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