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>
|
2003-09-08 15:54:55 +00:00
|
|
|
#include <qdatetime.h>
|
2001-06-07 11:35:06 +00:00
|
|
|
#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;
|
2002-08-27 15:12:14 +00:00
|
|
|
class QBoxLayout;
|
2001-06-07 11:35:06 +00:00
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
namespace Default {
|
|
|
|
|
|
|
|
using namespace KWinInternal;
|
2001-06-07 11:35:06 +00:00
|
|
|
|
|
|
|
class KDEDefaultHandler: public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
KDEDefaultHandler();
|
|
|
|
~KDEDefaultHandler();
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void readConfig();
|
|
|
|
void createPixmaps();
|
|
|
|
void freePixmaps();
|
2003-07-15 18:18:26 +00:00
|
|
|
void drawButtonBackground(KPixmap *pix,
|
2001-07-01 10:10:17 +00:00
|
|
|
const QColorGroup &g, bool sunken);
|
2001-06-07 11:35:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
class KDEDefaultButton : public KWinButton
|
2001-06-07 11:35:06 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-07-15 18:18:26 +00:00
|
|
|
KDEDefaultButton(Client *parent=0, const char *name=0,
|
2001-07-01 10:10:17 +00:00
|
|
|
bool largeButton=true, bool isLeftButton=true,
|
|
|
|
bool isStickyButton=false, const unsigned char *bitmap=NULL,
|
|
|
|
const QString& tip=NULL);
|
2003-07-15 18:18:26 +00:00
|
|
|
~KDEDefaultButton();
|
2001-07-01 10:10:17 +00:00
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
class KDEDefaultClient : public Client
|
2001-06-07 11:35:06 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2003-07-15 18:18:26 +00:00
|
|
|
KDEDefaultClient( Workspace *ws, WId w, QWidget *parent=0,
|
2001-06-07 11:35:06 +00:00
|
|
|
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();
|
2003-07-15 18:18:26 +00:00
|
|
|
void menuButtonReleased();
|
2001-06-07 11:35:06 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void doShape();
|
|
|
|
void calcHiddenButtons();
|
|
|
|
void addClientButtons( const QString& s, bool isLeft=true );
|
|
|
|
|
2003-07-15 18:18:26 +00:00
|
|
|
enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose,
|
2001-06-07 11:35:06 +00:00
|
|
|
BtnMenu, BtnSticky, BtnCount };
|
|
|
|
KDEDefaultButton* button[ KDEDefaultClient::BtnCount ];
|
|
|
|
int lastButtonWidth;
|
|
|
|
int titleHeight;
|
|
|
|
bool largeButtons;
|
2003-09-08 15:54:55 +00:00
|
|
|
QGridLayout* g;
|
2002-08-27 15:12:14 +00:00
|
|
|
QBoxLayout* hb;
|
2001-06-07 11:35:06 +00:00
|
|
|
QSpacerItem* titlebar;
|
2003-09-08 15:54:55 +00:00
|
|
|
QSpacerItem* spacer;
|
2003-07-15 18:18:26 +00:00
|
|
|
bool m_closing;
|
2001-06-07 11:35:06 +00:00
|
|
|
};
|
|
|
|
|
2003-07-26 10:41:28 +00:00
|
|
|
}
|
2001-06-07 11:35:06 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// vim: ts=4
|