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
25 #include <QPaintEvent>
30 #include <QResizeEvent>
31 #include <QMouseEvent>
35 #include <kdecoration.h>
36 #include <kdecorationfactory.h>
37 #include <kcommondecoration.h>
46 class NextButton
: public QAbstractButton
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
);
54 Qt::MouseButton
lastButton() { return last_button
; }
57 void mousePressEvent( QMouseEvent
* e
);
58 void mouseReleaseEvent( QMouseEvent
* e
);
59 virtual void paintEvent(QPaintEvent
*e
);
61 QPixmap aBackground
, iBackground
;
64 Qt::MouseButton last_button
;
68 class NextClient
: public KDecoration
72 NextClient(KDecorationBridge
*b
, KDecorationFactory
*f
);
75 virtual bool drawbound(const QRect
& geom
, bool clear
);
77 bool eventFilter(QObject
*o
, QEvent
*e
);
78 void resizeEvent( QResizeEvent
* );
79 void paintEvent( QPaintEvent
* );
80 void showEvent( QShowEvent
* );
82 void mouseDoubleClickEvent( QMouseEvent
* );
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();
100 void menuButtonPressed();
101 void maximizeButtonClicked();
105 void resizePressed();
107 void keepAboveChange(bool above
);
108 void keepBelowChange(bool below
);
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,
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
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;