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 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 // vim: ts=4
KDE Logo
This file is part of the documentation for kwin Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jun 14 16:47:03 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003