2003-08-29 22:49:03 +00:00
|
|
|
/* Plastik KWin window decoration
|
|
|
|
Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
|
|
|
|
|
|
|
|
based on the window decoration "Web":
|
|
|
|
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KNIFTYCLIENT_H
|
|
|
|
#define KNIFTYCLIENT_H
|
|
|
|
|
2003-09-17 18:43:17 +00:00
|
|
|
#include <kdecoration.h>
|
2003-08-29 22:49:03 +00:00
|
|
|
#include "plastik.h"
|
|
|
|
|
|
|
|
class QSpacerItem;
|
|
|
|
class QVBoxLayout;
|
2003-09-17 18:43:17 +00:00
|
|
|
class QBoxLayout;
|
2003-08-29 22:49:03 +00:00
|
|
|
|
2003-09-17 18:43:17 +00:00
|
|
|
namespace KWinPlastik {
|
2003-08-29 22:49:03 +00:00
|
|
|
|
|
|
|
class PlastikButton;
|
|
|
|
|
2003-09-17 18:43:17 +00:00
|
|
|
class PlastikClient : public KDecoration
|
2003-08-29 22:49:03 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2003-09-17 18:43:17 +00:00
|
|
|
PlastikClient(KDecorationBridge* bridge, KDecorationFactory* factory);
|
2003-08-29 22:49:03 +00:00
|
|
|
~PlastikClient();
|
|
|
|
|
2003-09-17 18:43:17 +00:00
|
|
|
virtual void init();
|
|
|
|
|
|
|
|
virtual void borders( int& left, int& right, int& top, int& bottom ) const;
|
|
|
|
virtual void resize(const QSize&);
|
|
|
|
virtual QSize minimumSize() const;
|
|
|
|
virtual void show();
|
|
|
|
virtual bool eventFilter( QObject* o, QEvent* e );
|
|
|
|
|
2003-08-29 22:49:03 +00:00
|
|
|
QPixmap getTitleBarTile(bool active) const
|
|
|
|
{
|
|
|
|
return active ? *aTitleBarTile : *iTitleBarTile;
|
|
|
|
}
|
|
|
|
protected:
|
2003-09-17 18:43:17 +00:00
|
|
|
virtual void resizeEvent();
|
2003-08-29 22:49:03 +00:00
|
|
|
virtual void paintEvent(QPaintEvent *e);
|
|
|
|
virtual void mouseDoubleClickEvent(QMouseEvent *e);
|
|
|
|
|
2003-09-17 18:43:17 +00:00
|
|
|
virtual void maximizeChange();
|
|
|
|
virtual void desktopChange();
|
2004-05-14 22:50:53 +00:00
|
|
|
virtual void shadeChange();
|
2003-08-29 22:49:03 +00:00
|
|
|
virtual void doShape();
|
|
|
|
|
2003-09-17 18:43:17 +00:00
|
|
|
virtual void reset( unsigned long changed );
|
|
|
|
|
|
|
|
virtual void captionChange();
|
2003-08-29 22:49:03 +00:00
|
|
|
virtual void iconChange();
|
2003-09-17 18:43:17 +00:00
|
|
|
virtual void activeChange();
|
2003-12-15 15:14:45 +00:00
|
|
|
virtual Position mousePosition(const QPoint &point) const;
|
2003-08-29 22:49:03 +00:00
|
|
|
|
|
|
|
private slots:
|
2004-07-23 16:50:02 +00:00
|
|
|
void keepAboveChange(bool above);
|
|
|
|
void keepBelowChange(bool below);
|
2003-09-17 18:43:17 +00:00
|
|
|
void slotMaximize();
|
2004-05-14 22:50:53 +00:00
|
|
|
void slotShade();
|
|
|
|
void slotKeepAbove();
|
|
|
|
void slotKeepBelow();
|
2003-08-29 22:49:03 +00:00
|
|
|
void menuButtonPressed();
|
2003-09-23 20:39:13 +00:00
|
|
|
void menuButtonReleased();
|
2003-09-17 18:43:17 +00:00
|
|
|
bool isTool();
|
2003-08-29 22:49:03 +00:00
|
|
|
private:
|
|
|
|
void _resetLayout();
|
|
|
|
void addButtons(QBoxLayout* layout, const QString& buttons, int buttonSize = 18);
|
|
|
|
|
|
|
|
QVBoxLayout *mainLayout_;
|
|
|
|
QSpacerItem *topSpacer_,
|
|
|
|
*titleSpacer_,
|
|
|
|
*leftTitleSpacer_, *rightTitleSpacer_,
|
|
|
|
*decoSpacer_,
|
|
|
|
*leftSpacer_, *rightSpacer_,
|
|
|
|
*bottomSpacer_;
|
|
|
|
|
|
|
|
QPixmap *aCaptionBuffer, *iCaptionBuffer;
|
|
|
|
void update_captionBuffer();
|
|
|
|
|
2003-09-10 17:58:07 +00:00
|
|
|
QPixmap *aTitleBarTile, *iTitleBarTile, *aTitleBarTopTile, *iTitleBarTopTile;
|
2003-08-29 22:49:03 +00:00
|
|
|
bool pixmaps_created;
|
|
|
|
void create_pixmaps();
|
|
|
|
void delete_pixmaps();
|
|
|
|
|
2003-09-17 18:43:17 +00:00
|
|
|
PlastikButton *m_button[NumButtons];
|
2003-08-29 22:49:03 +00:00
|
|
|
|
|
|
|
bool captionBufferDirty;
|
|
|
|
|
2003-09-23 20:39:13 +00:00
|
|
|
bool closing;
|
|
|
|
|
2003-08-29 22:49:03 +00:00
|
|
|
// settings...
|
|
|
|
int s_titleHeight;
|
|
|
|
QFont s_titleFont;
|
|
|
|
};
|
|
|
|
|
2003-09-17 18:43:17 +00:00
|
|
|
} // KWinPlastik
|
2003-08-29 22:49:03 +00:00
|
|
|
|
|
|
|
#endif // KNIFTCLIENT_H
|