summaryrefslogtreecommitdiffstats
path: root/twin/clients/web
diff options
context:
space:
mode:
Diffstat (limited to 'twin/clients/web')
-rw-r--r--twin/clients/web/CMakeLists.txt34
-rw-r--r--twin/clients/web/Makefile.am15
-rw-r--r--twin/clients/web/Web.cpp385
-rw-r--r--twin/clients/web/Web.h87
-rw-r--r--twin/clients/web/WebButton.cpp287
-rw-r--r--twin/clients/web/WebButton.h70
-rw-r--r--twin/clients/web/web.desktop47
7 files changed, 925 insertions, 0 deletions
diff --git a/twin/clients/web/CMakeLists.txt b/twin/clients/web/CMakeLists.txt
new file mode 100644
index 000000000..badbd0467
--- /dev/null
+++ b/twin/clients/web/CMakeLists.txt
@@ -0,0 +1,34 @@
+#################################################
+#
+# (C) 2010-2011 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES web.desktop DESTINATION ${DATA_INSTALL_DIR}/twin )
+
+
+##### twin3_web (module) ########################
+
+tde_add_kpart( twin3_web AUTOMOC
+ SOURCES Web.cpp WebButton.cpp
+ LINK tdecorations-shared tdeui-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/twin/clients/web/Makefile.am b/twin/clients/web/Makefile.am
new file mode 100644
index 000000000..4855602ca
--- /dev/null
+++ b/twin/clients/web/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir) $(all_includes)
+kde_module_LTLIBRARIES = twin3_web.la
+
+twin3_web_la_SOURCES = Web.cpp WebButton.cpp
+
+noinst_HEADERS = Web.h WebButton.h
+
+twin3_web_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+twin3_web_la_LIBADD = $(LIB_TDEUI) ../../lib/libtdecorations.la
+METASOURCES = AUTO
+
+linkdir = $(kde_datadir)/twin/
+link_DATA = web.desktop
+EXTRA_DIST = $(link_DATA)
+
diff --git a/twin/clients/web/Web.cpp b/twin/clients/web/Web.cpp
new file mode 100644
index 000000000..793b406af
--- /dev/null
+++ b/twin/clients/web/Web.cpp
@@ -0,0 +1,385 @@
+/*
+ 'Web' twin client
+
+ Copyright (C) 2005 Sandro Giessl <[email protected]>
+ Copyright (C) 2001 Rik Hemsley (rikkus) <[email protected]>
+
+ 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <tqpainter.h>
+
+#include <kconfig.h>
+
+#include "Web.h"
+#include "WebButton.h"
+
+extern "C"
+{
+ KDE_EXPORT KDecorationFactory *create_factory()
+ {
+ return new Web::WebFactory();
+ }
+}
+
+namespace Web {
+
+WebClient::WebClient(KDecorationBridge* bridge, KDecorationFactory* factory)
+ : KCommonDecoration(bridge, factory)
+{
+ // Empty.
+}
+
+WebClient::~WebClient()
+{
+ // Empty.
+}
+
+TQString WebClient::visibleName() const
+{
+ return i18n("Web");
+}
+
+TQString WebClient::defaultButtonsLeft() const
+{
+ return "S";
+}
+
+TQString WebClient::defaultButtonsRight() const
+{
+ return "HIAX";
+}
+
+bool WebClient::decorationBehaviour(DecorationBehaviour behaviour) const
+{
+ switch (behaviour) {
+ case DB_MenuClose:
+ return false;
+
+ case DB_WindowMask:
+ return true;
+
+ case DB_ButtonHide:
+ return true;
+
+ default:
+ return KCommonDecoration::decorationBehaviour(behaviour);
+ }
+}
+
+int WebClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const
+{
+// bool maximized = maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows();
+
+ switch (lm) {
+ case LM_BorderLeft:
+ case LM_BorderRight:
+ case LM_BorderBottom:
+ return borderSize_;
+
+ case LM_TitleEdgeLeft:
+ case LM_TitleEdgeRight:
+ case LM_TitleEdgeTop:
+ case LM_TitleEdgeBottom:
+ return 0;
+
+ case LM_TitleBorderLeft:
+ case LM_TitleBorderRight:
+ return 0;
+
+ case LM_TitleHeight:
+ case LM_ButtonWidth:
+ case LM_ButtonHeight:
+ return titleHeight_;
+
+ case LM_ButtonSpacing:
+ return 0;
+
+ case LM_ExplicitButtonSpacer:
+ return 0;
+
+ default:
+ return KCommonDecoration::layoutMetric(lm, respectWindowState, btn);
+ }
+}
+
+KCommonDecorationButton *WebClient::createButton(ButtonType type)
+{
+ switch (type) {
+ case MenuButton:
+ return new WebButton(MenuButton, this, "menu", tqshape_);
+
+ case OnAllDesktopsButton:
+ return new WebButton(OnAllDesktopsButton, this, "on_all_desktops", tqshape_);
+
+ case HelpButton:
+ return new WebButton(HelpButton, this, "help", tqshape_);
+
+ case MinButton:
+ return new WebButton(MinButton, this, "minimize", tqshape_);
+
+ case MaxButton:
+ return new WebButton(MaxButton, this, "maximize", tqshape_);
+
+ case CloseButton:
+ return new WebButton(CloseButton, this, "close", tqshape_);
+
+ case AboveButton:
+ return new WebButton(AboveButton, this, "above", tqshape_);
+
+ case BelowButton:
+ return new WebButton(BelowButton, this, "below", tqshape_);
+
+ case ShadeButton:
+ return new WebButton(ShadeButton, this, "shade", tqshape_);
+
+ default:
+ return 0;
+ }
+}
+
+ void
+WebClient::init()
+{
+ // title height
+ const int textVMargin = 2;
+ TQFontMetrics fm(options()->font(isActive(), isToolWindow()));
+
+ // border size
+ switch(options()->preferredBorderSize( factory())) {
+ case BorderLarge:
+ borderSize_ = 8;
+ break;
+ case BorderVeryLarge:
+ borderSize_ = 12;
+ break;
+ case BorderHuge:
+ borderSize_ = 18;
+ break;
+ case BorderVeryHuge:
+ borderSize_ = 27;
+ break;
+ case BorderOversized:
+ borderSize_ = 40;
+ break;
+ case BorderNormal:
+ default:
+ borderSize_ = 4;
+ }
+ titleHeight_ = QMAX(QMAX(14, fm.height() + textVMargin * 2), borderSize_);
+ if (0 != titleHeight_ % 2)
+ titleHeight_ += 1;
+
+ KConfig c("twinwebrc");
+ c.setGroup("General");
+ tqshape_ = c.readBoolEntry("Shape", true);
+
+ KCommonDecoration::init();
+}
+
+ void
+WebClient::reset( unsigned long changed )
+{
+ if (changed & SettingColors)
+ {
+ // tqrepaint the whole thing
+ widget()->tqrepaint(false);
+ } else if (changed & SettingFont) {
+ // font has changed -- update title height
+ // title height
+ const int textVMargin = 2;
+ TQFontMetrics fm(options()->font(isActive(), isToolWindow()));
+ titleHeight_ = QMAX(QMAX(14, fm.height() + textVMargin * 2), borderSize_);
+ if (0 != titleHeight_ % 2)
+ titleHeight_ += 1;
+
+ widget()->tqrepaint(false);
+ }
+
+ KCommonDecoration::reset(changed);
+}
+
+ void
+WebClient::paintEvent(TQPaintEvent * pe)
+{
+ int r_x, r_y, r_x2, r_y2;
+ TQT_TQRECT_OBJECT(widget()->rect()).coords(&r_x, &r_y, &r_x2, &r_y2);
+ const int titleEdgeLeft = layoutMetric(LM_TitleEdgeLeft);
+ const int titleEdgeTop = layoutMetric(LM_TitleEdgeTop);
+ const int titleEdgeRight = layoutMetric(LM_TitleEdgeRight);
+ const int titleEdgeBottom = layoutMetric(LM_TitleEdgeBottom);
+ const int ttlHeight = layoutMetric(LM_TitleHeight);
+ const int titleEdgeBottomBottom = r_y+titleEdgeTop+ttlHeight+titleEdgeBottom-1;
+ TQRect titleRect = TQRect(r_x+titleEdgeLeft+buttonsLeftWidth(), r_y+titleEdgeTop,
+ r_x2-titleEdgeRight-buttonsRightWidth()-(r_x+titleEdgeLeft+buttonsLeftWidth()),
+ titleEdgeBottomBottom-(r_y+titleEdgeTop) );
+ titleRect.setTop(1);
+
+ TQPainter p(widget());
+
+ p.setPen(Qt::black);
+ p.setBrush(options()->tqcolorGroup(ColorFrame, isActive()).background());
+
+ p.setClipRegion(pe->region() - titleRect);
+
+ p.drawRect(widget()->rect());
+
+ p.setClipRegion(pe->region());
+
+ p.fillRect(titleRect, options()->color(ColorTitleBar, isActive()));
+
+ if (tqshape_)
+ {
+ 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(), isToolWindow()));
+
+ p.setPen(options()->color(ColorFont, isActive()));
+
+ p.drawText(titleRect, AlignCenter, caption());
+}
+
+void WebClient::updateWindowShape()
+{
+ if (!tqshape_)
+ return;
+
+ TQRegion mask(0, 0, width(), height());
+
+ int r(width());
+ int b(height());
+
+ // Remove top-left corner.
+
+ mask -= TQRegion(0, 0, 5, 1);
+ mask -= TQRegion(0, 1, 3, 1);
+ mask -= TQRegion(0, 2, 2, 1);
+ mask -= TQRegion(0, 3, 1, 2);
+
+ // Remove top-right corner.
+
+ mask -= TQRegion(r - 5, 0, 5, 1);
+ mask -= TQRegion(r - 3, 1, 3, 1);
+ mask -= TQRegion(r - 2, 2, 2, 1);
+ mask -= TQRegion(r - 1, 3, 1, 2);
+
+ // Remove bottom-left corner.
+
+ mask -= TQRegion(0, b - 5, 1, 3);
+ mask -= TQRegion(0, b - 3, 2, 1);
+ mask -= TQRegion(0, b - 2, 3, 1);
+ mask -= TQRegion(0, b - 1, 5, 1);
+
+ // Remove bottom-right corner.
+
+ mask -= TQRegion(r - 5, b - 1, 5, 1);
+ mask -= TQRegion(r - 3, b - 2, 3, 1);
+ mask -= TQRegion(r - 2, b - 3, 2, 1);
+ mask -= TQRegion(r - 1, b - 5, 1, 2);
+
+ setMask(mask);
+}
+
+KDecoration* WebFactory::createDecoration( KDecorationBridge* b )
+{
+ return(new WebClient(b, this));
+}
+
+bool WebFactory::reset(unsigned long changed)
+{
+ // Do we need to "hit the wooden hammer" ?
+ bool needHardReset = true;
+ if (changed & SettingColors || changed & SettingFont)
+ {
+ needHardReset = false;
+ } else if (changed & SettingButtons) {
+ // handled by KCommonDecoration
+ needHardReset = false;
+ }
+
+ if (needHardReset) {
+ return true;
+ } else {
+ resetDecorations(changed);
+ return false;
+ }
+}
+
+bool WebFactory::supports( Ability ability )
+{
+ switch( ability )
+ {
+ case AbilityAnnounceButtons:
+ case AbilityButtonOnAllDesktops:
+ case AbilityButtonHelp:
+ case AbilityButtonMinimize:
+ case AbilityButtonMaximize:
+ case AbilityButtonClose:
+ case AbilityButtonMenu:
+ case AbilityButtonAboveOthers:
+ case AbilityButtonBelowOthers:
+ case AbilityButtonShade:
+ return true;
+ default:
+ return false;
+ };
+}
+
+TQValueList< WebFactory::BorderSize > WebFactory::borderSizes() const
+{ // the list must be sorted
+ return TQValueList< BorderSize >() << BorderNormal << BorderLarge <<
+ BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
+}
+
+}
+
+#include "Web.moc"
+// vim:ts=2:sw=2:tw=78:set et:
+// kate: indent-width 2; replace-tabs on; tab-width 2; space-indent on;
diff --git a/twin/clients/web/Web.h b/twin/clients/web/Web.h
new file mode 100644
index 000000000..c2c18b0bd
--- /dev/null
+++ b/twin/clients/web/Web.h
@@ -0,0 +1,87 @@
+/*
+ 'Web' twin client
+
+ Copyright (C) 2005 Sandro Giessl <[email protected]>
+ Copyright (C) 2001 Rik Hemsley (rikkus) <[email protected]>
+
+ 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KWIN_WEB_H
+#define KWIN_WEB_H
+
+#include "../../lib/kcommondecoration.h"
+#include "../../lib/kdecorationfactory.h"
+
+class TQLabel;
+class TQSpacerItem;
+class TQBoxLayout;
+
+namespace Web
+{
+
+ class WebButton;
+
+ class WebClient : public KCommonDecoration
+ {
+ public:
+
+ WebClient(KDecorationBridge* bridge, KDecorationFactory* factory);
+ ~WebClient();
+
+ virtual TQString visibleName() const;
+ virtual TQString defaultButtonsLeft() const;
+ virtual TQString defaultButtonsRight() const;
+ virtual bool decorationBehaviour(DecorationBehaviour behaviour) const;
+ virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const;
+ virtual KCommonDecorationButton *createButton(ButtonType type);
+
+ virtual void updateWindowShape();
+
+ virtual void init();
+
+ protected:
+ virtual void reset( unsigned long changed );
+
+ virtual void paintEvent(TQPaintEvent *);
+
+ private:
+
+ int titleHeight_, borderSize_;
+
+ bool tqshape_;
+
+ TQBitmap _buttonBitmap(ButtonType t) const;
+ };
+
+ class WebFactory : public TQObject, public KDecorationFactory
+ {
+ Q_OBJECT
+
+ public:
+
+ WebFactory() {};
+ virtual ~WebFactory() {};
+ virtual KDecoration* createDecoration( KDecorationBridge* );
+ virtual bool reset( unsigned long changed );
+ virtual bool supports( Ability ability );
+ virtual TQValueList< BorderSize > borderSizes() const;
+ };
+}
+
+#endif
+// vim:ts=2:sw=2:tw=78:set et:
+// kate: indent-width 2; replace-tabs on; tab-width 2; space-indent on;
diff --git a/twin/clients/web/WebButton.cpp b/twin/clients/web/WebButton.cpp
new file mode 100644
index 000000000..bf1f54af4
--- /dev/null
+++ b/twin/clients/web/WebButton.cpp
@@ -0,0 +1,287 @@
+/*
+ 'Web' twin client
+
+ Copyright (C) 2001 Rik Hemsley (rikkus) <[email protected]>
+
+ 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <tqpainter.h>
+
+#include "WebButton.h"
+#include "Web.h"
+
+namespace Web {
+
+ static unsigned char close_bits[] = {
+ 0x42, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0x42
+ };
+ static unsigned char iconify_bits[] = {
+ 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x3c, 0x18, 0x00
+ };
+ 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
+ };
+ 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
+ };
+ static unsigned char help_bits[] = {
+ 0x18, 0x18, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x3c
+ };
+ static unsigned char shade_on_bits[] = {
+ 0xff, 0xff, 0x81, 0x81, 0x99, 0xbd, 0x81, 0xff
+ };
+ static unsigned char shade_off_bits[] = {
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ static unsigned char above_on_bits[] = {
+ 0xff, 0x7e, 0x3c, 0x18, 0x00, 0xff, 0xff, 0x00
+ };
+ static unsigned char above_off_bits[] = {
+ 0x18, 0x3c, 0x7e, 0xff, 0x00, 0xff, 0xff, 0x00
+ };
+ static unsigned char below_on_bits[] = {
+ 0x00, 0xff, 0xff, 0x00, 0x18, 0x3c, 0x7e, 0xff
+ };
+ static unsigned char below_off_bits[] = {
+ 0x00, 0xff, 0xff, 0x00, 0xff, 0x7e, 0x3c, 0x18
+ };
+ static unsigned char menu_bits[] = {
+ 0xff, 0x81, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff
+ };
+
+WebButton::WebButton(ButtonType type, WebClient *parent, const char *name, bool tqshape)
+ : KCommonDecorationButton (type, parent, name),
+ mouseOver_ (false),
+ tqshape_ (tqshape),
+ deco_ (parent)
+{
+ setBackgroundMode(NoBackground);
+}
+
+WebButton::~WebButton()
+{
+ // Empty.
+}
+
+void WebButton::reset(unsigned long changed)
+{
+ if (changed&DecorationReset || changed&ManualReset || changed&SizeChange || changed&StateChange) {
+ switch (type() ) {
+ case CloseButton:
+ setBitmap(close_bits);
+ break;
+ case HelpButton:
+ setBitmap(help_bits);
+ break;
+ case MinButton:
+ setBitmap(iconify_bits);
+ break;
+ case MaxButton:
+ setBitmap( isOn() ? unmaximize_bits : maximize_bits );
+ break;
+ case OnAllDesktopsButton:
+ setBitmap( isOn() ? unsticky_bits : sticky_bits );
+ break;
+ case ShadeButton:
+ setBitmap( isOn() ? shade_on_bits : shade_off_bits );
+ break;
+ case AboveButton:
+ setBitmap( isOn() ? above_on_bits : above_off_bits );
+ break;
+ case BelowButton:
+ setBitmap( isOn() ? below_on_bits : below_off_bits );
+ break;
+ case MenuButton:
+ setBitmap(menu_bits);
+ break;
+ default:
+ setBitmap(0);
+ break;
+ }
+
+ this->update();
+ }
+}
+
+ void
+WebButton::enterEvent(TQEvent * e)
+{
+ mouseOver_ = true;
+ tqrepaint();
+ TQButton::enterEvent(e);
+}
+
+ void
+WebButton::leaveEvent(TQEvent * e)
+{
+ mouseOver_ = false;
+ tqrepaint();
+ TQButton::leaveEvent(e);
+}
+
+ void
+WebButton::drawButton(TQPainter *p)
+{
+ TQPen highlightPen;
+
+ if (isDown() )
+ highlightPen = TQPen(tqcolorGroup().light());
+
+ else
+ {
+ if (mouseOver_)
+ highlightPen = TQPen(tqcolorGroup().highlight());
+ else
+ highlightPen = TQPen(NoPen);
+ }
+
+ p->fillRect(rect(), tqcolorGroup().background());
+
+ Position position_;
+ if (0 == mapToParent(rect().topLeft() ).x() )
+ position_ = Left;
+ else if (deco_->width()-1 == mapToParent(rect().topRight() ).x() )
+ position_ = Right;
+ else
+ position_ = Mid;
+ switch ( position_ )
+ {
+ case Left:
+ {
+ // Draw edge.
+
+ p->setPen(Qt::black);
+
+ p->drawLine(0, 0, width(), 0);
+ p->drawLine(0, 1, 0, height() - 1);
+ if (tqshape_)
+ {
+ 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 (tqshape_)
+ p->setClipRegion(TQRegion(rect()) - TQRect(0, 0, 6, 6));
+
+ p->drawRect(2, 2, width() - 4, height() - 4);
+ if (tqshape_)
+ {
+ 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 (tqshape_)
+ {
+ 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 (tqshape_)
+ p->setClipRegion(TQRegion(rect()) - TQRect(width() - 6, 0, 6, 6));
+
+ p->drawRect(2, 2, width() - 4, height() - 4);
+ if (tqshape_)
+ {
+ 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.
+
+ TQPoint 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_);
+}
+
+ void
+WebButton::setBitmap(const unsigned char *bitmap)
+{
+ if (bitmap)
+ bitmap_ = TQBitmap(8,8, bitmap, true);
+ else
+ bitmap_ = TQBitmap(8,8);
+ bitmap_.setMask(bitmap_);
+}
+
+}
+
+// vim:ts=2:sw=2:tw=78:set et:
+// kate: indent-width 2; replace-tabs on; tab-width 2; space-indent on;
diff --git a/twin/clients/web/WebButton.h b/twin/clients/web/WebButton.h
new file mode 100644
index 000000000..108aa2a52
--- /dev/null
+++ b/twin/clients/web/WebButton.h
@@ -0,0 +1,70 @@
+/*
+ 'Web' twin client
+
+ Copyright (C) 2001 Rik Hemsley (rikkus) <[email protected]>
+
+ 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KWIN_WEB_BUTTON_H
+#define KWIN_WEB_BUTTON_H
+
+#include <tqwidget.h>
+#include <tqbitmap.h>
+#include <klocale.h>
+
+#include "../../lib/kcommondecoration.h"
+
+namespace Web
+{
+ class WebClient;
+
+ class WebButton : public KCommonDecorationButton
+ {
+ public:
+
+ enum Position
+ {
+ Left, Mid, Right
+ };
+
+ WebButton(ButtonType type, WebClient *parent, const char *name, bool tqshape);
+
+ virtual ~WebButton();
+
+ virtual void reset(unsigned long changed);
+
+ protected:
+ void setBitmap(const unsigned char *bitmap);
+
+ void enterEvent(TQEvent *);
+ void leaveEvent(TQEvent *);
+ void drawButton(TQPainter *p);
+
+ private:
+ TQBitmap bitmap_;
+
+ bool mouseOver_;
+
+ bool tqshape_;
+ WebClient* deco_;
+ };
+}
+
+#endif
+
+// vim:ts=2:sw=2:tw=78:set et:
+// kate: indent-width 2; replace-tabs on; tab-width 2; space-indent on;
diff --git a/twin/clients/web/web.desktop b/twin/clients/web/web.desktop
new file mode 100644
index 000000000..e08748011
--- /dev/null
+++ b/twin/clients/web/web.desktop
@@ -0,0 +1,47 @@
+[Desktop Entry]
+Name=Web
+Name[ar]=الشبكة
+Name[az]=Veb
+Name[be]=Сеціва
+Name[bn]=ওয়েব
+Name[br]=Gwiad
+Name[csb]=Séc
+Name[cy]=Gwe
+Name[da]=Net
+Name[el]=Ιστός
+Name[eo]=TTT
+Name[et]=Veeb
+Name[fa]=وب
+Name[ga]=Gréasán
+Name[hi]=वेब
+Name[hr]=Internet
+Name[is]=Vefur
+Name[km]=បណ្ដាញ
+Name[lo]=ແບບເວ໊ບ
+Name[lv]=Tīmekļa
+Name[mk]=Веб
+Name[mn]=Веб
+Name[nb]=Nett
+Name[ne]=वेब
+Name[nn]=Vev
+Name[pa]=ਵੈੱਬ
+Name[pl]=Sieć
+Name[rw]=Urubugamakuru
+Name[se]=Fierpmádat
+Name[sl]=Splet
+Name[sr]=Веб
+Name[sr@Latn]=Veb
+Name[sv]=Webb
+Name[ta]=வலை
+Name[te]=వెబ్
+Name[tg]=Вэб
+Name[th]=แบบเว็บ
+Name[uk]=Тенета
+Name[uz]=Veb
+Name[uz@cyrillic]=Веб
+Name[ven]=Webu
+Name[vi]=Mạng
+Name[wa]=Waibe
+Name[zh_TW]=網頁
+Name[zu]=I-Web
+X-KDE-Library=twin3_web