Start to fix some error
[kdeartwork.git] / kwin-styles / kstep / nextclient.h
blobdff4e78c6410c2e290268a3d80f643c41aafcb17
1 #ifndef __NEXTCLIENT_H
2 #define __NEXTCLIENT_H
4 #include <qvariant.h>
5 #include <qbitmap.h>
6 //Added by qt3to4:
7 #include <QPaintEvent>
8 #include <QEvent>
9 #include <QBoxLayout>
10 #include <QLabel>
11 #include <QShowEvent>
12 #include <QResizeEvent>
13 #include <QMouseEvent>
14 #include <kpixmap.h>
15 #include <qlayout.h>
16 #include <q3button.h>
17 #include <kdecoration.h>
18 #include <kdecorationfactory.h>
19 #include <kcommondecoration.h>
20 class QLabel;
21 class QSpacerItem;
23 namespace KStep {
25 class NextClient;
27 class NextButton : public Q3Button
29 public:
30 NextButton(NextClient *parent=0, const char *name=0,
31 const unsigned char *bitmap=NULL, int bw=0, int bh=0,
32 const QString& tip=NULL, const int realizeBtns = Qt::LeftButton);
33 void setBitmap(const unsigned char *bitmap, int bw, int bh);
34 void reset();
35 Qt::ButtonState lastButton() { return last_button; }
37 protected:
38 void mousePressEvent( QMouseEvent* e );
39 void mouseReleaseEvent( QMouseEvent* e );
40 virtual void drawButton(QPainter *p);
41 void drawButtonLabel(QPainter *){;}
43 KPixmap aBackground, iBackground;
44 QBitmap* deco;
45 NextClient *client;
46 ButtonState last_button;
47 int realizeButtons;
50 class NextClient : public KDecoration
52 Q_OBJECT
53 public:
54 NextClient(KDecorationBridge *b, KDecorationFactory *f);
55 ~NextClient() {;}
56 void init();
57 virtual bool drawbound(const QRect& geom, bool clear);
58 protected:
59 bool eventFilter(QObject *o, QEvent *e);
60 void resizeEvent( QResizeEvent* );
61 void paintEvent( QPaintEvent* );
62 void showEvent( QShowEvent* );
64 void mouseDoubleClickEvent( QMouseEvent * );
65 void captionChange();
66 void desktopChange();
67 void activeChange();
68 void shadeChange();
69 void iconChange();
70 QSize minimumSize() const;
71 void resize(const QSize &size);
72 void borders(int &left, int &right, int &top, int &bottom) const;
73 void reset(unsigned long changed);
74 void calcHiddenButtons();
75 void updateActiveBuffer();
77 Position mousePosition(const QPoint &) const;
78 void maximizeChange();
80 protected slots:
81 void slotReset();
82 void menuButtonPressed();
83 void maximizeButtonClicked();
84 void shadeClicked();
85 void aboveClicked();
86 void belowClicked();
87 void resizePressed();
89 void keepAboveChange(bool above);
90 void keepBelowChange(bool below);
92 private:
93 void initializeButtonsAndTitlebar(QBoxLayout* titleLayout);
94 void addButtons(QBoxLayout* titleLayout, const QString& buttons);
95 bool mustDrawHandle() const;
97 QSpacerItem* titlebar;
99 // Helpful constants for buttons in array
100 enum { CLOSE_IDX = 0,
101 HELP_IDX,
102 ICONIFY_IDX,
103 MAXIMIZE_IDX,
104 MENU_IDX,
105 SHADE_IDX,
106 ABOVE_IDX,
107 BELOW_IDX,
108 RESIZE_IDX,
109 STICKY_IDX,
110 MAX_NUM_BUTTONS = STICKY_IDX + 1 };
112 // WARNING: button[i] may be null for any given i. Make sure you
113 // always check for null before doing button[i]->foo().
114 NextButton* button[MAX_NUM_BUTTONS];
117 class NextClientFactory: public QObject, public KDecorationFactory
119 public:
120 NextClientFactory();
121 virtual ~NextClientFactory();
122 virtual KDecoration *createDecoration(KDecorationBridge *);
123 virtual bool reset(unsigned long changed);
124 virtual bool supports( Ability ability );
126 virtual QList< NextClientFactory::BorderSize > borderSizes() const;
132 #endif