Adapt to new KWarning/kFatal/kDebug api
[kdeartwork.git] / kwin-styles / kde1 / kde1client.h
blob25daeccac298d77bd5dae6e50722eb08af99b50d
1 /*****************************************************************
2 kwin - the KDE window manager
4 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
5 ******************************************************************/
6 #ifndef STDCLIENT_H
7 #define STDCLIENT_H
8 #include <qlayout.h>
9 #include <qvariant.h>
10 #include <kdecoration.h>
11 #include <kdecorationfactory.h>
12 #include <qtoolbutton.h>
13 class QLabel;
14 class QSpacerItem;
16 namespace KDE1 {
18 enum ButtonType {
19 ButtonMenu=0,
20 ButtonSticky,
21 ButtonMinimize,
22 ButtonMaximize,
23 ButtonClose,
24 ButtonHelp,
25 ButtonTypeCount
28 class StdClient : public KDecoration
30 Q_OBJECT
31 public:
32 StdClient( KDecorationBridge* b, KDecorationFactory* f );
33 ~StdClient();
34 void init();
35 QSize minimumSize() const;
36 void borders( int& left, int& right, int& top, int& bottom ) const;
37 void reset( unsigned long mask );
38 void resize( const QSize& s );
39 void shadeChange() {};
40 Position mousePosition( const QPoint& p ) const { return KDecoration::mousePosition( p ); }
41 protected:
42 bool eventFilter( QObject* o, QEvent* e );
43 void resizeEvent( QResizeEvent* );
44 void paintEvent( QPaintEvent* );
46 void mouseDoubleClickEvent( QMouseEvent * );
47 void captionChange();
48 void iconChange();
49 void maximizeChange();
50 void desktopChange();
51 void activeChange();
53 private:
54 void addButtons(QBoxLayout* hb, const QString& buttons);
56 private slots:
57 void menuButtonPressed();
58 void maxButtonClicked( ButtonState );
60 private:
61 QToolButton* button[ButtonTypeCount];
62 QSpacerItem* titlebar;
65 class StdToolClient : public KDecoration
67 Q_OBJECT
68 public:
69 StdToolClient( KDecorationBridge* b, KDecorationFactory* f );
70 ~StdToolClient();
71 void init();
72 QSize minimumSize() const;
73 void borders( int& left, int& right, int& top, int& bottom ) const;
74 void reset( unsigned long mask );
75 void resize( const QSize& s );
76 void shadeChange() {};
77 void activeChange() {};
78 void iconChange() {};
79 void maximizeChange() {};
80 void desktopChange() {};
81 Position mousePosition( const QPoint& p ) const { return KDecoration::mousePosition( p ); }
82 protected:
83 bool eventFilter( QObject* o, QEvent* e );
84 void resizeEvent( QResizeEvent* );
85 void paintEvent( QPaintEvent* );
87 void mouseDoubleClickEvent( QMouseEvent * );
88 void captionChange();
90 private:
91 QToolButton* closeBtn;
92 QSpacerItem* titlebar;
98 Like QToolButton, but provides a clicked(ButtonState) signals that
99 has the last pressed mouse button as argument
101 class ThreeButtonButton: public QToolButton
103 Q_OBJECT
104 public:
105 ThreeButtonButton ( QWidget *parent = 0, const char* name = 0 )
106 : QToolButton( parent, name )
108 connect( this, SIGNAL( clicked() ), this, SLOT( handleClicked() ) );
109 setCursor( arrowCursor );
111 ~ThreeButtonButton () {}
113 signals:
114 void clicked( ButtonState );
116 protected:
117 void mousePressEvent( QMouseEvent* e )
119 last_button = e->button();
120 QMouseEvent me ( e->type(), e->pos(), e->globalPos(), Qt::LeftButton, e->state() );
121 QToolButton::mousePressEvent( &me );
124 void mouseReleaseEvent( QMouseEvent* e )
126 QMouseEvent me ( e->type(), e->pos(), e->globalPos(), Qt::LeftButton, e->state() );
127 QToolButton::mouseReleaseEvent( &me );
130 private slots:
131 void handleClicked()
133 emit clicked( last_button );
136 private:
137 ButtonState last_button;
141 class StdFactory : public KDecorationFactory
143 public:
144 StdFactory();
145 ~StdFactory();
146 KDecoration* createDecoration( KDecorationBridge* b );
147 bool reset( unsigned long mask );
148 virtual bool supports( Ability ability );
153 #endif