2001-01-11 12:24:04 +00:00
|
|
|
/*
|
2001-06-04 10:11:21 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Gallium-Win2k KWin client
|
|
|
|
*
|
|
|
|
* Copyright 2001
|
|
|
|
* Karol Szwed <gallium@kde.org>
|
|
|
|
* http://gallium.n3.net/
|
|
|
|
*
|
|
|
|
* Based on the default KWin client.
|
|
|
|
*
|
|
|
|
* Updated to support toolwindows 3/2001 (KS)
|
|
|
|
*
|
|
|
|
*/
|
2001-01-11 12:24:04 +00:00
|
|
|
|
|
|
|
#ifndef __KDEGALLIUM_WIN2K_H
|
|
|
|
#define __KDEGALLIUM_WIN2K_H
|
|
|
|
|
2001-03-17 11:49:51 +00:00
|
|
|
#include <qbutton.h>
|
2001-01-11 12:24:04 +00:00
|
|
|
#include <qbitmap.h>
|
|
|
|
#include <kpixmap.h>
|
|
|
|
#include "../../client.h"
|
|
|
|
class QLabel;
|
|
|
|
class QSpacerItem;
|
|
|
|
class QHBoxLayout;
|
|
|
|
|
2001-02-20 01:20:38 +00:00
|
|
|
namespace KWinInternal {
|
2001-01-11 12:24:04 +00:00
|
|
|
|
|
|
|
class GalliumButton : public QButton
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2001-06-04 10:11:21 +00:00
|
|
|
GalliumButton(Client *parent=0, const char *name=0,
|
|
|
|
const unsigned char *bitmap=NULL,
|
2001-03-17 11:49:51 +00:00
|
|
|
bool menuButton=false, bool isMini=false );
|
2001-01-11 12:24:04 +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 )
|
|
|
|
{
|
2001-06-04 10:11:21 +00:00
|
|
|
last_button = e->button();
|
2001-03-17 11:49:51 +00:00
|
|
|
QMouseEvent me ( e->type(), e->pos(), e->globalPos(),
|
|
|
|
LeftButton, e->state() );
|
2001-06-04 10:11:21 +00:00
|
|
|
QButton::mousePressEvent( &me );
|
2001-01-11 12:24:04 +00:00
|
|
|
}
|
2001-03-17 11:49:51 +00:00
|
|
|
|
2001-01-11 12:24:04 +00:00
|
|
|
void mouseReleaseEvent( QMouseEvent* e )
|
|
|
|
{
|
2001-06-04 10:11:21 +00:00
|
|
|
last_button = e->button();
|
|
|
|
QMouseEvent me ( e->type(), e->pos(), e->globalPos(),
|
2001-03-17 11:49:51 +00:00
|
|
|
LeftButton, e->state() );
|
2001-06-04 10:11:21 +00:00
|
|
|
QButton::mouseReleaseEvent( &me );
|
2001-01-11 12:24:04 +00:00
|
|
|
}
|
2001-03-17 11:49:51 +00:00
|
|
|
|
2001-01-11 12:24:04 +00:00
|
|
|
virtual void drawButton(QPainter *p);
|
|
|
|
void drawButtonLabel(QPainter *){;}
|
|
|
|
|
|
|
|
QBitmap deco;
|
|
|
|
QPixmap pix;
|
|
|
|
Client* client;
|
2001-03-17 11:49:51 +00:00
|
|
|
bool menuBtn;
|
|
|
|
bool miniBtn;
|
2001-01-11 12:24:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-02-20 01:20:38 +00:00
|
|
|
class GalliumClient : public KWinInternal::Client
|
2001-01-11 12:24:04 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2001-06-04 10:11:21 +00:00
|
|
|
GalliumClient( Workspace *ws, WId w, QWidget *parent=0,
|
|
|
|
const char *name=0 );
|
2001-01-11 12:24:04 +00:00
|
|
|
~GalliumClient() {;}
|
|
|
|
|
|
|
|
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);
|
2001-02-15 22:48:31 +00:00
|
|
|
void iconChange();
|
2001-01-11 12:24:04 +00:00
|
|
|
|
|
|
|
void calcHiddenButtons();
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void slotReset();
|
|
|
|
void slotMaximize();
|
|
|
|
void menuButtonPressed();
|
|
|
|
|
|
|
|
private:
|
2001-06-04 10:11:21 +00:00
|
|
|
enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose,
|
|
|
|
BtnMenu, BtnCount };
|
|
|
|
|
2001-01-11 12:24:04 +00:00
|
|
|
GalliumButton* button[ GalliumClient::BtnCount ];
|
|
|
|
int lastButtonWidth;
|
2001-06-04 10:11:21 +00:00
|
|
|
int titleHeight;
|
2001-01-11 12:24:04 +00:00
|
|
|
QSpacerItem* titlebar;
|
|
|
|
bool hiddenItems;
|
|
|
|
QHBoxLayout* hb;
|
2001-03-17 11:49:51 +00:00
|
|
|
bool smallButtons;
|
2001-01-11 12:24:04 +00:00
|
|
|
};
|
|
|
|
|
2001-02-20 01:20:38 +00:00
|
|
|
};
|
2001-01-11 12:24:04 +00:00
|
|
|
|
|
|
|
#endif
|