diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 8b2aa1b5301ab60368a03e36df4ff5216726e87d (patch) | |
tree | 36163d4ee667c23b5cf232df2f3004cd0a76202a /kwin-styles/kde1/kde1client.h | |
download | tdeartwork-8b2aa1b5301ab60368a03e36df4ff5216726e87d.tar.gz tdeartwork-8b2aa1b5301ab60368a03e36df4ff5216726e87d.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeartwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kwin-styles/kde1/kde1client.h')
-rw-r--r-- | kwin-styles/kde1/kde1client.h | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/kwin-styles/kde1/kde1client.h b/kwin-styles/kde1/kde1client.h new file mode 100644 index 00000000..27a246dd --- /dev/null +++ b/kwin-styles/kde1/kde1client.h @@ -0,0 +1,155 @@ +/***************************************************************** +kwin - the KDE window manager + +Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> +******************************************************************/ +#ifndef STDCLIENT_H +#define STDCLIENT_H +#include <qlayout.h> +#include <qvariant.h> +#include <kdecoration.h> +#include <kdecorationfactory.h> +#include <qtoolbutton.h> +class QLabel; +class QSpacerItem; + +namespace KDE1 { + +enum ButtonType { + ButtonMenu=0, + ButtonSticky, + ButtonMinimize, + ButtonMaximize, + ButtonClose, + ButtonHelp, + ButtonTypeCount +}; + +class StdClient : public KDecoration +{ + Q_OBJECT +public: + StdClient( KDecorationBridge* b, KDecorationFactory* f ); + ~StdClient(); + void init(); + QSize minimumSize() const; + void borders( int& left, int& right, int& top, int& bottom ) const; + void reset( unsigned long mask ); + void resize( const QSize& s ); + void shadeChange() {}; + Position mousePosition( const QPoint& p ) const { return KDecoration::mousePosition( p ); } +protected: + bool eventFilter( QObject* o, QEvent* e ); + void resizeEvent( QResizeEvent* ); + void paintEvent( QPaintEvent* ); + + void mouseDoubleClickEvent( QMouseEvent * ); + void wheelEvent( QWheelEvent * ); + void captionChange(); + void iconChange(); + void maximizeChange(); + void desktopChange(); + void activeChange(); + +private: + void addButtons(QBoxLayout* hb, const QString& buttons); + +private slots: + void menuButtonPressed(); + void maxButtonClicked( ButtonState ); + +private: + QToolButton* button[ButtonTypeCount]; + QSpacerItem* titlebar; +}; + +class StdToolClient : public KDecoration +{ + Q_OBJECT +public: + StdToolClient( KDecorationBridge* b, KDecorationFactory* f ); + ~StdToolClient(); + void init(); + QSize minimumSize() const; + void borders( int& left, int& right, int& top, int& bottom ) const; + void reset( unsigned long mask ); + void resize( const QSize& s ); + void shadeChange() {}; + void activeChange() {}; + void iconChange() {}; + void maximizeChange() {}; + void desktopChange() {}; + Position mousePosition( const QPoint& p ) const { return KDecoration::mousePosition( p ); } +protected: + bool eventFilter( QObject* o, QEvent* e ); + void resizeEvent( QResizeEvent* ); + void paintEvent( QPaintEvent* ); + + void mouseDoubleClickEvent( QMouseEvent * ); + void wheelEvent( QWheelEvent * ); + void captionChange(); + +private: + QToolButton* closeBtn; + QSpacerItem* titlebar; +}; + + + +/* + Like QToolButton, but provides a clicked(ButtonState) signals that + has the last pressed mouse button as argument + */ +class ThreeButtonButton: public QToolButton +{ + Q_OBJECT +public: + ThreeButtonButton ( QWidget *parent = 0, const char* name = 0 ) + : QToolButton( parent, name ) + { + connect( this, SIGNAL( clicked() ), this, SLOT( handleClicked() ) ); + setCursor( arrowCursor ); + } + ~ThreeButtonButton () {} + +signals: + void clicked( ButtonState ); + +protected: + void mousePressEvent( QMouseEvent* e ) + { + last_button = e->button(); + QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); + QToolButton::mousePressEvent( &me ); + } + + void mouseReleaseEvent( QMouseEvent* e ) + { + QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); + QToolButton::mouseReleaseEvent( &me ); + } + +private slots: + void handleClicked() + { + emit clicked( last_button ); + } + +private: + ButtonState last_button; + +}; + +class StdFactory : public KDecorationFactory +{ +public: + StdFactory(); + ~StdFactory(); + KDecoration* createDecoration( KDecorationBridge* b ); + bool reset( unsigned long mask ); + virtual bool supports( Ability ability ); +}; + +} + +#endif |