2 * CDE KWin client - emulates the look and feel
3 * of dtwm, the CDE window manager.
5 * Copyright (c) 2000-2001, 2002
6 * Chris Lee <lee@azsites.com>
7 * Lennart Kudling <kudling@kde.org>
8 * Fredrik Höglund <fredrik@kde.org>
11 * Luciano Montanaro <mikelima@cirulla.net>
13 * Originally based on the KStep client.
15 * Distributed under the terms of the BSD license.
24 #include <QPaintEvent>
28 #include <Q3ValueList>
30 #include <QVBoxLayout>
31 #include <QResizeEvent>
32 #include <QMouseEvent>
34 #include <kdecoration.h>
35 #include <kdecorationfactory.h>
36 #include <kcommondecoration.h>
46 enum Buttons
{ BtnMenu
=0, BtnHelp
, BtnIconify
, BtnMax
, BtnClose
, BtnCount
};
48 class CdeButton
: public Q3Button
51 CdeButton( CdeClient
* parent
=0, const char* name
=0, int btnType
=0,
52 const QString
& tip
=NULL
, int realize_btns
= Qt::LeftButton
);
54 Qt::ButtonState
lastButton() { return last_button
; }
57 void mousePressEvent(QMouseEvent
*e
);
58 void mouseReleaseEvent(QMouseEvent
*e
);
59 virtual void drawButton(QPainter
*p
);
64 int m_realize_buttons
;
65 ButtonState last_button
;
68 class CdeClient
: public KDecoration
72 CdeClient(KDecorationBridge
*b
, KDecorationFactory
*f
);
77 bool eventFilter(QObject
*o
, QEvent
*e
);
78 void resizeEvent( QResizeEvent
* );
79 void paintEvent( QPaintEvent
* );
81 void showEvent(QShowEvent
*);
82 void addClientButtons( const QString
& );
83 void mouseDoubleClickEvent( QMouseEvent
* );
89 QSize
minimumSize() const;
90 void resize(const QSize
&size
);
91 void borders(int &left
, int &right
, int &top
, int &bottom
) const;
92 void mousePressEvent( QMouseEvent
* );
93 void mouseReleaseEvent( QMouseEvent
* );
94 void maximizeChange();
95 Position
mousePosition( const QPoint
& p
) const;
98 void menuButtonPressed();
99 void menuButtonReleased();
100 void maximizeButtonClicked();
103 CdeButton
* button
[BtnCount
];
104 QVBoxLayout
* mainLayout
;
105 QBoxLayout
* titleLayout
;
106 QSpacerItem
* titlebar
;
107 bool titlebarPressed
;
111 class CdeClientFactory
: public QObject
, public KDecorationFactory
115 virtual ~CdeClientFactory();
116 virtual KDecoration
*createDecoration(KDecorationBridge
*);
117 virtual bool supports( Ability ability
);
118 virtual bool reset(unsigned long changed
);
120 Q3ValueList
< CdeClientFactory::BorderSize
> borderSizes() const;