kwin/clients/b2/b2client.h
Daniel M. Duley 8724699214 This I have had sitting on my HD for awhile, an ultra cool KWin style to go with the B2 widget style :)
It uses Be-like shaped titlebars, KDE standard buttons, has a shaped resize
handle, and automatically detects if you are on a highcolor display and if so
uses gradients based off the current color scheme. BTW, the buttons don't
necessarily match the titlebar but use the button foreground setting in KDE's
display settings so you can change them to whatever you like.

If no one objects I'll probably disable the old Be style. Unlike this style it
uses Be-like buttons but the drawing isn't very fancy and Be's two buttons are
a big restriction in KDE.

You can see a screenshot at:
http://www.mosfet.org/b2kwin.gif

svn path=/trunk/kdebase/kwin/; revision=44420
2000-03-24 00:22:35 +00:00

69 lines
1.8 KiB
C++

#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
{
public:
B2Button(QWidget *parent=0, const char *name=0)
: QButton(parent, name){useMiniIcon = false;}
B2Button(KPixmap *pix, KPixmap *pixDown, QWidget *parent=0, const char *name=0);
void setBg(const QColor &c){bg = c;}
void setPixmaps(KPixmap *pix, KPixmap *pixDown);
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 *){;}
bool useMiniIcon;
KPixmap *pNorm, *pDown;
QColor bg; //only use one color (the rest is pixmap) so forget QPalette ;)
};
class B2Client : public Client
{
Q_OBJECT
public:
B2Client( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 );
~B2Client(){;}
protected:
void resizeEvent( QResizeEvent* );
void paintEvent( QPaintEvent* );
void showEvent( QShowEvent* );
void windowWrapperShowEvent( QShowEvent* );
void mouseDoubleClickEvent( QMouseEvent * );
void init();
void captionChange( const QString& name );
void stickyChange(bool on);
void activeChange(bool on);
void maximizeChange(bool m);
void doShape();
private slots:
void menuButtonPressed();
void slotReset();
private:
void positionButtons();
enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose,
BtnHelp};
//B2Button* button[5];
B2Button* button[6];
//QSpacerItem* titlebar;
//QHBoxLayout *tLayout;
QGridLayout *g;
};
#endif