Web style from my kwin style tutorial. Perhaps this should be in

one of the new 'addon' packages... What were they called...

svn path=/trunk/kdebase/kwin/; revision=95483
This commit is contained in:
Rik Hemsley 2001-05-06 19:03:20 +00:00
parent 4ca78790ee
commit 4d3a313221
18 changed files with 1596 additions and 0 deletions

30
clients/web/Makefile.am Normal file
View file

@ -0,0 +1,30 @@
INCLUDES = $(all_includes)
kde_module_LTLIBRARIES = libkwinweb.la
libkwinweb_la_SOURCES = \
Web.cpp \
WebButton.cpp \
WebButtonClose.cpp \
WebButtonHelp.cpp \
WebButtonIconify.cpp \
WebButtonLower.cpp \
WebButtonMaximize.cpp \
WebButtonSticky.cpp
noinst_HEADERS = \
Web.h \
WebButton.h \
WebButtonClose.h \
WebButtonHelp.h \
WebButtonIconify.h \
WebButtonLower.h \
WebButtonMaximize.h \
WebButtonSticky.h
libkwinweb_la_LIBADD = ../../kwin.la
libkwinweb_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
METASOURCES = AUTO
linkdir = $(kde_datadir)/kwin/
link_DATA = web.desktop
EXTRA_DIST = $(link_DATA)

522
clients/web/Web.cpp Normal file
View file

@ -0,0 +1,522 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <unistd.h> // for usleep
#include <math.h>
#include <qlayout.h>
#include <qpainter.h>
#include <netwm.h>
#undef Bool
#include <kconfig.h>
#include <kstddirs.h>
#include <kapp.h>
#include <kwin/workspace.h>
#include <kwin/options.h>
#include "Web.h"
#include "WebButton.h"
#include "WebButtonHelp.h"
#include "WebButtonIconify.h"
#include "WebButtonClose.h"
#include "WebButtonSticky.h"
#include "WebButtonMaximize.h"
#include "WebButtonLower.h"
using namespace KWinInternal;
extern "C"
{
Client * allocate(Workspace * ws, WId w, int tool)
{
return new Web(ws, w, tool != 0);
}
void init()
{
// Empty.
}
void reset()
{
// Empty.
}
void deinit()
{
// Empty.
}
}
Web::Web(Workspace * ws, WId w, bool tool, QWidget * parent, const char * name)
: Client(ws, w, parent, name, WResizeNoErase),
tool_(tool),
mainLayout_(0),
titleSpacer_(0)
{
setBackgroundMode(NoBackground);
KConfig c(locate("config", "kwinwebrc"));
c.setGroup("General");
shape_ = c.readBoolEntry("Shape", true);
_resetLayout();
leftButtonList_ .setAutoDelete(true);
rightButtonList_ .setAutoDelete(true);
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
}
Web::~Web()
{
// Empty.
}
void
Web::resizeEvent(QResizeEvent * e)
{
Client::resizeEvent(e);
doShape();
repaint();
}
void
Web::captionChange(const QString &)
{
repaint();
}
void
Web::paintEvent(QPaintEvent * pe)
{
QRect titleRect(titleSpacer_->geometry());
titleRect.setTop(1);
QPainter p(this);
p.setPen(Qt::black);
p.setBrush(colorGroup().background());
p.setClipRegion(pe->region() - titleRect);
p.drawRect(rect());
p.setClipRegion(pe->region());
p.fillRect(titleRect, options->color(Options::TitleBar, isActive()));
if (shape_)
{
int r(width());
int b(height());
// Draw edge of top-left corner inside the area removed by the mask.
p.drawPoint(3, 1);
p.drawPoint(4, 1);
p.drawPoint(2, 2);
p.drawPoint(1, 3);
p.drawPoint(1, 4);
// Draw edge of top-right corner inside the area removed by the mask.
p.drawPoint(r - 5, 1);
p.drawPoint(r - 4, 1);
p.drawPoint(r - 3, 2);
p.drawPoint(r - 2, 3);
p.drawPoint(r - 2, 4);
// Draw edge of bottom-left corner inside the area removed by the mask.
p.drawPoint(1, b - 5);
p.drawPoint(1, b - 4);
p.drawPoint(2, b - 3);
p.drawPoint(3, b - 2);
p.drawPoint(4, b - 2);
// Draw edge of bottom-right corner inside the area removed by the mask.
p.drawPoint(r - 2, b - 5);
p.drawPoint(r - 2, b - 4);
p.drawPoint(r - 3, b - 3);
p.drawPoint(r - 4, b - 2);
p.drawPoint(r - 5, b - 2);
}
p.setFont(options->font(isActive(), tool_));
p.setPen(options->color(Options::Font, isActive()));
p.drawText(titleSpacer_->geometry(), AlignCenter, caption());
}
void
Web::doShape()
{
if (!shape_)
return;
QRegion mask(0, 0, width(), height());
int r(width());
int b(height());
// Remove top-left corner.
mask -= QRegion(0, 0, 5, 1);
mask -= QRegion(0, 1, 3, 1);
mask -= QRegion(0, 2, 2, 1);
mask -= QRegion(0, 3, 1, 2);
// Remove top-right corner.
mask -= QRegion(r - 5, 0, 5, 1);
mask -= QRegion(r - 3, 1, 3, 1);
mask -= QRegion(r - 2, 2, 2, 1);
mask -= QRegion(r - 1, 3, 1, 2);
// Remove bottom-left corner.
mask -= QRegion(0, b - 5, 1, 3);
mask -= QRegion(0, b - 3, 2, 1);
mask -= QRegion(0, b - 2, 3, 1);
mask -= QRegion(0, b - 1, 5, 1);
// Remove bottom-right corner.
mask -= QRegion(r - 5, b - 1, 5, 1);
mask -= QRegion(r - 3, b - 2, 3, 1);
mask -= QRegion(r - 2, b - 3, 2, 1);
mask -= QRegion(r - 1, b - 5, 1, 2);
setMask(mask);
}
void
Web::showEvent(QShowEvent *)
{
doShape();
repaint();
}
void
Web::windowWrapperShowEvent(QShowEvent *)
{
doShape();
repaint();
}
void
Web::mouseDoubleClickEvent(QMouseEvent * e)
{
if (titleSpacer_->geometry().contains(e->pos()))
{
workspace()
->performWindowOperation(this, options->operationTitlebarDblClick());
}
}
void
Web::stickyChange(bool b)
{
emit(stkyChange(b));
}
void
Web::maximizeChange(bool b)
{
emit(maxChange(b));
}
void
Web::activeChange(bool)
{
repaint();
}
Client::MousePosition
Web::mousePosition(const QPoint & p) const
{
int x = p.x();
int y = p.y();
if (y < titleSpacer_->geometry().height())
{
return Client::Center;
}
else if (y < height() - 20)
{
if (x < 4)
return Client::Left;
else
return Client::Right;
}
else
{
if (x < 20)
return Client::BottomLeft;
else
if (x > width() - 20)
return Client::BottomRight;
else
return Client::Bottom;
}
return Client::mousePosition(p);
}
void
Web::slotReset()
{
_resetLayout();
repaint();
}
void
Web::slotMaximize(int button)
{
switch (button)
{
case MidButton:
maximize(MaximizeVertical);
break;
case RightButton:
maximize(MaximizeHorizontal);
break;
case LeftButton:
default:
maximize(MaximizeFull);
}
}
WebButton *
Web::_createButton(const QString & s, QWidget * parent)
{
WebButton * b = 0;
if (("Help" == s) && providesContextHelp())
{
b = new WebButtonHelp(parent);
connect(b, SIGNAL(help()), this, SLOT(contextHelp()));
}
else if ("Sticky" == s)
{
b = new WebButtonSticky(isSticky(), parent);
connect(b, SIGNAL(toggleSticky()), this, SLOT(toggleSticky()));
connect(this, SIGNAL(stkyChange(bool)), b, SLOT(slotStickyChange(bool)));
}
else if ("Iconify" == s && isMinimizable())
{
b = new WebButtonIconify(parent);
connect(b, SIGNAL(iconify()), this, SLOT(iconify()));
}
else if ("Maximize" == s && isMaximizable())
{
b = new WebButtonMaximize(isMaximized(), parent);
connect(b, SIGNAL(maximize(int)), this, SLOT(slotMaximize(int)));
connect(this, SIGNAL(maxChange(bool)), b, SLOT(slotMaximizeChange(bool)));
}
else if ("Close" == s)
{
b = new WebButtonClose(parent);
connect(b, SIGNAL(closeWindow()), this, SLOT(closeWindow()));
}
else if ("Lower" == s)
{
b = new WebButtonLower(parent);
connect(b, SIGNAL(lowerWindow()), this, SLOT(slotLowerWindow()));
}
if (0 != b)
{
b->setShape(shape_);
}
return b;
}
void
Web::_createButtons()
{
leftButtonList_ .clear();
rightButtonList_ .clear();
QValueList<ButtonType> buttonSetupLeft, buttonSetupRight;
KConfig c("kwinwebrc");
QStringList buttonList;
if (c.hasGroup("Buttons"))
{
c.setGroup("Buttons");
buttonList = c.readListEntry("Layout");
}
else
{
buttonList << "Iconify" << "Sticky";
if (providesContextHelp())
buttonList << "Help";
buttonList << "Title";
buttonList << "Maximize" << "Close";
}
QStringList::ConstIterator it(buttonList.begin());
for (; it != buttonList.end(); ++it)
{
QString s(*it);
if ("Title" == s)
break; // Move to right-side buttons.
WebButton * tb = _createButton(*it, this);
if (0 != tb)
leftButtonList_.append(tb);
}
for (; it != buttonList.end(); ++it)
{
WebButton * tb = _createButton(*it, this);
if (0 != tb)
rightButtonList_.append(tb);
}
if (!leftButtonList_.isEmpty())
leftButtonList_.first()->setPosition(WebButton::Left);
if (!rightButtonList_.isEmpty())
rightButtonList_.last()->setPosition(WebButton::Right);
}
void
Web::_resetLayout()
{
// ____________________________________
// | | | |
// |Xo| titleSpacer |v^| <--- topLayout
// |__|______________________________|__|
// | | | |
// | | | |
// | | windowWrapper | |
// | | | | <--- midLayout
// | | | |
// | | | |
// | |________________________________| |
// |____________________________________|
const uint sideMargin = 4;
const uint bottomMargin = 4;
const uint textVMargin = 2;
QFontMetrics fm(options->font(isActive(), tool_));
uint titleHeight = QMAX(14, fm.height() + textVMargin * 2);
if (0 != titleHeight % 2)
titleHeight += 1;
if (0 == titleSpacer_)
{
titleSpacer_ =
new QSpacerItem
(
0,
titleHeight,
QSizePolicy::Expanding,
QSizePolicy::Fixed
);
}
delete mainLayout_;
mainLayout_ = 0;
// -------------------------------------------------------------------
mainLayout_ = new QVBoxLayout(this, 0, 0);
// -------------------------------------------------------------------
QHBoxLayout * topLayout = new QHBoxLayout(mainLayout_, 0, 0);
_createButtons();
// Add left-side buttons.
for (QListIterator<WebButton> it(leftButtonList_); it.current(); ++it)
{
topLayout->addWidget(it.current(), Qt::AlignVCenter);
topLayout->setStretchFactor(it.current(), 0);
it.current()->setFixedSize(titleHeight, titleHeight);
}
topLayout->addItem(titleSpacer_);
// Add right-side buttons.
for (QListIterator<WebButton> it(rightButtonList_); it.current(); ++it)
{
topLayout->addWidget(it.current(), Qt::AlignVCenter);
it.current()->setFixedSize(titleHeight, titleHeight);
}
// -------------------------------------------------------------------
QHBoxLayout * midLayout = new QHBoxLayout(mainLayout_, 0, 0);
midLayout->addSpacing(sideMargin);
midLayout->addWidget(windowWrapper());
midLayout->addSpacing(sideMargin);
// -------------------------------------------------------------------
mainLayout_->addSpacing(bottomMargin);
// Make sure that topLayout doesn't stretch - midLayout should take
// all spare space.
mainLayout_->setStretchFactor(topLayout, 0);
mainLayout_->setStretchFactor(midLayout, 1);
}
void
Web::animateIconifyOrDeiconify(bool /* iconify */)
{
// Nice and simple ;)
}
#include "Web.moc"
// vim:ts=2:sw=2:tw=78:set et:

112
clients/web/Web.h Normal file
View file

@ -0,0 +1,112 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KWIN_WEB_H
#define KWIN_WEB_H
#include <qlist.h>
#include <kwin/client.h>
class QLabel;
class QSpacerItem;
class QBoxLayout;
namespace KWinInternal
{
class WebButton;
class Web : public KWinInternal::Client
{
Q_OBJECT
public:
Web
(
Workspace *,
WId,
bool tool,
QWidget * parent = 0,
const char * name = 0
);
~Web();
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void paintEvent(QPaintEvent *);
virtual void showEvent(QShowEvent *);
virtual void mouseDoubleClickEvent(QMouseEvent *);
virtual void windowWrapperShowEvent(QShowEvent *);
virtual void captionChange(const QString &);
virtual void stickyChange(bool on);
virtual void maximizeChange(bool);
virtual void doShape();
virtual void activeChange(bool);
virtual MousePosition mousePosition(const QPoint &) const;
virtual void animateIconifyOrDeiconify(bool);
protected slots:
void slotReset();
void slotMaximize(int button);
signals:
void stkyChange(bool);
void maxChange(bool);
private:
enum ButtonType
{
ButtonHelp,
ButtonSticky,
ButtonMenu,
ButtonSeparator,
ButtonIconify,
ButtonMaximize,
ButtonClose,
ButtonLower
};
bool shape_;
bool tool_;
WebButton * _createButton(const QString &, QWidget * parent);
void _createButtons();
void _resetLayout();
QBitmap _buttonBitmap(ButtonType t) const;
QBoxLayout * mainLayout_;
QSpacerItem * titleSpacer_;
QList<WebButton> leftButtonList_;
QList<WebButton> rightButtonList_;
};
}
#endif
// vim:ts=2:sw=2:tw=78:set et:

250
clients/web/WebButton.cpp Normal file
View file

@ -0,0 +1,250 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qpainter.h>
#include "WebButton.h"
using namespace KWinInternal;
WebButton::WebButton(QWidget * parent)
: QWidget (parent),
mouseOver_ (false),
mouseDown_ (false),
position_ (Mid),
shape_ (false)
{
setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
setBackgroundMode(NoBackground);
}
WebButton::~WebButton()
{
// Empty.
}
void
WebButton::setShape(bool b)
{
shape_ = b;
repaint();
}
void
WebButton::mousePressEvent(QMouseEvent *)
{
mouseDown_ = true;
repaint();
}
void
WebButton::mouseReleaseEvent(QMouseEvent * e)
{
mouseDown_ = false;
repaint();
if (rect().contains(e->pos()))
{
clickEvent(e->button());
}
}
void
WebButton::enterEvent(QEvent *)
{
mouseOver_ = true;
repaint();
}
void
WebButton::leaveEvent(QEvent *)
{
mouseOver_ = false;
repaint();
}
void
WebButton::paintEvent(QPaintEvent *)
{
QPen highlightPen;
if (mouseDown_)
highlightPen = QPen(colorGroup().light());
else
{
if (mouseOver_)
highlightPen = QPen(colorGroup().highlight());
else
highlightPen = QPen(NoPen);
}
QPainter p(this);
p.fillRect(rect(), colorGroup().background());
switch (position_)
{
case Left:
{
// Draw edge.
p.setPen(Qt::black);
p.drawLine(0, 0, width(), 0);
p.drawLine(0, 1, 0, height() - 1);
if (shape_)
{
p.drawPoint(3, 1);
p.drawPoint(4, 1);
p.drawPoint(2, 2);
p.drawPoint(1, 3);
p.drawPoint(1, 4);
}
// Draw highlight.
p.setBrush(NoBrush);
p.setPen(highlightPen);
if (shape_)
p.setClipRegion(QRegion(rect()) - QRect(0, 0, 6, 6));
p.drawRect(2, 2, width() - 4, height() - 4);
if (shape_)
{
p.setClipRect(rect());
p.drawPoint(4, 3);
p.drawPoint(5, 3);
p.drawPoint(3, 4);
p.drawPoint(3, 5);
}
}
break;
case Right:
{
// Draw edge.
p.setPen(Qt::black);
p.drawLine(0, 0, width(), 0);
p.drawLine(width() - 1, 1, width() - 1, height() - 1);
if (shape_)
{
p.drawPoint(width() - 5, 1);
p.drawPoint(width() - 4, 1);
p.drawPoint(width() - 3, 2);
p.drawPoint(width() - 2, 3);
p.drawPoint(width() - 2, 4);
}
// Draw highlight.
p.setBrush(NoBrush);
p.setPen(highlightPen);
if (shape_)
p.setClipRegion(QRegion(rect()) - QRect(width() - 6, 0, 6, 6));
p.drawRect(2, 2, width() - 4, height() - 4);
if (shape_)
{
p.setClipRect(rect());
p.drawPoint(width() - 5, 3);
p.drawPoint(width() - 6, 3);
p.drawPoint(width() - 4, 4);
p.drawPoint(width() - 4, 5);
}
}
break;
case Mid:
default:
{
// Draw edge.
p.setPen(Qt::black);
p.drawLine(0, 0, width(), 0);
// Draw highlight.
p.setBrush(NoBrush);
p.setPen(highlightPen);
p.drawRect(2, 2, width() - 4, height() - 4);
}
break;
}
// Draw icon.
QPoint center(rect().center());
int bwby2(bitmap_.width() / 2); // Bitmap Width BY 2
int bhby2(bitmap_.height() / 2); // Bitmap Height BY 2
p.setBrush(NoBrush);
p.setPen(Qt::black);
p.drawPixmap(center.x() - bwby2 + 1, center.y() - bhby2 + 1, bitmap_);
}
QSize
WebButton::sizeHint() const
{
return QSize(16, 16);
}
QSize
WebButton::minimumSizeHint() const
{
return QSize(14, 14);
}
void
WebButton::setBitmap(const QBitmap & b)
{
bitmap_ = b;
repaint();
}
void
WebButton::setPosition(Position p)
{
position_ = p;
repaint();
}
void
WebButton::resizeEvent(QResizeEvent *)
{
repaint();
}
#include "WebButton.moc"
// vim:ts=2:sw=2:tw=78:set et:

80
clients/web/WebButton.h Normal file
View file

@ -0,0 +1,80 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KWIN_WEB_BUTTON_H
#define KWIN_WEB_BUTTON_H
#include <qwidget.h>
#include <qbitmap.h>
namespace KWinInternal
{
class WebButton : public QWidget
{
Q_OBJECT
public:
enum Position
{
Left, Mid, Right
};
WebButton(QWidget * parent);
virtual ~WebButton();
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
void setPosition(Position);
void setShape(bool);
protected:
virtual void clickEvent(int button) = 0;
void setBitmap(const QBitmap &);
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
void enterEvent(QEvent *);
void leaveEvent(QEvent *);
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
private:
QBitmap bitmap_;
bool mouseOver_;
bool mouseDown_;
Position position_;
bool shape_;
};
}
#endif
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,46 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "WebButtonClose.h"
using namespace KWinInternal;
static unsigned char close_bits[] =
{
0x42, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0x42
};
WebButtonClose::WebButtonClose(QWidget * parent)
: WebButton(parent)
{
QBitmap b(8, 8, close_bits, true /* isXBitmap */);
b.setMask(b);
setBitmap(b);
}
void
WebButtonClose::clickEvent(int /* button */)
{
emit(closeWindow());
}
#include "WebButtonClose.moc"
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,48 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KWIN_WEB_BUTTON_CLOSE_H
#define KWIN_WEB_BUTTON_CLOSE_H
#include "WebButton.h"
namespace KWinInternal
{
class WebButtonClose : public WebButton
{
Q_OBJECT
public:
WebButtonClose(QWidget * parent);
protected:
virtual void clickEvent(int button);
signals:
void closeWindow();
};
}
#endif
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,46 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "WebButtonHelp.h"
using namespace KWinInternal;
static unsigned char help_bits[] =
{
0x18, 0x18, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x3c
};
WebButtonHelp::WebButtonHelp(QWidget * parent)
: WebButton(parent)
{
QBitmap b(8, 8, help_bits, true /* isXBitmap */);
b.setMask(b);
setBitmap(b);
}
void
WebButtonHelp::clickEvent(int /* button */)
{
emit(help());
}
#include "WebButtonHelp.moc"
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,48 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KWIN_WEB_BUTTON_HELP_H
#define KWIN_WEB_BUTTON_HELP_H
#include "WebButton.h"
namespace KWinInternal
{
class WebButtonHelp : public WebButton
{
Q_OBJECT
public:
WebButtonHelp(QWidget * parent);
protected:
virtual void clickEvent(int button);
signals:
void help();
};
}
#endif
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,46 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "WebButtonIconify.h"
using namespace KWinInternal;
static unsigned char iconify_bits[] =
{
0x00, 0x00, 0x00, 0x7e, 0x7e, 0x3c, 0x18, 0x00
};
WebButtonIconify::WebButtonIconify(QWidget * parent)
: WebButton(parent)
{
QBitmap b(8, 8, iconify_bits, true /* isXBitmap */);
b.setMask(b);
setBitmap(b);
}
void
WebButtonIconify::clickEvent(int /* button */)
{
emit(iconify());
}
#include "WebButtonIconify.moc"
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,48 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KWIN_WEB_BUTTON_ICONIFY_H
#define KWIN_WEB_BUTTON_ICONIFY_H
#include "WebButton.h"
namespace KWinInternal
{
class WebButtonIconify : public WebButton
{
Q_OBJECT
public:
WebButtonIconify(QWidget * parent);
protected:
virtual void clickEvent(int button);
signals:
void iconify();
};
}
#endif
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,46 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "WebButtonLower.h"
using namespace KWinInternal;
static unsigned char lower_bits[] =
{
0x1f, 0x1f, 0x1f, 0xff, 0x8f, 0x88, 0x88, 0xf8
};
WebButtonLower::WebButtonLower(QWidget * parent)
: WebButton(parent)
{
QBitmap b(8, 8, lower_bits, true /* isXBitmap */);
b.setMask(b);
setBitmap(b);
}
void
WebButtonLower::clickEvent(int /* button */)
{
emit(lowerWindow());
}
#include "WebButtonLower.moc"
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,48 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KWIN_WEB_BUTTON_LOWER_H
#define KWIN_WEB_BUTTON_LOWER_H
#include "WebButton.h"
namespace KWinInternal
{
class WebButtonLower : public WebButton
{
Q_OBJECT
public:
WebButtonLower(QWidget * parent);
protected:
virtual void clickEvent(int button);
signals:
void lowerWindow();
};
}
#endif
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,59 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "WebButtonMaximize.h"
using namespace KWinInternal;
static unsigned char maximize_bits[] =
{
0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00
};
static unsigned char unmaximize_bits[] =
{
0x00, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f
};
WebButtonMaximize::WebButtonMaximize(bool max, QWidget * parent)
: WebButton(parent)
{
QBitmap b(8, 8, max ? unmaximize_bits : maximize_bits, true /* isXBitmap */);
b.setMask(b);
setBitmap(b);
}
void
WebButtonMaximize::slotMaximizeChange(bool max)
{
QBitmap b(8, 8, max ? unmaximize_bits : maximize_bits, true /* isXBitmap */);
b.setMask(b);
setBitmap(b);
}
void
WebButtonMaximize::clickEvent(int button)
{
emit(maximize(button));
}
#include "WebButtonMaximize.moc"
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,53 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KWIN_WEB_BUTTON_MAXIMIZE_H
#define KWIN_WEB_BUTTON_MAXIMIZE_H
#include "WebButton.h"
namespace KWinInternal
{
class WebButtonMaximize : public WebButton
{
Q_OBJECT
public:
WebButtonMaximize(bool maximised, QWidget * parent);
protected:
virtual void clickEvent(int button);
protected slots:
void slotMaximizeChange(bool);
signals:
void maximize(int mode);
};
}
#endif
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,59 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "WebButtonSticky.h"
using namespace KWinInternal;
static unsigned char sticky_bits[] =
{
0x20, 0x70, 0xfa, 0x7e, 0x3c, 0x1c, 0x32, 0x01
};
static unsigned char unsticky_bits[] =
{
0x1c, 0x1c, 0x1c, 0x3e, 0x7f, 0x08, 0x08, 0x08
};
WebButtonSticky::WebButtonSticky(bool sticky, QWidget * parent)
: WebButton(parent)
{
QBitmap b(8, 8, sticky ? unsticky_bits : sticky_bits, true /* isXBitmap */);
b.setMask(b);
setBitmap(b);
}
void
WebButtonSticky::slotStickyChange(bool sticky)
{
QBitmap b(8, 8, sticky ? unsticky_bits : sticky_bits, true /* isXBitmap */);
b.setMask(b);
setBitmap(b);
}
void
WebButtonSticky::clickEvent(int /* button */)
{
emit(toggleSticky());
}
#include "WebButtonSticky.moc"
// vim:ts=2:sw=2:tw=78:set et:

View file

@ -0,0 +1,52 @@
/*
'Web' kwin client
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KWIN_WEB_BUTTON_STICKY_H
#define KWIN_WEB_BUTTON_STICKY_H
#include "WebButton.h"
namespace KWinInternal
{
class WebButtonSticky : public WebButton
{
Q_OBJECT
public:
WebButtonSticky(bool sticky, QWidget * parent);
protected:
virtual void clickEvent(int button);
protected slots:
void slotStickyChange(bool);
signals:
void toggleSticky();
};
}
#endif
// vim:ts=2:sw=2:tw=78:set et:

3
clients/web/web.desktop Normal file
View file

@ -0,0 +1,3 @@
[Desktop Entry]
Name=Web
X-KDE-Library=libkwinweb