2001-03-17 11:49:51 +00:00
|
|
|
/*
|
2001-06-04 09:51:23 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Gallium-Quartz KWin client
|
|
|
|
*
|
|
|
|
* Copyright 2001
|
2001-07-15 12:15:41 +00:00
|
|
|
* Karol Szwed <gallium@kde.org>
|
2001-06-04 09:51:23 +00:00
|
|
|
* http://gallium.n3.net/
|
|
|
|
*
|
2001-07-15 12:15:41 +00:00
|
|
|
* Based on the KDE default client.
|
2001-06-04 09:51:23 +00:00
|
|
|
*
|
|
|
|
* Includes mini titlebars for ToolWindow Support.
|
|
|
|
* Button positions are now customizable.
|
|
|
|
*
|
|
|
|
*/
|
2001-03-17 11:49:51 +00:00
|
|
|
|
|
|
|
#ifndef __KDEGALLIUM_QUARTZ_H
|
|
|
|
#define __KDEGALLIUM_QUARTZ_H
|
|
|
|
|
|
|
|
#include <qbutton.h>
|
|
|
|
#include <qbitmap.h>
|
|
|
|
#include <kpixmap.h>
|
|
|
|
#include "../../client.h"
|
2001-07-01 10:10:17 +00:00
|
|
|
#include "../../kwinbutton.h"
|
2001-04-22 09:31:42 +00:00
|
|
|
|
2001-03-17 11:49:51 +00:00
|
|
|
class QSpacerItem;
|
2002-08-27 15:12:14 +00:00
|
|
|
class QBoxLayout;
|
2001-03-17 11:49:51 +00:00
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
namespace Quartz {
|
2001-03-17 11:49:51 +00:00
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
using namespace KWinInternal;
|
2001-04-22 09:31:42 +00:00
|
|
|
|
|
|
|
class QuartzHandler: public QObject
|
2001-03-17 11:49:51 +00:00
|
|
|
{
|
2001-04-22 09:31:42 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QuartzHandler();
|
|
|
|
~QuartzHandler();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void slotReset();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void readConfig();
|
|
|
|
void createPixmaps();
|
|
|
|
void freePixmaps();
|
|
|
|
void drawBlocks(KPixmap* pi, KPixmap &p, const QColor &c1, const QColor &c2);
|
|
|
|
};
|
|
|
|
|
2001-03-17 11:49:51 +00:00
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
class QuartzButton : public KWinButton
|
2001-04-22 09:31:42 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
QuartzButton(Client *parent=0, const char *name=0, bool largeButton=true,
|
2001-06-04 09:51:23 +00:00
|
|
|
bool isLeftButton=true, bool isStickyButton=false,
|
2001-07-01 10:10:17 +00:00
|
|
|
const unsigned char *bitmap=NULL, const QString& tip=NULL);
|
2001-04-22 09:31:42 +00:00
|
|
|
~QuartzButton();
|
|
|
|
void setBitmap(const unsigned char *bitmap);
|
|
|
|
QSize sizeHint() const;
|
|
|
|
int last_button;
|
|
|
|
void turnOn( bool isOn );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mousePressEvent( QMouseEvent* e );
|
|
|
|
void mouseReleaseEvent( QMouseEvent* e );
|
2001-05-26 02:34:47 +00:00
|
|
|
void drawButton(QPainter *p);
|
2001-04-22 09:31:42 +00:00
|
|
|
void drawButtonLabel(QPainter*) {;}
|
|
|
|
|
|
|
|
QBitmap* deco;
|
|
|
|
bool large;
|
|
|
|
bool isLeft;
|
|
|
|
bool isSticky;
|
2001-07-01 10:10:17 +00:00
|
|
|
Client* client;
|
2001-03-17 11:49:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-08-27 18:08:20 +00:00
|
|
|
class QuartzClient : public Client
|
2001-03-17 11:49:51 +00:00
|
|
|
{
|
2001-04-22 09:31:42 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2001-06-04 09:51:23 +00:00
|
|
|
QuartzClient( Workspace *ws, WId w, QWidget *parent=0,
|
|
|
|
const char *name=0 );
|
2001-04-22 09:31:42 +00:00
|
|
|
~QuartzClient() {;}
|
|
|
|
|
|
|
|
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();
|
2001-06-04 09:51:23 +00:00
|
|
|
void stickyChange(bool on);
|
2001-04-22 09:31:42 +00:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void slotMaximize();
|
|
|
|
void menuButtonPressed();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void calcHiddenButtons();
|
|
|
|
void addClientButtons( const QString& s, bool isLeft=true );
|
|
|
|
|
2001-06-04 09:51:23 +00:00
|
|
|
enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose,
|
|
|
|
BtnMenu, BtnSticky, BtnCount };
|
2001-04-22 09:31:42 +00:00
|
|
|
QuartzButton* button[ QuartzClient::BtnCount ];
|
|
|
|
int lastButtonWidth;
|
|
|
|
int titleHeight;
|
|
|
|
bool largeButtons;
|
2002-08-27 15:12:14 +00:00
|
|
|
QBoxLayout* hb;
|
2001-04-22 09:31:42 +00:00
|
|
|
QSpacerItem* titlebar;
|
2001-03-17 11:49:51 +00:00
|
|
|
};
|
|
|
|
|
2003-07-26 10:41:28 +00:00
|
|
|
}
|
2001-03-17 11:49:51 +00:00
|
|
|
|
|
|
|
#endif
|
2001-05-26 02:34:47 +00:00
|
|
|
// vim: ts=4
|