1 /*****************************************************************
2 kwin - the KDE window manager
4 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
5 ******************************************************************/
10 #include <kdecoration.h>
11 #include <kdecorationfactory.h>
12 #include <qtoolbutton.h>
28 class StdClient
: public KDecoration
32 StdClient( KDecorationBridge
* b
, KDecorationFactory
* f
);
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
); }
42 bool eventFilter( QObject
* o
, QEvent
* e
);
43 void resizeEvent( QResizeEvent
* );
44 void paintEvent( QPaintEvent
* );
46 void mouseDoubleClickEvent( QMouseEvent
* );
49 void maximizeChange();
54 void addButtons(QBoxLayout
* hb
, const QString
& buttons
);
57 void menuButtonPressed();
58 void maxButtonClicked( ButtonState
);
61 QToolButton
* button
[ButtonTypeCount
];
62 QSpacerItem
* titlebar
;
65 class StdToolClient
: public KDecoration
69 StdToolClient( KDecorationBridge
* b
, KDecorationFactory
* f
);
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() {};
79 void maximizeChange() {};
80 void desktopChange() {};
81 Position
mousePosition( const QPoint
& p
) const { return KDecoration::mousePosition( p
); }
83 bool eventFilter( QObject
* o
, QEvent
* e
);
84 void resizeEvent( QResizeEvent
* );
85 void paintEvent( QPaintEvent
* );
87 void mouseDoubleClickEvent( QMouseEvent
* );
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
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 () {}
114 void clicked( ButtonState
);
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
);
133 emit
clicked( last_button
);
137 ButtonState last_button
;
141 class StdFactory
: public KDecorationFactory
146 KDecoration
* createDecoration( KDecorationBridge
* b
);
147 bool reset( unsigned long mask
);
148 virtual bool supports( Ability ability
);