2001-06-07 11:35:06 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* 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>
|
2003-09-16 19:40:44 +00:00
|
|
|
#include <kdecoration.h>
|
|
|
|
#include <kdecorationfactory.h>
|
2001-06-07 11:35:06 +00:00
|
|
|
|
|
|
|
class QSpacerItem;
|
2002-08-27 15:12:14 +00:00
|
|
|
class QBoxLayout;
|
2003-09-16 19:40:44 +00:00
|
|
|
class QGridLayout;
|
2001-06-07 11:35:06 +00:00
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
namespace Default {
|
|
|
|
|
2003-09-16 19:40:44 +00:00
|
|
|
class KDEDefaultClient;
|
2001-06-07 11:35:06 +00:00
|
|
|
|
2003-09-16 19:40:44 +00:00
|
|
|
class KDEDefaultHandler: public KDecorationFactory
|
2001-06-07 11:35:06 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
KDEDefaultHandler();
|
|
|
|
~KDEDefaultHandler();
|
2003-09-16 19:40:44 +00:00
|
|
|
KDecoration* createDecoration( KDecorationBridge* b );
|
|
|
|
bool reset( unsigned long changed );
|
2003-09-28 14:06:52 +00:00
|
|
|
virtual QValueList< BorderSize > borderSizes() const;
|
2001-06-07 11:35:06 +00:00
|
|
|
|
|
|
|
private:
|
2003-09-17 08:37:56 +00:00
|
|
|
unsigned long readConfig( bool update );
|
2001-06-07 11:35:06 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-09-16 19:40:44 +00:00
|
|
|
class KDEDefaultButton : public QButton, public KDecorationDefines
|
2001-06-07 11:35:06 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-09-16 19:40:44 +00:00
|
|
|
KDEDefaultButton(KDEDefaultClient *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,
|
2003-11-02 11:03:41 +00:00
|
|
|
const QString& tip=NULL, const int realizeBtns = LeftButton);
|
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;
|
2003-09-16 19:40:44 +00:00
|
|
|
KDEDefaultClient* client;
|
2003-11-02 11:03:41 +00:00
|
|
|
|
|
|
|
int realizeButtons;
|
2001-06-07 11:35:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-09-16 19:40:44 +00:00
|
|
|
class KDEDefaultClient : public KDecoration
|
2001-06-07 11:35:06 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2003-09-16 19:40:44 +00:00
|
|
|
KDEDefaultClient( KDecorationBridge* b, KDecorationFactory* f );
|
2001-06-07 11:35:06 +00:00
|
|
|
~KDEDefaultClient() {;}
|
2003-09-16 19:40:44 +00:00
|
|
|
void init();
|
|
|
|
void borders( int&, int&, int&, int& ) const;
|
|
|
|
void resize( const QSize& );
|
|
|
|
QSize minimumSize() const;
|
2003-09-17 08:37:56 +00:00
|
|
|
void reset( unsigned long changed );
|
2001-06-07 11:35:06 +00:00
|
|
|
|
|
|
|
protected:
|
2003-09-16 19:40:44 +00:00
|
|
|
bool eventFilter( QObject*, QEvent* );
|
2001-06-07 11:35:06 +00:00
|
|
|
void resizeEvent( QResizeEvent* );
|
|
|
|
void paintEvent( QPaintEvent* );
|
|
|
|
void showEvent( QShowEvent* );
|
|
|
|
void mouseDoubleClickEvent( QMouseEvent * );
|
2003-09-16 19:40:44 +00:00
|
|
|
void captionChange();
|
|
|
|
void maximizeChange();
|
|
|
|
void activeChange();
|
2001-06-07 11:35:06 +00:00
|
|
|
void iconChange();
|
2003-09-16 19:40:44 +00:00
|
|
|
void desktopChange();
|
|
|
|
void shadeChange();
|
2003-12-15 15:10:17 +00:00
|
|
|
Position mousePosition(const QPoint &) const;
|
2001-06-07 11:35:06 +00:00
|
|
|
|
|
|
|
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-09-16 19:40:44 +00:00
|
|
|
bool isTool() const;
|
2001-06-07 11:35:06 +00:00
|
|
|
|
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
|