diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-07 21:50:31 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-07 21:50:31 -0600 |
commit | e35f3fe53cd8df85d4fd04e49dfffbaeac971cdf (patch) | |
tree | 95836fc22de909b3b20dbf3fc3dea230e5e58e3b /twin-styles/kde1/kde1client.h | |
parent | a5355f151396be579eba5838c7d8d93a43362cd7 (diff) | |
download | tdeartwork-e35f3fe53cd8df85d4fd04e49dfffbaeac971cdf.tar.gz tdeartwork-e35f3fe53cd8df85d4fd04e49dfffbaeac971cdf.zip |
Rename kwin to twin (Part 2 of 2)
Diffstat (limited to 'twin-styles/kde1/kde1client.h')
-rw-r--r-- | twin-styles/kde1/kde1client.h | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/twin-styles/kde1/kde1client.h b/twin-styles/kde1/kde1client.h new file mode 100644 index 00000000..adedfaaf --- /dev/null +++ b/twin-styles/kde1/kde1client.h @@ -0,0 +1,158 @@ +/***************************************************************** +twin - the KDE window manager + +Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> +******************************************************************/ +#ifndef STDCLIENT_H +#define STDCLIENT_H +#include <tqlayout.h> +#include <tqvariant.h> +#include <kdecoration.h> +#include <kdecorationfactory.h> +#include <tqtoolbutton.h> +class TQLabel; +class TQSpacerItem; + +namespace KDE1 { + +enum ButtonType { + ButtonMenu=0, + ButtonSticky, + ButtonMinimize, + ButtonMaximize, + ButtonClose, + ButtonHelp, + ButtonTypeCount +}; + +class StdClient : public KDecoration +{ + Q_OBJECT + TQ_OBJECT +public: + StdClient( KDecorationBridge* b, KDecorationFactory* f ); + ~StdClient(); + void init(); + TQSize tqminimumSize() const; + void borders( int& left, int& right, int& top, int& bottom ) const; + void reset( unsigned long mask ); + void resize( const TQSize& s ); + void shadeChange() {}; + Position mousePosition( const TQPoint& p ) const { return KDecoration::mousePosition( p ); } +protected: + bool eventFilter( TQObject* o, TQEvent* e ); + void resizeEvent( TQResizeEvent* ); + void paintEvent( TQPaintEvent* ); + + void mouseDoubleClickEvent( TQMouseEvent * ); + void wheelEvent( TQWheelEvent * ); + void captionChange(); + void iconChange(); + void maximizeChange(); + void desktopChange(); + void activeChange(); + +private: + void addButtons(TQBoxLayout* hb, const TQString& buttons); + +private slots: + void menuButtonPressed(); + void maxButtonClicked( ButtonState ); + +private: + TQToolButton* button[ButtonTypeCount]; + TQSpacerItem* titlebar; +}; + +class StdToolClient : public KDecoration +{ + Q_OBJECT + TQ_OBJECT +public: + StdToolClient( KDecorationBridge* b, KDecorationFactory* f ); + ~StdToolClient(); + void init(); + TQSize tqminimumSize() const; + void borders( int& left, int& right, int& top, int& bottom ) const; + void reset( unsigned long mask ); + void resize( const TQSize& s ); + void shadeChange() {}; + void activeChange() {}; + void iconChange() {}; + void maximizeChange() {}; + void desktopChange() {}; + Position mousePosition( const TQPoint& p ) const { return KDecoration::mousePosition( p ); } +protected: + bool eventFilter( TQObject* o, TQEvent* e ); + void resizeEvent( TQResizeEvent* ); + void paintEvent( TQPaintEvent* ); + + void mouseDoubleClickEvent( TQMouseEvent * ); + void wheelEvent( TQWheelEvent * ); + void captionChange(); + +private: + TQToolButton* closeBtn; + TQSpacerItem* titlebar; +}; + + + +/* + Like TQToolButton, but provides a clicked(ButtonState) signals that + has the last pressed mouse button as argument + */ +class ThreeButtonButton: public TQToolButton +{ + Q_OBJECT + TQ_OBJECT +public: + ThreeButtonButton ( TQWidget *parent = 0, const char* name = 0 ) + : TQToolButton( parent, name ) + { + connect( this, TQT_SIGNAL( clicked() ), this, TQT_SLOT( handleClicked() ) ); + setCursor( arrowCursor ); + } + ~ThreeButtonButton () {} + +signals: + void clicked( ButtonState ); + +protected: + void mousePressEvent( TQMouseEvent* e ) + { + last_button = e->button(); + TQMouseEvent me ( e->type(), e->pos(), e->globalPos(), Qt::LeftButton, e->state() ); + TQToolButton::mousePressEvent( &me ); + } + + void mouseReleaseEvent( TQMouseEvent* e ) + { + TQMouseEvent me ( e->type(), e->pos(), e->globalPos(), Qt::LeftButton, e->state() ); + TQToolButton::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 |