2001-07-16 06:53:11 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Redmond KWin client
|
|
|
|
*
|
2003-09-17 08:27:26 +00:00
|
|
|
* Copyright 2001-2003
|
|
|
|
* Ported to kwin_iii by Chris Lee <clee@kde.org>
|
2001-07-16 06:53:11 +00:00
|
|
|
* Karol Szwed <gallium@kde.org>
|
|
|
|
* http://gallium.n3.net/
|
|
|
|
*
|
|
|
|
* Based on the default KWin client.
|
|
|
|
*
|
2003-09-17 08:27:26 +00:00
|
|
|
* Updated to support the new API 9/2003 (CL)
|
|
|
|
* Updated to emulate More Accurately 9/2003 (CL)
|
2001-07-16 06:53:11 +00:00
|
|
|
* Updated to support toolwindows 3/2001 (KS)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __KDE_REDMOND_H
|
|
|
|
#define __KDE_REDMOND_H
|
|
|
|
|
2001-08-18 23:38:13 +00:00
|
|
|
#include <qvariant.h>
|
2001-07-16 06:53:11 +00:00
|
|
|
#include <qbutton.h>
|
|
|
|
#include <qbitmap.h>
|
|
|
|
#include <kpixmap.h>
|
2003-09-17 08:27:26 +00:00
|
|
|
#include <kdecoration.h>
|
|
|
|
#include <kdecorationfactory.h>
|
|
|
|
|
2001-07-16 06:53:11 +00:00
|
|
|
class QLabel;
|
|
|
|
class QSpacerItem;
|
2002-08-27 15:12:14 +00:00
|
|
|
class QBoxLayout;
|
2001-07-16 06:53:11 +00:00
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
namespace Redmond {
|
2001-07-16 06:53:11 +00:00
|
|
|
|
2003-09-17 08:27:26 +00:00
|
|
|
class RedmondDeco;
|
2002-08-27 18:08:20 +00:00
|
|
|
|
2003-09-17 08:27:26 +00:00
|
|
|
class RedmondButton : public QButton
|
2001-07-16 06:53:11 +00:00
|
|
|
{
|
2003-09-17 08:27:26 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2003-11-02 11:03:41 +00:00
|
|
|
RedmondButton(RedmondDeco *parent=0, const char *name=0,
|
2003-09-17 08:27:26 +00:00
|
|
|
const unsigned char *bitmap=NULL,
|
2003-09-26 12:06:58 +00:00
|
|
|
bool menuButton=false, bool isMini=false, int size = 16,
|
2003-11-02 11:03:41 +00:00
|
|
|
const QString& tip=NULL, const int realizeBtns = LeftButton);
|
2003-09-17 08:27:26 +00:00
|
|
|
void setBitmap(const unsigned char *bitmap);
|
|
|
|
void setPixmap(const QPixmap &p);
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
QSize sizeHint() const;
|
|
|
|
int last_button;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mousePressEvent(QMouseEvent* e);
|
|
|
|
void mouseReleaseEvent(QMouseEvent* e);
|
|
|
|
virtual void drawButton(QPainter *p);
|
|
|
|
void drawButtonLabel(QPainter *){;}
|
|
|
|
|
|
|
|
QBitmap deco;
|
|
|
|
QPixmap pix;
|
|
|
|
bool menuBtn;
|
|
|
|
bool miniBtn;
|
|
|
|
RedmondDeco *client;
|
2003-09-26 12:06:58 +00:00
|
|
|
int size;
|
2003-11-02 11:03:41 +00:00
|
|
|
|
|
|
|
int realizeButtons;
|
2001-07-16 06:53:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-09-17 08:27:26 +00:00
|
|
|
class RedmondDeco : public KDecoration
|
2001-07-16 06:53:11 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2003-09-17 08:27:26 +00:00
|
|
|
public:
|
|
|
|
RedmondDeco(KDecorationBridge *, KDecorationFactory *);
|
|
|
|
~RedmondDeco() {;}
|
|
|
|
void init();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent*);
|
|
|
|
void paintEvent(QPaintEvent*);
|
|
|
|
void showEvent(QShowEvent*);
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *);
|
|
|
|
void captionChange(const QString& name);
|
|
|
|
void maximizeChange(bool m);
|
|
|
|
void activeChange(bool);
|
|
|
|
void iconChange();
|
|
|
|
void calcHiddenButtons();
|
|
|
|
|
|
|
|
// New stuff.
|
|
|
|
MousePosition mousePosition(const QPoint &) const;
|
|
|
|
void borders(int &, int &, int &, int &) const;
|
|
|
|
void resize(const QSize &);
|
|
|
|
QSize minimumSize() const;
|
|
|
|
void activeChange();
|
|
|
|
void captionChange();
|
|
|
|
void maximizeChange();
|
|
|
|
void desktopChange();
|
|
|
|
void shadeChange();
|
|
|
|
bool eventFilter(QObject *, QEvent *);
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void slotReset();
|
|
|
|
void slotMaximize();
|
|
|
|
void menuButtonPressed();
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum Buttons{ BtnHelp=0, BtnMax, BtnMin, BtnClose, BtnMenu, BtnCount };
|
|
|
|
|
|
|
|
RedmondButton* button[RedmondDeco::BtnCount];
|
|
|
|
int lastButtonWidth;
|
|
|
|
int titleHeight;
|
|
|
|
QSpacerItem* titlebar;
|
|
|
|
bool hiddenItems;
|
|
|
|
QBoxLayout* hb;
|
|
|
|
bool smallButtons;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RedmondDecoFactory : public QObject, public KDecorationFactory
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
RedmondDecoFactory();
|
|
|
|
virtual ~RedmondDecoFactory();
|
|
|
|
virtual KDecoration *createDecoration(KDecorationBridge *);
|
|
|
|
virtual bool reset(unsigned long);
|
2003-09-26 12:06:58 +00:00
|
|
|
virtual QValueList< BorderSize > borderSizes() const;
|
|
|
|
private:
|
|
|
|
void readConfig();
|
2001-07-16 06:53:11 +00:00
|
|
|
};
|
|
|
|
|
2003-07-26 10:41:28 +00:00
|
|
|
}
|
2001-07-16 06:53:11 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// vim: ts=4
|