kwin Library API Documentation

kdedefault.h

00001 /* 00002 * $Id: kdedefault.h,v 1.12 2003/12/15 15:10:16 lunakl Exp $ 00003 * 00004 * KDE2 Default KWin client 00005 * 00006 * Copyright (C) 1999, 2001 Daniel Duley <mosfet@kde.org> 00007 * Matthias Ettrich <ettrich@kde.org> 00008 * Karol Szwed <gallium@kde.org> 00009 * 00010 * Draws mini titlebars for tool windows. 00011 * Many features are now customizable. 00012 */ 00013 00014 #ifndef _KDE_DEFAULT_H 00015 #define _KDE_DEFAULT_H 00016 00017 #include <qbutton.h> 00018 #include <qbitmap.h> 00019 #include <qdatetime.h> 00020 #include <kpixmap.h> 00021 #include <kdecoration.h> 00022 #include <kdecorationfactory.h> 00023 00024 class QSpacerItem; 00025 class QBoxLayout; 00026 class QGridLayout; 00027 00028 namespace Default { 00029 00030 class KDEDefaultClient; 00031 00032 class KDEDefaultHandler: public KDecorationFactory 00033 { 00034 public: 00035 KDEDefaultHandler(); 00036 ~KDEDefaultHandler(); 00037 KDecoration* createDecoration( KDecorationBridge* b ); 00038 bool reset( unsigned long changed ); 00039 virtual QValueList< BorderSize > borderSizes() const; 00040 00041 private: 00042 unsigned long readConfig( bool update ); 00043 void createPixmaps(); 00044 void freePixmaps(); 00045 void drawButtonBackground(KPixmap *pix, 00046 const QColorGroup &g, bool sunken); 00047 }; 00048 00049 00050 class KDEDefaultButton : public QButton, public KDecorationDefines 00051 { 00052 public: 00053 KDEDefaultButton(KDEDefaultClient *parent=0, const char *name=0, 00054 bool largeButton=true, bool isLeftButton=true, 00055 bool isStickyButton=false, const unsigned char *bitmap=NULL, 00056 const QString& tip=NULL, const int realizeBtns = LeftButton); 00057 ~KDEDefaultButton(); 00058 00059 int last_button; 00060 void turnOn( bool isOn ); 00061 void setBitmap(const unsigned char *bitmap); 00062 QSize sizeHint() const; 00063 00064 protected: 00065 void enterEvent(QEvent *); 00066 void leaveEvent(QEvent *); 00067 void mousePressEvent( QMouseEvent* e ); 00068 void mouseReleaseEvent( QMouseEvent* e ); 00069 void drawButton(QPainter *p); 00070 void drawButtonLabel(QPainter*) {;} 00071 00072 QBitmap* deco; 00073 bool large; 00074 bool isLeft; 00075 bool isSticky; 00076 bool isMouseOver; 00077 KDEDefaultClient* client; 00078 00079 int realizeButtons; 00080 }; 00081 00082 00083 class KDEDefaultClient : public KDecoration 00084 { 00085 Q_OBJECT 00086 00087 public: 00088 KDEDefaultClient( KDecorationBridge* b, KDecorationFactory* f ); 00089 ~KDEDefaultClient() {;} 00090 void init(); 00091 void borders( int&, int&, int&, int& ) const; 00092 void resize( const QSize& ); 00093 QSize minimumSize() const; 00094 void reset( unsigned long changed ); 00095 00096 protected: 00097 bool eventFilter( QObject*, QEvent* ); 00098 void resizeEvent( QResizeEvent* ); 00099 void paintEvent( QPaintEvent* ); 00100 void showEvent( QShowEvent* ); 00101 void mouseDoubleClickEvent( QMouseEvent * ); 00102 void captionChange(); 00103 void maximizeChange(); 00104 void activeChange(); 00105 void iconChange(); 00106 void desktopChange(); 00107 void shadeChange(); 00108 Position mousePosition(const QPoint &) const; 00109 00110 protected slots: 00111 void slotMaximize(); 00112 void menuButtonPressed(); 00113 void menuButtonReleased(); 00114 00115 private: 00116 void doShape(); 00117 void calcHiddenButtons(); 00118 void addClientButtons( const QString& s, bool isLeft=true ); 00119 bool isTool() const; 00120 00121 enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose, 00122 BtnMenu, BtnSticky, BtnCount }; 00123 KDEDefaultButton* button[ KDEDefaultClient::BtnCount ]; 00124 int lastButtonWidth; 00125 int titleHeight; 00126 bool largeButtons; 00127 QGridLayout* g; 00128 QBoxLayout* hb; 00129 QSpacerItem* titlebar; 00130 QSpacerItem* spacer; 00131 bool m_closing; 00132 }; 00133 00134 } 00135 00136 #endif 00137 // vim: ts=4
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 16 15:59:32 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003