SVN_SILENT made messages (.desktop file)
[kdeartwork.git] / kwin-styles / kstep / nextclient.h
blob522a8c32bac66034c2943fd4aad8e967727df597
1 /********************************************************************
2 This program is free software; you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation; either version 2 of the License, or
5 (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *********************************************************************/
16 #ifndef __NEXTCLIENT_H
17 #define __NEXTCLIENT_H
19 //#include <QVariant>
21 #include <QBitmap>
22 #include <QPixmap>
24 //Added by qt3to4:
25 #include <QPaintEvent>
26 #include <QEvent>
27 #include <QBoxLayout>
28 #include <QLabel>
29 #include <QShowEvent>
30 #include <QResizeEvent>
31 #include <QMouseEvent>
33 #include <qlayout.h>
34 #include <q3button.h>
35 #include <kdecoration.h>
36 #include <kdecorationfactory.h>
37 #include <kcommondecoration.h>
39 class QLabel;
40 class QSpacerItem;
42 namespace KStep {
44 class NextClient;
46 class NextButton : public QAbstractButton
48 public:
49 NextButton(NextClient *parent=0,
50 const unsigned char *bitmap=NULL, int bw=0, int bh=0,
51 const QString& tip=NULL, const int realizeBtns = Qt::LeftButton);
52 void setBitmap(const unsigned char *bitmap, int bw, int bh);
53 void reset();
54 Qt::MouseButton lastButton() { return last_button; }
56 protected:
57 void mousePressEvent( QMouseEvent* e );
58 void mouseReleaseEvent( QMouseEvent* e );
59 virtual void paintEvent(QPaintEvent *e);
61 QPixmap aBackground, iBackground;
62 QBitmap deco;
63 NextClient *client;
64 Qt::MouseButton last_button;
65 int realizeButtons;
68 class NextClient : public KDecoration
70 Q_OBJECT
71 public:
72 NextClient(KDecorationBridge *b, KDecorationFactory *f);
73 ~NextClient() {;}
74 void init();
75 virtual bool drawbound(const QRect& geom, bool clear);
76 protected:
77 bool eventFilter(QObject *o, QEvent *e);
78 void resizeEvent( QResizeEvent* );
79 void paintEvent( QPaintEvent* );
80 void showEvent( QShowEvent* );
82 void mouseDoubleClickEvent( QMouseEvent * );
83 void captionChange();
84 void desktopChange();
85 void activeChange();
86 void shadeChange();
87 void iconChange();
88 QSize minimumSize() const;
89 void resize(const QSize &size);
90 void borders(int &left, int &right, int &top, int &bottom) const;
91 void reset(unsigned long changed);
92 void calcHiddenButtons();
93 void updateActiveBuffer();
95 Position mousePosition(const QPoint &) const;
96 void maximizeChange();
98 protected slots:
99 void slotReset();
100 void menuButtonPressed();
101 void maximizeButtonClicked();
102 void shadeClicked();
103 void aboveClicked();
104 void belowClicked();
105 void resizePressed();
107 void keepAboveChange(bool above);
108 void keepBelowChange(bool below);
110 private:
111 void initializeButtonsAndTitlebar(QBoxLayout* titleLayout);
112 void addButtons(QBoxLayout* titleLayout, const QString& buttons);
113 bool mustDrawHandle() const;
115 QSpacerItem* titlebar;
117 // Helpful constants for buttons in array
118 enum { CLOSE_IDX = 0,
119 HELP_IDX,
120 ICONIFY_IDX,
121 MAXIMIZE_IDX,
122 MENU_IDX,
123 SHADE_IDX,
124 ABOVE_IDX,
125 BELOW_IDX,
126 RESIZE_IDX,
127 STICKY_IDX,
128 MAX_NUM_BUTTONS = STICKY_IDX + 1 };
130 // WARNING: button[i] may be null for any given i. Make sure you
131 // always check for null before doing button[i]->foo().
132 NextButton* button[MAX_NUM_BUTTONS];
135 class NextClientFactory: public QObject, public KDecorationFactory
137 public:
138 NextClientFactory();
139 virtual ~NextClientFactory();
140 virtual KDecoration *createDecoration(KDecorationBridge *);
141 virtual bool reset(unsigned long changed);
142 virtual bool supports(Ability ability) const;
144 virtual QList< NextClientFactory::BorderSize > borderSizes() const;
150 #endif