kwin Library API Documentation

quartz.h

00001 /* 00002 * Gallium-Quartz KWin client 00003 * 00004 * Copyright 2001 00005 * Karol Szwed <gallium@kde.org> 00006 * http://gallium.n3.net/ 00007 * 00008 * Based on the KDE default client. 00009 * 00010 * Includes mini titlebars for ToolWindow Support. 00011 * Button positions are now customizable. 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 QValueList< BorderSize > borderSizes() const; 00041 00042 private: 00043 void readConfig(); 00044 void createPixmaps(); 00045 void freePixmaps(); 00046 void drawBlocks(KPixmap* pi, KPixmap &p, const QColor &c1, const QColor &c2); 00047 }; 00048 00049 00050 class QuartzButton : public QButton 00051 { 00052 public: 00053 QuartzButton(QuartzClient *parent=0, const char *name=0, bool largeButton=true, 00054 bool isLeftButton=true, bool isOnAllDesktopsButton=false, 00055 const unsigned char *bitmap=NULL, const QString& tip=NULL, const int realizeBtns = LeftButton); 00056 ~QuartzButton(); 00057 void setBitmap(const unsigned char *bitmap); 00058 void setTipText(const QString &tip); 00059 QSize sizeHint() const; 00060 ButtonState last_button; 00061 void turnOn( bool isOn ); 00062 00063 protected: 00064 void mousePressEvent( QMouseEvent* e ); 00065 void mouseReleaseEvent( QMouseEvent* e ); 00066 void drawButton(QPainter *p); 00067 void drawButtonLabel(QPainter*) {;} 00068 00069 QBitmap* deco; 00070 bool large; 00071 bool isLeft; 00072 bool isOnAllDesktops; 00073 QuartzClient* client; 00074 00075 int realizeButtons; 00076 }; 00077 00078 00079 class QuartzClient : public KDecoration 00080 { 00081 Q_OBJECT 00082 00083 public: 00084 QuartzClient(KDecorationBridge* bridge, KDecorationFactory* factory); 00085 ~QuartzClient() {;} 00086 00087 virtual void init(); 00088 virtual void resize(const QSize&); 00089 virtual bool eventFilter( QObject* o, QEvent* e ); 00090 00091 protected: 00092 virtual void reset( unsigned long changed ); 00093 void resizeEvent( QResizeEvent* ); 00094 void paintEvent( QPaintEvent* ); 00095 void showEvent( QShowEvent* ); 00096 void mouseDoubleClickEvent( QMouseEvent * ); 00097 virtual void captionChange(); 00098 void maximizeChange(); 00099 virtual void shadeChange(); 00100 virtual void activeChange(); 00101 virtual void iconChange(); 00102 virtual void desktopChange(); 00103 virtual QuartzClient::Position mousePosition(const QPoint &point) const; 00104 virtual void borders(int&, int&, int&, int&) const; 00105 virtual QSize minimumSize() const; 00106 00107 protected slots: 00108 void slotMaximize(); 00109 void slotAbove(); 00110 void slotBelow(); 00111 void slotShade(); 00112 void menuButtonPressed(); 00113 void keepAboveChange( bool ); 00114 void keepBelowChange( bool ); 00115 00116 private: 00117 bool isTool(); 00118 void calcHiddenButtons(); 00119 void addClientButtons( const QString& s, bool isLeft=true ); 00120 00121 enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose, 00122 BtnMenu, BtnOnAllDesktops, BtnAbove, BtnBelow, 00123 BtnShade, BtnCount }; 00124 QuartzButton* button[ QuartzClient::BtnCount ]; 00125 int lastButtonWidth; 00126 int titleHeight, borderSize; 00127 bool largeButtons; 00128 QBoxLayout* hb; 00129 QSpacerItem* titlebar; 00130 }; 00131 00132 } 00133 00134 #endif 00135 // vim: ts=4
KDE Logo
This file is part of the documentation for kwin Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 13 21:47:06 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003