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