Back to index

kdeartwork  4.3.2
OpenLook.h
Go to the documentation of this file.
00001 /*
00002   'OpenLook' kwin client
00003 
00004   Porting to kde3.2 API 
00005     Copyright 2003 Luciano Montanaro <mikelima@cirulla.net>
00006   
00007   Permission is hereby granted, free of charge, to any person obtaining a copy
00008   of this software and associated documentation files (the "Software"), to
00009   deal in the Software without restriction, including without limitation the
00010   rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00011   sell copies of the Software, and to permit persons to whom the Software is
00012   furnished to do so, subject to the following conditions:
00013  
00014   The above copyright notice and this permission notice shall be included in
00015   all copies or substantial portions of the Software.
00016 
00017   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00020   AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00021   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00022   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 */
00024 
00025 #ifndef KWIN_WEB_H
00026 #define KWIN_WEB_H
00027 
00028 #include <q3ptrlist.h>
00029 #include <q3button.h>
00030 //Added by qt3to4:
00031 #include <QMouseEvent>
00032 #include <QShowEvent>
00033 #include <Q3ValueList>
00034 #include <QResizeEvent>
00035 #include <QEvent>
00036 #include <QPaintEvent>
00037 
00038 #include <kdecoration.h>
00039 #include <kdecorationfactory.h>
00040 #include <kcommondecoration.h>
00041 class QSpacerItem;
00042 
00043 namespace OpenLook
00044 {
00045   class OpenLookButton;
00046 
00047   class OpenLook : public KDecoration
00048   {
00049     Q_OBJECT
00050     public:
00051 
00052       OpenLook(KDecorationBridge *b, KDecorationFactory *f);
00053       ~OpenLook();
00054       void init();
00055 
00056     protected:
00057       bool eventFilter(QObject *o, QEvent *e);
00058       void resizeEvent(QResizeEvent *e);
00059       void paintEvent(QPaintEvent *e);
00060       void showEvent(QShowEvent *e);
00061 
00062       virtual void captionChange();
00063       void desktopChange();
00064       void activeChange();
00065       void shadeChange();
00066       void iconChange();
00067       void maximizeChange();
00068       void borders(int &left, int &right, int &top, int &bottom) const;
00069       QSize minimumSize() const;
00070       void resize( const QSize& );
00071       virtual void mouseDoubleClickEvent(QMouseEvent *);
00072 
00073       virtual Position mousePosition(const QPoint &) const;
00074       virtual bool animateMinimize(bool);
00075 
00076     private:
00077 
00078       void doLayout();
00079 
00080       QRect titleRect() const;
00081 
00082       QRect topLeftRect() const;
00083       QRect topRightRect() const;
00084       QRect bottomLeftRect() const;
00085       QRect bottomRightRect() const;
00086 
00087       QRect buttonRect() const;
00088 
00089       void paintBorder(QPainter &) const;
00090 
00091       void paintTopLeftRect(QPainter &) const;
00092       void paintTopRightRect(QPainter &) const;
00093       void paintBottomLeftRect(QPainter &) const;
00094       void paintBottomRightRect(QPainter &) const;
00095 
00096       void paintButton(QPainter &) const;
00097       void paintArrow(QPainter &) const;
00098 
00099       bool isButtonPress(QMouseEvent *);
00100       bool isButtonRelease(QMouseEvent *);
00101 
00102       QSpacerItem   * titleSpacer_;
00103       QPoint          mousePressPoint_;
00104       bool            tool_;
00105       bool            buttonDown_;
00106   };
00107   
00108   class DecorationFactory: public QObject, public KDecorationFactory
00109   {
00110   public:
00111     DecorationFactory();
00112     virtual ~DecorationFactory();
00113     virtual KDecoration *createDecoration(KDecorationBridge *);
00114     virtual bool reset(unsigned long changed);
00115     virtual bool supports( Ability ability );
00116     virtual QList< DecorationFactory::BorderSize > borderSizes() const;
00117   };
00118 }
00119 
00120 #endif
00121 // vim:ts=2:sw=2:tw=78:set et: