kwin Library API Documentation

redmond.h

00001 /*
00002  * $Id: redmond.h,v 1.10 2003/12/15 15:10:17 lunakl Exp $
00003  *
00004  * Redmond KWin client
00005  *
00006  * Copyright 2001-2003
00007  *   Ported to kwin_iii by Chris Lee <clee@kde.org>
00008  *   Karol Szwed <gallium@kde.org>
00009  *   http://gallium.n3.net/
00010  *
00011  * Based on the default KWin client.
00012  *
00013  * Updated to support the new API 9/2003 (CL)
00014  * Updated to emulate More Accurately 9/2003 (CL)
00015  * Updated to support toolwindows 3/2001 (KS)
00016  *
00017  */
00018 
00019 #ifndef __KDE_REDMOND_H
00020 #define __KDE_REDMOND_H
00021 
00022 #include <qvariant.h>
00023 #include <qbutton.h>
00024 #include <qbitmap.h>
00025 #include <kpixmap.h>
00026 #include <kdecoration.h>
00027 #include <kdecorationfactory.h>
00028 
00029 class QLabel;
00030 class QSpacerItem;
00031 class QBoxLayout;
00032 
00033 namespace Redmond {
00034 
00035 class RedmondDeco;
00036 
00037 class RedmondButton : public QButton
00038 {
00039     Q_OBJECT
00040 public:
00041     RedmondButton(RedmondDeco *parent=0, const char *name=0,
00042                   const unsigned char *bitmap=NULL,
00043                   bool menuButton=false, bool isMini=false, int size = 16,
00044                   const QString& tip=NULL, const int realizeBtns = LeftButton);
00045     void setBitmap(const unsigned char *bitmap);
00046     void setPixmap(const QPixmap &p);
00047     void reset();
00048 
00049     QSize sizeHint() const;
00050     int   last_button;
00051 
00052 protected:
00053     void mousePressEvent(QMouseEvent* e);
00054     void mouseReleaseEvent(QMouseEvent* e);
00055     virtual void drawButton(QPainter *p);
00056     void drawButtonLabel(QPainter *){;}
00057 
00058     QBitmap  deco;
00059     QPixmap  pix;
00060     bool     menuBtn;
00061     bool     miniBtn;
00062     RedmondDeco *client;
00063     int      size;
00064 
00065     int realizeButtons;
00066 };
00067 
00068 
00069 class RedmondDeco : public KDecoration
00070 {
00071     Q_OBJECT
00072 
00073 public:
00074     RedmondDeco(KDecorationBridge *, KDecorationFactory *);
00075     ~RedmondDeco() {;}
00076     void init();
00077 
00078 protected:
00079     void resizeEvent(QResizeEvent*);
00080     void paintEvent(QPaintEvent*);
00081     void showEvent(QShowEvent*);
00082     void mouseDoubleClickEvent(QMouseEvent *);
00083     void captionChange(const QString& name);
00084     void maximizeChange(bool m);
00085     void activeChange(bool);
00086     void iconChange();
00087     void calcHiddenButtons();
00088 
00089 //  New stuff.
00090     Position mousePosition(const QPoint &) const;
00091     void borders(int &, int &, int &, int &) const;
00092     void resize(const QSize &);
00093     QSize minimumSize() const;
00094     void activeChange();
00095     void captionChange();
00096     void maximizeChange();
00097     void desktopChange();
00098     void shadeChange();
00099     bool eventFilter(QObject *, QEvent *);
00100 
00101 protected slots:
00102     void slotReset();
00103     void slotMaximize();
00104     void menuButtonPressed();
00105 
00106 private:
00107     enum Buttons{ BtnHelp=0, BtnMax, BtnMin, BtnClose, BtnMenu, BtnCount };
00108 
00109     RedmondButton* button[RedmondDeco::BtnCount];
00110     int            lastButtonWidth;
00111     int            titleHeight;
00112     QSpacerItem*   titlebar;
00113     bool           hiddenItems;
00114     QBoxLayout*    hb;
00115     bool           smallButtons;
00116 };
00117 
00118 class RedmondDecoFactory : public QObject, public KDecorationFactory
00119 {
00120    Q_OBJECT
00121 public:
00122     RedmondDecoFactory();
00123     virtual ~RedmondDecoFactory();
00124     virtual KDecoration *createDecoration(KDecorationBridge *);
00125     virtual bool reset(unsigned long);
00126     virtual QValueList< BorderSize > borderSizes() const;
00127 private:
00128     void readConfig();
00129 };
00130 
00131 }
00132 
00133 #endif
00134 // vim: ts=4
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 5 04:41:14 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003