Fix use new cmake variable
[kdeartwork.git] / kwin-styles / cde / cdeclient.h
blob5eadbd81141fd6193d95d0b4ba3bc497772ea115
1 /*
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>
10 * Copyright (c) 2003
11 * Luciano Montanaro <mikelima@cirulla.net>
13 * Originally based on the KStep client.
15 * Distributed under the terms of the BSD license.
18 #ifndef __CDECLIENT_H
19 #define __CDECLIENT_H
21 #include <q3button.h>
22 #include <qbitmap.h>
23 //Added by qt3to4:
24 #include <QPaintEvent>
25 #include <QEvent>
26 #include <QBoxLayout>
27 #include <QLabel>
28 #include <Q3ValueList>
29 #include <QShowEvent>
30 #include <QVBoxLayout>
31 #include <QResizeEvent>
32 #include <QMouseEvent>
33 #include <kpixmap.h>
34 #include <kdecoration.h>
35 #include <kdecorationfactory.h>
36 #include <kcommondecoration.h>
37 class QLabel;
38 class QBoxLayout;
39 class QVBoxLayout;
40 class QSpacerItem;
42 namespace CDE {
44 class CdeClient;
46 enum Buttons { BtnMenu=0, BtnHelp, BtnIconify, BtnMax, BtnClose, BtnCount };
48 class CdeButton : public Q3Button
50 public:
51 CdeButton( CdeClient* parent=0, const char* name=0, int btnType=0,
52 const QString& tip=NULL, int realize_btns = Qt::LeftButton );
53 void reset();
54 Qt::ButtonState lastButton() { return last_button; }
56 protected:
57 void mousePressEvent(QMouseEvent *e);
58 void mouseReleaseEvent(QMouseEvent *e);
59 virtual void drawButton(QPainter *p);
61 private:
62 CdeClient *m_parent;
63 int m_btnType;
64 int m_realize_buttons;
65 ButtonState last_button;
68 class CdeClient : public KDecoration
70 Q_OBJECT
71 public:
72 CdeClient(KDecorationBridge *b, KDecorationFactory *f);
73 ~CdeClient() {};
74 void init();
76 protected:
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* );
84 void captionChange();
85 void desktopChange();
86 void activeChange();
87 void shadeChange();
88 void iconChange();
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;
97 protected slots:
98 void menuButtonPressed();
99 void menuButtonReleased();
100 void maximizeButtonClicked();
102 private:
103 CdeButton* button[BtnCount];
104 QVBoxLayout* mainLayout;
105 QBoxLayout* titleLayout;
106 QSpacerItem* titlebar;
107 bool titlebarPressed;
108 bool closing;
111 class CdeClientFactory: public QObject, public KDecorationFactory
113 public:
114 CdeClientFactory();
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;
126 #endif