2000-03-24 00:22:35 +00:00
|
|
|
#ifndef __B2CLIENT_H
|
|
|
|
#define __B2CLIENT_H
|
|
|
|
|
|
|
|
#include <qtoolbutton.h>
|
|
|
|
#include <qbitmap.h>
|
|
|
|
#include <kpixmap.h>
|
|
|
|
#include "../../client.h"
|
|
|
|
class QLabel;
|
|
|
|
//class QSpacerItem;
|
|
|
|
//class QHBoxLayout;
|
|
|
|
class QGridLayout;
|
|
|
|
|
|
|
|
class B2Button : public QButton
|
|
|
|
{
|
2000-10-26 21:56:18 +00:00
|
|
|
Q_OBJECT
|
2000-03-24 00:22:35 +00:00
|
|
|
public:
|
2000-05-03 00:04:26 +00:00
|
|
|
B2Button(Client *_client=0, QWidget *parent=0, const char *name=0)
|
|
|
|
: QButton(parent, name){useMiniIcon = false; client = _client;}
|
2000-04-28 10:34:24 +00:00
|
|
|
B2Button(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix, KPixmap *iPixDown,
|
2000-05-03 00:04:26 +00:00
|
|
|
Client *_client=0, QWidget *parent=0, const char *name=0);
|
2000-04-25 22:44:25 +00:00
|
|
|
void setBg(const QColor &c){bg = c;}
|
2000-04-28 10:34:24 +00:00
|
|
|
void setPixmaps(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix,
|
|
|
|
KPixmap *iPixDown);
|
2000-03-24 00:22:35 +00:00
|
|
|
void setToggle(){setToggleType(Toggle);}
|
|
|
|
void setActive(bool on){setOn(on);}
|
|
|
|
void setUseMiniIcon(){useMiniIcon = true;}
|
|
|
|
QSize sizeHint() const;
|
|
|
|
QSizePolicy sizePolicy() const;
|
|
|
|
protected:
|
|
|
|
virtual void drawButton(QPainter *p);
|
|
|
|
void drawButtonLabel(QPainter *){;}
|
2000-10-26 21:56:18 +00:00
|
|
|
|
2000-03-24 00:22:35 +00:00
|
|
|
bool useMiniIcon;
|
2000-04-28 10:34:24 +00:00
|
|
|
KPixmap *pNorm, *pDown, *iNorm, *iDown;
|
2000-03-24 00:22:35 +00:00
|
|
|
QColor bg; //only use one color (the rest is pixmap) so forget QPalette ;)
|
2000-04-28 10:34:24 +00:00
|
|
|
Client *client;
|
2000-10-26 21:56:18 +00:00
|
|
|
|
|
|
|
void mousePressEvent( QMouseEvent* e );
|
|
|
|
void mouseReleaseEvent( QMouseEvent* e );
|
|
|
|
|
|
|
|
public:
|
|
|
|
int last_button;
|
2000-03-24 00:22:35 +00:00
|
|
|
};
|
|
|
|
|
2000-05-03 00:04:26 +00:00
|
|
|
class B2Client;
|
2000-10-26 21:56:18 +00:00
|
|
|
|
2000-05-03 00:04:26 +00:00
|
|
|
class B2Titlebar : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
B2Titlebar(B2Client *parent);
|
|
|
|
~B2Titlebar(){;}
|
|
|
|
bool isFullyObscured() const {return isfullyobscured;}
|
2000-05-07 20:30:50 +00:00
|
|
|
void recalcBuffer();
|
2000-05-03 00:04:26 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent( QPaintEvent* );
|
|
|
|
bool x11Event(XEvent *e);
|
|
|
|
void mouseDoubleClickEvent( QMouseEvent * );
|
|
|
|
void mousePressEvent( QMouseEvent * );
|
|
|
|
void mouseReleaseEvent( QMouseEvent * );
|
|
|
|
void mouseMoveEvent(QMouseEvent *);
|
|
|
|
void init();
|
2000-05-07 20:30:50 +00:00
|
|
|
void resizeEvent(QResizeEvent *ev);
|
|
|
|
|
|
|
|
QString oldTitle;
|
|
|
|
KPixmap titleBuffer;
|
2000-05-03 00:04:26 +00:00
|
|
|
bool set_x11mask;
|
|
|
|
bool isfullyobscured;
|
|
|
|
bool shift_move;
|
|
|
|
QPoint moveOffset;
|
|
|
|
B2Client *client;
|
|
|
|
};
|
|
|
|
|
2000-03-24 00:22:35 +00:00
|
|
|
class B2Client : public Client
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2000-05-03 00:04:26 +00:00
|
|
|
friend class B2Titlebar;
|
2000-03-24 00:22:35 +00:00
|
|
|
public:
|
|
|
|
B2Client( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 );
|
|
|
|
~B2Client(){;}
|
2000-05-03 00:04:26 +00:00
|
|
|
void unobscureTitlebar();
|
|
|
|
void titleMoveAbs(int new_ofs);
|
|
|
|
void titleMoveRel(int xdiff);
|
2000-03-24 00:22:35 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent( QResizeEvent* );
|
|
|
|
void paintEvent( QPaintEvent* );
|
|
|
|
void showEvent( QShowEvent* );
|
|
|
|
void windowWrapperShowEvent( QShowEvent* );
|
|
|
|
void init();
|
|
|
|
void captionChange( const QString& name );
|
|
|
|
void stickyChange(bool on);
|
|
|
|
void activeChange(bool on);
|
|
|
|
void maximizeChange(bool m);
|
2001-02-15 20:53:22 +00:00
|
|
|
void iconChange();
|
2000-03-24 00:22:35 +00:00
|
|
|
void doShape();
|
2000-03-30 23:05:30 +00:00
|
|
|
MousePosition mousePosition( const QPoint& p ) const;
|
2000-03-24 00:22:35 +00:00
|
|
|
private slots:
|
|
|
|
void menuButtonPressed();
|
|
|
|
void slotReset();
|
2000-10-26 21:56:18 +00:00
|
|
|
void maxButtonClicked();
|
2000-03-24 00:22:35 +00:00
|
|
|
private:
|
|
|
|
void positionButtons();
|
|
|
|
enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose,
|
|
|
|
BtnHelp};
|
|
|
|
//B2Button* button[5];
|
|
|
|
B2Button* button[6];
|
|
|
|
//QSpacerItem* titlebar;
|
|
|
|
//QHBoxLayout *tLayout;
|
|
|
|
QGridLayout *g;
|
2000-03-30 23:05:30 +00:00
|
|
|
int bar_x_ofs;
|
2000-05-03 00:04:26 +00:00
|
|
|
B2Titlebar *titlebar;
|
|
|
|
int in_unobs;
|
2000-10-26 21:56:18 +00:00
|
|
|
|
2000-05-03 00:04:26 +00:00
|
|
|
};
|
2000-03-24 00:22:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|