2001-06-07 11:35:06 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* KDE2 Default KWin client
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999, 2001 Daniel Duley <mosfet@kde.org>
|
|
|
|
* Matthias Ettrich <ettrich@kde.org>
|
|
|
|
* Karol Szwed <gallium@kde.org>
|
|
|
|
*
|
|
|
|
* Draws mini titlebars for tool windows.
|
|
|
|
* Many features are now customizable.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _KDE_DEFAULT_H
|
|
|
|
#define _KDE_DEFAULT_H
|
|
|
|
|
|
|
|
#include <qbutton.h>
|
|
|
|
#include <qbitmap.h>
|
|
|
|
#include <kpixmap.h>
|
|
|
|
#include "../../client.h"
|
2001-07-01 10:10:17 +00:00
|
|
|
#include "../../kwinbutton.h"
|
|
|
|
|
2001-06-07 11:35:06 +00:00
|
|
|
|
|
|
|
class QSpacerItem;
|
|
|
|
class QHBoxLayout;
|
|
|
|
|
|
|
|
namespace KWinInternal {
|
|
|
|
|
|
|
|
class KDEDefaultHandler: public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
KDEDefaultHandler();
|
|
|
|
~KDEDefaultHandler();
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void readConfig();
|
|
|
|
void createPixmaps();
|
|
|
|
void freePixmaps();
|
2001-07-01 10:10:17 +00:00
|
|
|
void drawButtonBackground(KPixmap *pix,
|
|
|
|
const QColorGroup &g, bool sunken);
|
2001-06-07 11:35:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-07-01 10:10:17 +00:00
|
|
|
class KDEDefaultButton : public KWinInternal::KWinButton
|
2001-06-07 11:35:06 +00:00
|
|
|
{
|
|
|
|
public:
|
2001-07-01 10:10:17 +00:00
|
|
|
KDEDefaultButton(Client *parent=0, const char *name=0,
|
|
|
|
bool largeButton=true, bool isLeftButton=true,
|
|
|
|
bool isStickyButton=false, const unsigned char *bitmap=NULL,
|
|
|
|
const QString& tip=NULL);
|
|
|
|
~KDEDefaultButton();
|
|
|
|
|
|
|
|
int last_button;
|
|
|
|
void turnOn( bool isOn );
|
2001-06-07 11:35:06 +00:00
|
|
|
void setBitmap(const unsigned char *bitmap);
|
|
|
|
QSize sizeHint() const;
|
|
|
|
|
|
|
|
protected:
|
2001-07-01 10:10:17 +00:00
|
|
|
void enterEvent(QEvent *);
|
|
|
|
void leaveEvent(QEvent *);
|
2001-06-07 11:35:06 +00:00
|
|
|
void mousePressEvent( QMouseEvent* e );
|
|
|
|
void mouseReleaseEvent( QMouseEvent* e );
|
|
|
|
void drawButton(QPainter *p);
|
|
|
|
void drawButtonLabel(QPainter*) {;}
|
|
|
|
|
|
|
|
QBitmap* deco;
|
|
|
|
bool large;
|
|
|
|
bool isLeft;
|
|
|
|
bool isSticky;
|
|
|
|
bool isMouseOver;
|
2001-07-01 10:10:17 +00:00
|
|
|
Client* client;
|
2001-06-07 11:35:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class KDEDefaultClient : public KWinInternal::Client
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
KDEDefaultClient( Workspace *ws, WId w, QWidget *parent=0,
|
|
|
|
const char *name=0 );
|
|
|
|
~KDEDefaultClient() {;}
|
|
|
|
|
|
|
|
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 stickyChange(bool on);
|
|
|
|
MousePosition mousePosition(const QPoint &) const;
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void slotMaximize();
|
|
|
|
void menuButtonPressed();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void doShape();
|
|
|
|
void calcHiddenButtons();
|
|
|
|
void addClientButtons( const QString& s, bool isLeft=true );
|
|
|
|
|
|
|
|
enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose,
|
|
|
|
BtnMenu, BtnSticky, BtnCount };
|
|
|
|
KDEDefaultButton* button[ KDEDefaultClient::BtnCount ];
|
|
|
|
int lastButtonWidth;
|
|
|
|
int titleHeight;
|
|
|
|
bool largeButtons;
|
|
|
|
QHBoxLayout* hb;
|
|
|
|
QSpacerItem* titlebar;
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// vim: ts=4
|