summaryrefslogtreecommitdiffstats
path: root/twin-styles/riscos
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-07 21:50:31 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-07 21:50:31 -0600
commite35f3fe53cd8df85d4fd04e49dfffbaeac971cdf (patch)
tree95836fc22de909b3b20dbf3fc3dea230e5e58e3b /twin-styles/riscos
parenta5355f151396be579eba5838c7d8d93a43362cd7 (diff)
downloadtdeartwork-e35f3fe53cd8df85d4fd04e49dfffbaeac971cdf.tar.gz
tdeartwork-e35f3fe53cd8df85d4fd04e49dfffbaeac971cdf.zip
Rename kwin to twin (Part 2 of 2)
Diffstat (limited to 'twin-styles/riscos')
-rw-r--r--twin-styles/riscos/AboveButton.cpp65
-rw-r--r--twin-styles/riscos/AboveButton.h51
-rw-r--r--twin-styles/riscos/Button.cpp153
-rw-r--r--twin-styles/riscos/Button.h82
-rw-r--r--twin-styles/riscos/CMakeLists.txt52
-rw-r--r--twin-styles/riscos/CloseButton.cpp66
-rw-r--r--twin-styles/riscos/CloseButton.h53
-rw-r--r--twin-styles/riscos/HelpButton.cpp66
-rw-r--r--twin-styles/riscos/HelpButton.h53
-rw-r--r--twin-styles/riscos/IconifyButton.cpp66
-rw-r--r--twin-styles/riscos/IconifyButton.h53
-rw-r--r--twin-styles/riscos/LowerButton.cpp66
-rw-r--r--twin-styles/riscos/LowerButton.h53
-rw-r--r--twin-styles/riscos/Makefile.am39
-rw-r--r--twin-styles/riscos/Manager.cpp767
-rw-r--r--twin-styles/riscos/Manager.h125
-rw-r--r--twin-styles/riscos/MaximiseButton.cpp98
-rw-r--r--twin-styles/riscos/MaximiseButton.h61
-rw-r--r--twin-styles/riscos/Palette.h69
-rw-r--r--twin-styles/riscos/README90
-rw-r--r--twin-styles/riscos/Static.cpp540
-rw-r--r--twin-styles/riscos/Static.h134
-rw-r--r--twin-styles/riscos/StickyButton.cpp99
-rw-r--r--twin-styles/riscos/StickyButton.h61
-rw-r--r--twin-styles/riscos/riscos.desktop11
25 files changed, 2973 insertions, 0 deletions
diff --git a/twin-styles/riscos/AboveButton.cpp b/twin-styles/riscos/AboveButton.cpp
new file mode 100644
index 00000000..7b66e3ba
--- /dev/null
+++ b/twin-styles/riscos/AboveButton.cpp
@@ -0,0 +1,65 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2004
+ Carsten Clever <clushkou@gmx.net>
+
+ 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 "AboveButton.h"
+
+namespace RiscOS
+{
+
+/* XPM */
+static const char * const above_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+" ",
+" ..... ",
+".+++++. ",
+".+++++. ",
+".+++++..... ",
+".+++++.++++.",
+".+++++.++++.",
+" .....+++++.",
+" .+++++.",
+" .+++++.",
+" ..... ",
+" "};
+
+AboveButton::AboveButton(TQWidget *parent)
+ : Button(parent, i18n("Keep above others"))
+{
+ setPixmap(TQPixmap((const char **)above_xpm));
+}
+
+void AboveButton::mouseReleaseEvent(TQMouseEvent *e)
+{
+ Button::mouseReleaseEvent(e);
+
+ if (!rect().contains(e->pos()))
+ return;
+
+ emit(above());
+}
+
+} // End namespace
+
+#include "AboveButton.moc"
diff --git a/twin-styles/riscos/AboveButton.h b/twin-styles/riscos/AboveButton.h
new file mode 100644
index 00000000..86fbb0a7
--- /dev/null
+++ b/twin-styles/riscos/AboveButton.h
@@ -0,0 +1,51 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2004
+ Carsten Clever <clushkou@gmx.net>
+
+ 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 RISC_OS_ABOVE_BUTTON_H
+#define RISC_OS_ABOVE_BUTTON_H
+
+#include "Button.h"
+
+namespace RiscOS
+{
+
+class AboveButton : public Button
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ AboveButton(TQWidget *parent);
+
+ signals:
+
+ void above();
+
+ protected:
+
+ void mouseReleaseEvent(TQMouseEvent*);
+};
+
+} // End namespace
+
+#endif
diff --git a/twin-styles/riscos/Button.cpp b/twin-styles/riscos/Button.cpp
new file mode 100644
index 00000000..7bf4f477
--- /dev/null
+++ b/twin-styles/riscos/Button.cpp
@@ -0,0 +1,153 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <tqtooltip.h>
+#include "Button.h"
+#include "Static.h"
+
+namespace RiscOS
+{
+
+Button::Button(TQWidget *parent, const TQString& tip,
+ const ButtonState realizeButtons)
+ : TQWidget(parent, "Button", 0),
+ realizeButtons_(realizeButtons),
+ lastButton_(Qt::NoButton),
+ alignment_(Left),
+ down_ (false),
+ active_ (false)
+{
+ TQToolTip::add(this, tip);
+ setBackgroundColor(TQt::black);
+
+ setFixedSize(Static::instance()->titleHeight() - 1,
+ Static::instance()->titleHeight());
+}
+
+Button::~Button()
+{
+ // Empty.
+}
+
+void Button::tqsetAlignment(Alignment a)
+{
+ alignment_ = a;
+ tqrepaint();
+}
+
+void Button::setActive(bool b)
+{
+ active_ = b;
+ tqrepaint();
+}
+
+Button::Alignment Button::tqalignment() const
+{
+ return alignment_;
+}
+
+void Button::mousePressEvent(TQMouseEvent *e)
+{
+ down_ = true;
+ lastButton_ = e->button();
+ tqrepaint();
+
+ TQMouseEvent me(e->type(), e->pos(), e->globalPos(),
+ (e->button()&realizeButtons_) ? Qt::LeftButton : Qt::NoButton,
+ e->state());
+ TQWidget::mousePressEvent(&me);
+}
+
+void Button::mouseReleaseEvent(TQMouseEvent *e)
+{
+ down_ = false;
+ lastButton_ = e->button();
+ tqrepaint();
+ TQMouseEvent me(e->type(), e->pos(), e->globalPos(),
+ (e->button()&realizeButtons_) ? Qt::LeftButton : Qt::NoButton,
+ e->state());
+ TQWidget::mouseReleaseEvent(&me);
+}
+
+void Button::setPixmap(const TQPixmap &p)
+{
+ if (TQPixmap::defaultDepth() <= 8)
+ aPixmap_ = iPixmap_ = p;
+ else
+ {
+ TQRgb light;
+ TQRgb* data = NULL;
+ TQRgb w = tqRgb(255, 255, 255);
+
+ TQImage aTx(p.convertToImage());
+ TQImage iTx(aTx.copy());
+
+ const KDecorationOptions* options = KDecoration::options();
+ light = options->color(KDecoration::ColorButtonBg, true).light(150).rgb();
+
+ if (light == tqRgb(0, 0, 0))
+ light = tqRgb(228, 228, 228);
+
+ data = (TQRgb *)aTx.bits();
+
+ for (int x = 0; x < 144; x++)
+ if (data[x] == w)
+ data[x] = light;
+
+ light = options->color(KDecoration::ColorButtonBg, false).light(150).rgb();
+
+ if (light == tqRgb(0, 0, 0))
+ light = tqRgb(228, 228, 228);
+
+ data = (TQRgb *)iTx.bits();
+
+ for (int x = 0; x < 144; x++)
+ if (data[x] == w)
+ data[x] = light;
+
+ aPixmap_.convertFromImage(aTx);
+ iPixmap_.convertFromImage(iTx);
+
+ if (0 != p.mask())
+ {
+ aPixmap_.setMask(*p.mask());
+ iPixmap_.setMask(*p.mask());
+ }
+ }
+ tqrepaint();
+}
+
+void Button::paintEvent(TQPaintEvent *)
+{
+ bitBlt(this, alignment_ == Left ? 1 : 0, 0,
+ &Static::instance()->buttonBase(active_, down_));
+
+ int i = width() / 2 - 6;
+
+ bitBlt(this, alignment_ == Left ? i + 1 : i,
+ i + 1, active_ ? &aPixmap_ : &iPixmap_);
+}
+
+} // End namespace
+
+// vim:ts=2:sw=2:tw=78
+#include "Button.moc"
diff --git a/twin-styles/riscos/Button.h b/twin-styles/riscos/Button.h
new file mode 100644
index 00000000..0c7c66c5
--- /dev/null
+++ b/twin-styles/riscos/Button.h
@@ -0,0 +1,82 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_BUTTON_H
+#define RISC_OS_BUTTON_H
+
+#include <tqpixmap.h>
+#include <tqwidget.h>
+#include <klocale.h>
+#include <kdecoration.h>
+
+namespace RiscOS
+{
+
+class Button : public TQWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ enum Type { Lower, Close, Iconify, Maximise, Sticky, Help };
+
+ enum Alignment { Left, Right };
+
+ Button(TQWidget *parent, const TQString &tip,
+ const ButtonState realizeButton = Qt::LeftButton);
+ virtual ~Button();
+
+ void tqsetAlignment(Alignment);
+
+ Alignment tqalignment() const;
+
+ protected slots:
+
+ void setActive(bool);
+
+ protected:
+
+ void paintEvent(TQPaintEvent *);
+
+ void mousePressEvent(TQMouseEvent *);
+ void mouseReleaseEvent(TQMouseEvent *);
+ void mouseMoveEvent(TQMouseEvent *) { /* Empty. */ }
+
+ void setPixmap(const TQPixmap &);
+
+ ButtonState realizeButtons_;
+ ButtonState lastButton_;
+
+ private:
+
+ Alignment alignment_;
+ bool down_;
+ bool active_;
+ TQPixmap aPixmap_, iPixmap_;
+};
+
+} // End namespace
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/CMakeLists.txt b/twin-styles/riscos/CMakeLists.txt
new file mode 100644
index 00000000..5b0e6d54
--- /dev/null
+++ b/twin-styles/riscos/CMakeLists.txt
@@ -0,0 +1,52 @@
+#################################################
+#
+# (C) 2011 Golubev Alexander
+# fatzer2 (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions(
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+##### other data ################################
+
+install( FILES riscos.desktop DESTINATION ${DATA_INSTALL_DIR}/twin )
+
+##### twin3_riscos ###############################
+
+
+set( target twin3_riscos )
+
+set( ${target}_SRCS
+ AboveButton.cpp Button.cpp
+ CloseButton.cpp
+ HelpButton.cpp
+ IconifyButton.cpp
+ LowerButton.cpp
+ Manager.cpp
+ MaximiseButton.cpp
+ Static.cpp
+ StickyButton.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdecorations-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/twin-styles/riscos/CloseButton.cpp b/twin-styles/riscos/CloseButton.cpp
new file mode 100644
index 00000000..1a4c06b5
--- /dev/null
+++ b/twin-styles/riscos/CloseButton.cpp
@@ -0,0 +1,66 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "CloseButton.h"
+
+namespace RiscOS
+{
+
+/* XPM */
+static const char * const close_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+" . . ",
+" .+. .+. ",
+".+++. .+++.",
+" .+++..+++. ",
+" .++++++. ",
+" .++++. ",
+" .++++. ",
+" .++++++. ",
+" .+++..+++. ",
+".+++. .+++.",
+" .+. .+. ",
+" . . "};
+
+CloseButton::CloseButton(TQWidget *parent)
+ : Button(parent, i18n("Close"))
+{
+ setPixmap(TQPixmap((const char **)close_xpm));
+}
+
+void CloseButton::mouseReleaseEvent(TQMouseEvent *e)
+{
+ Button::mouseReleaseEvent(e);
+
+ if (!rect().contains(e->pos()))
+ return;
+
+ emit(closeWindow());
+}
+
+} // End namespace;
+
+// vim:ts=2:sw=2:tw=78
+#include "CloseButton.moc"
diff --git a/twin-styles/riscos/CloseButton.h b/twin-styles/riscos/CloseButton.h
new file mode 100644
index 00000000..615ea2ed
--- /dev/null
+++ b/twin-styles/riscos/CloseButton.h
@@ -0,0 +1,53 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_CLOSE_BUTTON_H
+#define RISC_OS_CLOSE_BUTTON_H
+
+#include "Button.h"
+
+namespace RiscOS
+{
+
+class CloseButton : public Button
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ CloseButton(TQWidget *parent);
+
+ signals:
+
+ void closeWindow();
+
+ protected:
+
+ void mouseReleaseEvent(TQMouseEvent *);
+};
+
+} // End namespace;
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/HelpButton.cpp b/twin-styles/riscos/HelpButton.cpp
new file mode 100644
index 00000000..936738eb
--- /dev/null
+++ b/twin-styles/riscos/HelpButton.cpp
@@ -0,0 +1,66 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "HelpButton.h"
+
+namespace RiscOS
+{
+
+/* XPM */
+static const char * const help_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+" . ++++ . ",
+" .+....+. ",
+" +......+ ",
+"..+......+..",
+" +......+ ",
+" +......+ ",
+" .+....+. ",
+" . ++ + . ",
+" + ++ ",
+" ++ + ",
+" + ++ ",
+" ++ "};
+
+HelpButton::HelpButton(TQWidget *parent)
+ : Button(parent, i18n("Help"))
+{
+ setPixmap(TQPixmap((const char **)help_xpm));
+}
+
+void HelpButton::mouseReleaseEvent(TQMouseEvent *e)
+{
+ Button::mouseReleaseEvent(e);
+
+ if (!rect().contains(e->pos()))
+ return;
+
+ emit(help());
+}
+
+} // End namespace;
+
+// vim:ts=2:sw=2:tw=78
+#include "HelpButton.moc"
diff --git a/twin-styles/riscos/HelpButton.h b/twin-styles/riscos/HelpButton.h
new file mode 100644
index 00000000..d57b91ce
--- /dev/null
+++ b/twin-styles/riscos/HelpButton.h
@@ -0,0 +1,53 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_HELP_BUTTON_H
+#define RISC_OS_HELP_BUTTON_H
+
+#include "Button.h"
+
+namespace RiscOS
+{
+
+class HelpButton : public Button
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ HelpButton(TQWidget *parent);
+
+ signals:
+
+ void help();
+
+ protected:
+
+ void mouseReleaseEvent(TQMouseEvent *);
+};
+
+} // End namespace;
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/IconifyButton.cpp b/twin-styles/riscos/IconifyButton.cpp
new file mode 100644
index 00000000..b5eef9e5
--- /dev/null
+++ b/twin-styles/riscos/IconifyButton.cpp
@@ -0,0 +1,66 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "IconifyButton.h"
+
+namespace RiscOS
+{
+
+/* XPM */
+static const char * const iconify_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+" ",
+" ",
+" ",
+" ",
+" .......... ",
+".++++++++++.",
+".++++++++++.",
+" .......... ",
+" ",
+" ",
+" ",
+" "};
+
+IconifyButton::IconifyButton(TQWidget *parent)
+ : Button(parent, i18n("Minimize"))
+{
+ setPixmap(TQPixmap((const char **)iconify_xpm));
+}
+
+void IconifyButton::mouseReleaseEvent(TQMouseEvent *e)
+{
+ Button::mouseReleaseEvent(e);
+
+ if (!rect().contains(e->pos()))
+ return;
+
+ emit(iconify());
+}
+
+} // End namespace;
+
+// vim:ts=2:sw=2:tw=78
+#include "IconifyButton.moc"
diff --git a/twin-styles/riscos/IconifyButton.h b/twin-styles/riscos/IconifyButton.h
new file mode 100644
index 00000000..54e44aba
--- /dev/null
+++ b/twin-styles/riscos/IconifyButton.h
@@ -0,0 +1,53 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_ICONIFY_BUTTON_H
+#define RISC_OS_ICONIFY_BUTTON_H
+
+#include "Button.h"
+
+namespace RiscOS
+{
+
+class IconifyButton : public Button
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ IconifyButton(TQWidget *parent);
+
+ signals:
+
+ void iconify();
+
+ protected:
+
+ void mouseReleaseEvent(TQMouseEvent *);
+};
+
+} // End namespace;
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/LowerButton.cpp b/twin-styles/riscos/LowerButton.cpp
new file mode 100644
index 00000000..7f03e41f
--- /dev/null
+++ b/twin-styles/riscos/LowerButton.cpp
@@ -0,0 +1,66 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "LowerButton.h"
+
+namespace RiscOS
+{
+
+/* XPM */
+static const char * const lower_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+" ",
+" ..... ",
+".+++++. ",
+".+++++. ",
+".+++++..... ",
+".++++.+++++.",
+".++++.+++++.",
+" .....+++++.",
+" .+++++.",
+" .+++++.",
+" ..... ",
+" "};
+
+LowerButton::LowerButton(TQWidget *parent)
+ : Button(parent, i18n("Keep below others"))
+{
+ setPixmap(TQPixmap((const char **)lower_xpm));
+}
+
+void LowerButton::mouseReleaseEvent(TQMouseEvent *e)
+{
+ Button::mouseReleaseEvent(e);
+
+ if (!rect().contains(e->pos()))
+ return;
+
+ emit(lower());
+}
+
+} // End namespace;
+
+// vim:ts=2:sw=2:tw=78
+#include "LowerButton.moc"
diff --git a/twin-styles/riscos/LowerButton.h b/twin-styles/riscos/LowerButton.h
new file mode 100644
index 00000000..8616d688
--- /dev/null
+++ b/twin-styles/riscos/LowerButton.h
@@ -0,0 +1,53 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_LOWER_BUTTON_H
+#define RISC_OS_LOWER_BUTTON_H
+
+#include "Button.h"
+
+namespace RiscOS
+{
+
+class LowerButton : public Button
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ LowerButton(TQWidget *parent);
+
+ signals:
+
+ void lower();
+
+ protected:
+
+ void mouseReleaseEvent(TQMouseEvent *);
+};
+
+} // End namespace;
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/Makefile.am b/twin-styles/riscos/Makefile.am
new file mode 100644
index 00000000..773c341b
--- /dev/null
+++ b/twin-styles/riscos/Makefile.am
@@ -0,0 +1,39 @@
+AUTOMAKE_OPTIONS = foreign
+
+KDE_CXXFLAGS = -DQT_PLUGIN
+
+INCLUDES = $(all_includes)
+
+twindir = $(kde_datadir)/twin/
+twin_DATA = riscos.desktop
+
+noinst_HEADERS = AboveButton.h \
+ Button.h \
+ CloseButton.h \
+ HelpButton.h \
+ IconifyButton.h \
+ LowerButton.h \
+ Manager.h \
+ MaximiseButton.h \
+ Palette.h \
+ Static.h \
+ StickyButton.h
+
+kde_module_LTLIBRARIES = twin3_riscos.la
+twin3_riscos_la_SOURCES = AboveButton.cpp \
+ Button.cpp \
+ CloseButton.cpp \
+ HelpButton.cpp \
+ IconifyButton.cpp \
+ LowerButton.cpp \
+ Manager.cpp \
+ MaximiseButton.cpp \
+ Static.cpp \
+ StickyButton.cpp
+
+twin3_riscos_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx
+twin3_riscos_la_LIBADD = $(LIB_TDEUI) -ltdecorations
+twin3_riscos_la_METASOURCES = AUTO
+
+EXTRA_DIST = $(twin_DATA)
+
diff --git a/twin-styles/riscos/Manager.cpp b/twin-styles/riscos/Manager.cpp
new file mode 100644
index 00000000..837bec9c
--- /dev/null
+++ b/twin-styles/riscos/Manager.cpp
@@ -0,0 +1,767 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <unistd.h> // for usleep
+#include <config.h> // for usleep on non-linux platforms
+#include <math.h> // for sin and cos
+
+#include <tqapplication.h>
+#include <tqimage.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
+
+#include <netwm.h>
+
+#include "Manager.h"
+#include "Static.h"
+#include "AboveButton.h"
+#include "CloseButton.h"
+#include "HelpButton.h"
+#include "IconifyButton.h"
+#include "LowerButton.h"
+#include "MaximiseButton.h"
+#include "StickyButton.h"
+
+extern "C"
+{
+ KDE_EXPORT KDecorationFactory* create_factory()
+ {
+ return new RiscOS::Factory();
+ }
+}
+
+
+namespace RiscOS
+{
+
+Manager::Manager(KDecorationBridge *bridge,
+ KDecorationFactory *factory)
+ : KDecoration(bridge, factory),
+ topLayout_ (NULL),
+ titleLayout_ (NULL),
+ titleSpacer_ (NULL)
+{
+}
+
+Manager::~Manager()
+{
+}
+
+void Manager::init()
+{
+ createMainWidget(WNoAutoErase);
+
+ widget()->installEventFilter(this);
+ widget()->setBackgroundMode(NoBackground);
+
+ leftButtonList_.setAutoDelete(true);
+ rightButtonList_.setAutoDelete(true);
+
+ resetLayout();
+}
+
+bool Manager::eventFilter(TQObject *o, TQEvent *e)
+{
+ if (TQT_BASE_OBJECT(o) != TQT_BASE_OBJECT(widget())) return false;
+ switch (e->type())
+ {
+ case TQEvent::Resize:
+ resizeEvent(TQT_TQRESIZEEVENT(e));
+ return true;
+ case TQEvent::Paint:
+ paintEvent(TQT_TQPAINTEVENT(e));
+ return true;
+ case TQEvent::MouseButtonDblClick:
+ mouseDoubleClickEvent(TQT_TQMOUSEEVENT(e));
+ return true;
+ case TQEvent::MouseButtonPress:
+ processMousePressEvent(TQT_TQMOUSEEVENT(e));
+ return true;
+ case TQEvent::Wheel:
+ wheelEvent( TQT_TQWHEELEVENT( e ));
+ return true;
+ case TQEvent::MouseButtonRelease:
+ return false;
+ case TQEvent::Show:
+ return false;
+ case TQEvent::MouseMove:
+ return false;
+ case TQEvent::Enter:
+ return false;
+ case TQEvent::Leave:
+ return false;
+ case TQEvent::Move:
+ return false;
+ default:
+ return false;
+ }
+}
+
+void Manager::reset(unsigned long /*changed*/)
+{
+ resetLayout();
+}
+
+void Manager::borders(int &left, int &right, int &top, int &bottom) const
+{
+ left = right = 1;
+ top = Static::instance()->titleHeight();
+ bottom = isResizable() ? Static::instance()->resizeHeight() : 1;
+}
+
+void Manager::resize(const TQSize &s)
+{
+ widget()->resize(s);
+}
+
+TQSize Manager::tqminimumSize() const
+{
+ return widget()->tqminimumSize();
+}
+
+void Manager::activeChange()
+{
+ updateTitleBuffer();
+ widget()->tqrepaint();
+ emit(activeChanged(isActive()));
+}
+
+void Manager::captionChange()
+{
+ updateTitleBuffer();
+ widget()->tqrepaint();
+}
+
+void Manager::iconChange()
+{
+}
+
+void Manager::maximizeChange()
+{
+ emit(maximizeChanged(maximizeMode() == MaximizeFull));
+}
+
+void Manager::desktopChange()
+{
+}
+
+void Manager::shadeChange()
+{
+}
+
+void Manager::paintEvent(TQPaintEvent *e)
+{
+ TQPainter p(widget());
+
+ TQRect r(e->rect());
+
+ bool intersectsLeft = r.intersects(TQRect(0, 0, 1, height()));
+
+ bool intersectsRight =
+ r.intersects(TQRect(width() - 1, 0, width(), height()));
+
+ if (intersectsLeft || intersectsRight)
+ {
+ p.setPen(TQt::black);
+
+ if (intersectsLeft)
+ p.drawLine(0, r.top(), 0, r.bottom());
+
+ if (intersectsRight)
+ p.drawLine(width() - 1, r.top(), width() - 1, r.bottom());
+ }
+
+ Static * s = Static::instance();
+
+ bool active = isActive();
+
+ // Title bar.
+
+ TQRect tr = titleSpacer_->tqgeometry();
+ bitBlt(widget(), tr.topLeft(), &titleBuf_);
+
+ // Resize bar.
+
+ if (isResizable())
+ {
+ int rbt = height() - Static::instance()->resizeHeight(); // Resize bar top
+
+ bitBlt(widget(), 0, rbt, &(s->resize(active)));
+ bitBlt(widget(), 30, rbt, &(s->resizeMidLeft(active)));
+
+ p.drawTiledPixmap(32, rbt, width() - 34,
+ Static::instance()->resizeHeight(),
+ s->resizeMidMid(active));
+
+ bitBlt(widget(), width() - 32, rbt, &(s->resizeMidRight(active)));
+ bitBlt(widget(), width() - 30, rbt, &(s->resize(active)));
+ }
+ else
+ p.drawLine(1, height() - 1, width() - 2, height() - 1);
+}
+
+void Manager::resizeEvent(TQResizeEvent*)
+{
+ updateButtonVisibility();
+ updateTitleBuffer();
+ widget()->tqrepaint();
+}
+
+void Manager::updateButtonVisibility()
+{
+#if 0
+ enum SizeProblem = { None, Small, Medium, Big };
+ SizeProblem sizeProblem = None;
+
+ if (width() < 80) sizeProblem = Big;
+ else if (width() < 100) sizeProblem = Medium;
+ else if (width() < 180) sizeProblem = Small;
+
+ switch (sizeProblem) {
+
+ case Small:
+ above_ ->hide();
+ lower_ ->hide();
+ sticky_ ->hide();
+ help_ ->hide();
+ iconify_ ->show();
+ maximise_ ->hide();
+ close_ ->show();
+ break;
+
+ case Medium:
+ above_ ->hide();
+ lower_ ->hide();
+ sticky_ ->hide();
+ help_ ->hide();
+ iconify_ ->hide();
+ maximise_ ->hide();
+ close_ ->show();
+ break;
+
+ case Big:
+ above_ ->hide();
+ lower_ ->hide();
+ sticky_ ->hide();
+ help_ ->hide();
+ iconify_ ->hide();
+ maximise_ ->hide();
+ close_ ->hide();
+ break;
+
+ case None:
+ default:
+ above_ ->show();
+ lower_ ->show();
+ sticky_ ->show();
+ if (providesContextHelp())
+ help_->show();
+ iconify_ ->show();
+ maximise_ ->show();
+ close_ ->show();
+ break;
+ }
+
+ tqlayout()->activate();
+#endif
+}
+
+void Manager::updateTitleBuffer()
+{
+ bool active = isActive();
+
+ Static * s = Static::instance();
+
+ TQRect tr = titleSpacer_->tqgeometry();
+
+ if (tr.width() == 0 || tr.height() == 0)
+ titleBuf_.resize(8, 8);
+ else
+ titleBuf_.resize(tr.size());
+
+ TQPainter p(&titleBuf_);
+
+ p.drawPixmap(0, 0, s->titleTextLeft(active));
+
+ p.drawTiledPixmap(3, 0, tr.width() - 6, Static::instance()->titleHeight(),
+ s->titleTextMid(active));
+
+ p.setPen(options()->color(KDecorationOptions::ColorFont, active));
+
+ p.setFont(options()->font(active));
+
+ p.drawText(4, 2, tr.width() - 8, Static::instance()->titleHeight() - 4,
+ AlignCenter, caption());
+
+ p.drawPixmap(tr.width() - 3, 0, s->titleTextRight(active));
+}
+
+KDecoration::Position Manager::mousePosition(const TQPoint& p) const
+{
+ Position m = PositionCenter;
+
+ // Look out for off-by-one errors here.
+
+ if (isResizable())
+ {
+ if (p.y() > (height() - (Static::instance()->resizeHeight() + 1)))
+ {
+ // Keep order !
+
+ if (p.x() >= (width() - 30))
+ m = PositionBottomRight;
+ else if (p.x() <= 30)
+ m = PositionBottomLeft;
+ else
+ m = PositionBottom;
+ }
+ else
+ {
+ m = PositionCenter;
+ // Client::mousePosition(p);
+ }
+ }
+ else
+ {
+ m = PositionCenter;
+ // Client::mousePosition(p);
+ }
+
+ return m;
+}
+
+void Manager::mouseDoubleClickEvent(TQMouseEvent *e)
+{
+ if (e->button() == Qt::LeftButton && titleSpacer_->tqgeometry().contains(e->pos()))
+ titlebarDblClickOperation();
+}
+
+void Manager::wheelEvent(TQWheelEvent *e)
+{
+ if (isSetShade() || titleLayout_->tqgeometry().contains(e->pos()) )
+ titlebarMouseWheelOperation( e->delta());
+}
+
+void Manager::paletteChange(const TQPalette &)
+{
+ resetLayout();
+}
+
+void Manager::stickyChange(bool b)
+{
+ emit(stickyChanged(b));
+}
+
+void Manager::slotToggleSticky()
+{
+ toggleOnAllDesktops();
+ emit(stickyChanged(isOnAllDesktops()));
+}
+
+void Manager::slotAbove()
+{
+ setKeepAbove(!keepAbove());
+}
+
+void Manager::slotLower()
+{
+ setKeepBelow(!keepBelow());
+}
+
+void Manager::slotMaximizeClicked(ButtonState state)
+{
+#if KDE_IS_VERSION(3, 3, 0)
+ maximize(state);
+#else
+ switch (state)
+ {
+ case RightButton:
+ maximize(maximizeMode() ^ MaximizeHorizontal);
+ break;
+
+ case MidButton:
+ maximize(maximizeMode() ^ MaximizeVertical);
+ break;
+
+ case LeftButton:
+ default:
+ maximize(maximizeMode() == MaximizeFull ? MaximizeRestore
+ : MaximizeFull);
+ break;
+ }
+#endif
+ emit(maximizeChanged(maximizeMode() == MaximizeFull));
+}
+
+bool Manager::animateMinimize(bool iconify)
+{
+ int style = Static::instance()->animationStyle();
+
+ switch (style)
+ {
+ case 1:
+ {
+ // Double twisting double back, with pike ;)
+
+ if (!iconify) // No animation for restore.
+ return true;
+
+ // Go away quick.
+ helperShowHide(false);
+ tqApp->syncX();
+
+ TQRect r = iconGeometry();
+
+ if (!r.isValid())
+ return true;
+
+ // Algorithm taken from Window Maker (http://www.windowmaker.org)
+
+ int sx = geometry().x();
+ int sy = geometry().y();
+ int sw = width();
+ int sh = height();
+ int dx = r.x();
+ int dy = r.y();
+ int dw = r.width();
+ int dh = r.height();
+
+ double steps = 12;
+
+ double xstep = double((dx-sx)/steps);
+ double ystep = double((dy-sy)/steps);
+ double wstep = double((dw-sw)/steps);
+ double hstep = double((dh-sh)/steps);
+
+ double cx = sx;
+ double cy = sy;
+ double cw = sw;
+ double ch = sh;
+
+ double finalAngle = 3.14159265358979323846;
+
+ double delta = finalAngle / steps;
+
+ TQPainter p(workspaceWidget());
+ p.setRasterOp(TQt::NotROP);
+
+ for (double angle = 0; ; angle += delta)
+ {
+ if (angle > finalAngle)
+ angle = finalAngle;
+
+ double dx = (cw / 10) - ((cw / 5) * sin(angle));
+ double dch = (ch / 2) * cos(angle);
+ double midy = cy + (ch / 2);
+
+ TQPoint p1(int(cx + dx), int(midy - dch));
+ TQPoint p2(int(cx + cw - dx), p1.y());
+ TQPoint p3(int(cx + dw + dx), int(midy + dch));
+ TQPoint p4(int(cx - dx), p3.y());
+
+ grabXServer();
+
+ p.drawLine(p1, p2);
+ p.drawLine(p2, p3);
+ p.drawLine(p3, p4);
+ p.drawLine(p4, p1);
+
+ p.flush();
+
+ usleep(500);
+
+ p.drawLine(p1, p2);
+ p.drawLine(p2, p3);
+ p.drawLine(p3, p4);
+ p.drawLine(p4, p1);
+
+ ungrabXServer();
+
+ cx += xstep;
+ cy += ystep;
+ cw += wstep;
+ ch += hstep;
+
+ if (angle >= finalAngle)
+ break;
+ }
+ }
+ break;
+
+ case 2:
+ {
+ // KVirc style ? Maybe. For qwertz.
+
+ if (!iconify) // No animation for restore.
+ return true;
+
+ // Go away quick.
+ helperShowHide(false);
+ tqApp->syncX();
+
+ int stepCount = 12;
+
+ TQRect r(geometry());
+
+ int dx = r.width() / (stepCount * 2);
+ int dy = r.height() / (stepCount * 2);
+
+ TQPainter p(workspaceWidget());
+ p.setRasterOp(TQt::NotROP);
+
+ for (int step = 0; step < stepCount; step++)
+ {
+ r.moveBy(dx, dy);
+ r.setWidth(r.width() - 2 * dx);
+ r.setHeight(r.height() - 2 * dy);
+
+ grabXServer();
+
+ p.drawRect(r);
+ p.flush();
+ usleep(200);
+ p.drawRect(r);
+
+ ungrabXServer();
+ }
+ }
+ break;
+
+
+ default:
+ {
+ TQRect icongeom = iconGeometry();
+
+ if (!icongeom.isValid())
+ return true;
+
+ TQRect wingeom = geometry();
+
+ TQPainter p(workspaceWidget());
+
+ p.setRasterOp(TQt::NotROP);
+#if 0
+ if (iconify)
+ p.setClipRegion(TQRegion(workspaceWidget()->rect()) - wingeom);
+#endif
+ grabXServer();
+
+ p.drawLine(wingeom.bottomRight(), icongeom.bottomRight());
+ p.drawLine(wingeom.bottomLeft(), icongeom.bottomLeft());
+ p.drawLine(wingeom.topLeft(), icongeom.topLeft());
+ p.drawLine(wingeom.topRight(), icongeom.topRight());
+
+ p.flush();
+
+ tqApp->syncX();
+
+ usleep(30000);
+
+ p.drawLine(wingeom.bottomRight(), icongeom.bottomRight());
+ p.drawLine(wingeom.bottomLeft(), icongeom.bottomLeft());
+ p.drawLine(wingeom.topLeft(), icongeom.topLeft());
+ p.drawLine(wingeom.topRight(), icongeom.topRight());
+
+ ungrabXServer();
+ }
+ break;
+ }
+ return true;
+}
+
+void Manager::createTitle()
+{
+ leftButtonList_.clear();
+ rightButtonList_.clear();
+
+ TQString buttons;
+
+ if (options()->customButtonPositions())
+ buttons = options()->titleButtonsLeft() + "|" +
+ options()->titleButtonsRight();
+ else
+ buttons = "XSH|IA";
+
+ TQPtrList<Button> *buttonList = &leftButtonList_;
+
+ for (unsigned int i = 0; i < buttons.length(); ++i)
+ {
+ Button * tb = NULL;
+
+ switch (buttons[i].latin1())
+ {
+ case 'S': // Sticky
+ tb = new StickyButton(widget());
+ connect(this, TQT_SIGNAL(stickyChanged(bool)),
+ tb, TQT_SLOT(setOn(bool)));
+ connect(tb, TQT_SIGNAL(toggleSticky()), this, TQT_SLOT(slotToggleSticky()));
+ emit(stickyChanged(isOnAllDesktops()));
+ break;
+
+ case 'H': // Help
+ if (providesContextHelp())
+ {
+ tb = new HelpButton(widget());
+ connect(tb, TQT_SIGNAL(help()), this, TQT_SLOT(showContextHelp()));
+ }
+ break;
+
+ case 'I': // Minimize
+ if (isMinimizable())
+ {
+ tb = new IconifyButton(widget());
+ connect(tb, TQT_SIGNAL(iconify()), this, TQT_SLOT(minimize()));
+ }
+ break;
+
+ case 'A': // Maximize
+ if (isMaximizable())
+ {
+ tb = new MaximiseButton(widget());
+ connect(tb, TQT_SIGNAL(maximizeClicked(ButtonState)),
+ this, TQT_SLOT(slotMaximizeClicked(ButtonState)));
+ connect(this, TQT_SIGNAL(maximizeChanged(bool)),
+ tb, TQT_SLOT(setOn(bool)));
+ emit(maximizeChanged(maximizeMode() == MaximizeFull));
+ }
+ break;
+
+ case 'F': // Above
+ tb = new AboveButton(widget());
+ connect(tb, TQT_SIGNAL(above()), this, TQT_SLOT(slotAbove()));
+ break;
+
+ case 'B': // Lower
+ tb = new LowerButton(widget());
+ connect(tb, TQT_SIGNAL(lower()), this, TQT_SLOT(slotLower()));
+ break;
+
+ case 'X': // Close
+ if (isCloseable())
+ {
+ tb = new CloseButton(widget());
+ connect(tb, TQT_SIGNAL(closeWindow()), this, TQT_SLOT(closeWindow()));
+ }
+ break;
+
+ case '|':
+ buttonList = &rightButtonList_;
+ break;
+ }
+
+ if (tb != NULL)
+ {
+ connect(this, TQT_SIGNAL(activeChanged(bool)), tb, TQT_SLOT(setActive(bool)));
+ buttonList->append(tb);
+ }
+ }
+
+ for (TQPtrListIterator<Button> it(leftButtonList_); it.current(); ++it)
+ {
+ it.current()->tqsetAlignment(Button::Left);
+ titleLayout_->addWidget(it.current());
+ }
+
+ titleSpacer_ = new TQSpacerItem(0, Static::instance()->titleHeight(),
+ TQSizePolicy::Expanding, TQSizePolicy::Fixed);
+
+ titleLayout_->addItem(titleSpacer_);
+
+ for (TQPtrListIterator<Button> it(rightButtonList_); it.current(); ++it)
+ {
+ it.current()->tqsetAlignment(Button::Right);
+ titleLayout_->addWidget(it.current());
+ }
+}
+
+void Manager::resetLayout()
+{
+ delete topLayout_;
+ topLayout_ = new TQVBoxLayout(widget(), 0, 0);
+ topLayout_->setResizeMode(TQLayout::FreeResize);
+
+ titleLayout_ = new TQBoxLayout(topLayout_, TQBoxLayout::LeftToRight, 0, 0);
+ titleLayout_->setResizeMode(TQLayout::FreeResize);
+
+ createTitle();
+
+ TQBoxLayout *midLayout = new TQBoxLayout(topLayout_, TQBoxLayout::LeftToRight,
+ 0, 0);
+ midLayout->setResizeMode(TQLayout::FreeResize);
+ midLayout->addSpacing(1);
+ if (isPreview())
+ midLayout->addWidget(
+ new TQLabel(i18n("<center><b>RiscOS preview</b></center>"), widget()));
+ midLayout->addSpacing(1);
+
+ if (isResizable())
+ topLayout_->addSpacing(Static::instance()->resizeHeight());
+ else
+ topLayout_->addSpacing(1);
+}
+
+// --------------------
+
+Factory::Factory()
+{
+ (void) RiscOS::Static::instance();
+}
+
+Factory::~Factory()
+{
+ delete RiscOS::Static::instance();
+}
+
+bool Factory::reset(unsigned long /*changed*/)
+{
+ RiscOS::Static::instance()->reset();
+ return true;
+}
+
+bool Factory::supports( Ability ability )
+{
+ switch( ability )
+ {
+ case AbilityAnnounceButtons:
+ case AbilityButtonOnAllDesktops:
+ case AbilityButtonHelp:
+ case AbilityButtonMinimize:
+ case AbilityButtonMaximize:
+ case AbilityButtonClose:
+ case AbilityButtonAboveOthers:
+ case AbilityButtonBelowOthers:
+ return true;
+ default:
+ return false;
+ };
+}
+
+KDecoration* Factory::createDecoration(KDecorationBridge *bridge)
+{
+ return new Manager(bridge, this);
+}
+
+} // End namespace
+
+// vim:ts=2:sw=2:tw=78
+#include "Manager.moc"
diff --git a/twin-styles/riscos/Manager.h b/twin-styles/riscos/Manager.h
new file mode 100644
index 00000000..5668a7fc
--- /dev/null
+++ b/twin-styles/riscos/Manager.h
@@ -0,0 +1,125 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_MANAGER_H
+#define RISC_OS_MANAGER_H
+
+#include <tqdict.h>
+#include <kdecoration.h>
+#include <kdecorationfactory.h>
+
+class TQSpacerItem;
+class TQVBoxLayout;
+class TQBoxLayout;
+
+namespace RiscOS
+{
+
+class LowerButton;
+class CloseButton;
+class IconifyButton;
+class MaximiseButton;
+class StickyButton;
+class HelpButton;
+class Button;
+
+class Manager : public KDecoration
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ Manager(KDecorationBridge*, KDecorationFactory*);
+ ~Manager();
+ void init();
+ bool eventFilter(TQObject*, TQEvent*);
+ void reset(unsigned long changed);
+ void borders(int&, int&, int&, int&) const;
+ void resize(const TQSize&);
+ TQSize tqminimumSize() const;
+ void activeChange();
+ void captionChange();
+ void iconChange();
+ void maximizeChange();
+ void desktopChange();
+ void shadeChange();
+
+ signals:
+
+ void maximizeChanged(bool);
+ void stickyChanged(bool);
+ void activeChanged(bool);
+
+ public slots:
+
+ void slotAbove();
+ void slotLower();
+ void slotMaximizeClicked(ButtonState);
+ void slotToggleSticky();
+
+ protected:
+
+ KDecoration::Position mousePosition(const TQPoint &) const;
+ void paletteChange(const TQPalette &);
+ void activeChange(bool);
+ void stickyChange(bool);
+ void paintEvent(TQPaintEvent *);
+ void resizeEvent(TQResizeEvent *);
+ void mouseDoubleClickEvent(TQMouseEvent *);
+ void wheelEvent(TQWheelEvent *e);
+ bool animateMinimize(bool);
+ void updateButtonVisibility();
+ void updateTitleBuffer();
+
+ void createTitle();
+ void resetLayout();
+
+ private:
+
+ TQVBoxLayout *topLayout_;
+ TQBoxLayout *titleLayout_;
+ TQSpacerItem *titleSpacer_;
+
+ TQPixmap titleBuf_;
+ TQPtrList<Button> leftButtonList_;
+ TQPtrList<Button> rightButtonList_;
+};
+
+class Factory : public TQObject, public KDecorationFactory
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ Factory();
+ ~Factory();
+ virtual bool reset(unsigned long changed);
+ virtual KDecoration* createDecoration(KDecorationBridge*);
+ virtual bool supports( Ability ability );
+};
+
+} // End namespace
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/MaximiseButton.cpp b/twin-styles/riscos/MaximiseButton.cpp
new file mode 100644
index 00000000..dcc1b52a
--- /dev/null
+++ b/twin-styles/riscos/MaximiseButton.cpp
@@ -0,0 +1,98 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "MaximiseButton.h"
+
+#include <tqtooltip.h>
+
+namespace RiscOS
+{
+
+/* XPM */
+static const char * const maximise_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+" ",
+" ........ ",
+" .++++++++. ",
+" .++++++++. ",
+" .++++++++. ",
+" .++++++++. ",
+" .++++++++. ",
+" .++++++++. ",
+" .++++++++. ",
+" .++++++++. ",
+" ........ ",
+" "};
+
+/* XPM */
+static const char * const unmaximise_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+" ",
+" ",
+" ...... ",
+" .++++++. ",
+" .++++++. ",
+" .++++++. ",
+" .++++++. ",
+" .++++++. ",
+" .++++++. ",
+" ...... ",
+" ",
+" "};
+
+MaximiseButton::MaximiseButton(TQWidget * parent)
+ : Button(parent, i18n("Maximize"),
+ (ButtonState)(Qt::LeftButton|Qt::MidButton|Qt::RightButton)),
+ on_(false)
+{
+ setPixmap(TQPixmap((const char **)maximise_xpm));
+}
+
+void MaximiseButton::setOn(bool on)
+{
+ on_ = on;
+ setPixmap(on_ ? TQPixmap((const char **)unmaximise_xpm)
+ : TQPixmap((const char **)maximise_xpm));
+ tqrepaint();
+ TQToolTip::remove(this);
+ TQToolTip::add(this, on_ ? i18n("Restore") : i18n("Maximize"));
+}
+
+void MaximiseButton::mouseReleaseEvent(TQMouseEvent *e)
+{
+ Button::mouseReleaseEvent(e);
+
+ if (!rect().contains(e->pos()))
+ return;
+ emit(maximizeClicked(lastButton_));
+}
+
+} // End namespace
+
+// vim:ts=2:sw=2:tw=78
+#include "MaximiseButton.moc"
diff --git a/twin-styles/riscos/MaximiseButton.h b/twin-styles/riscos/MaximiseButton.h
new file mode 100644
index 00000000..770c9370
--- /dev/null
+++ b/twin-styles/riscos/MaximiseButton.h
@@ -0,0 +1,61 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_MAXIMISE_BUTTON_H
+#define RISC_OS_MAXIMISE_BUTTON_H
+
+#include "Button.h"
+
+namespace RiscOS
+{
+
+class MaximiseButton : public Button
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ MaximiseButton(TQWidget *parent);
+
+ public slots:
+
+ void setOn(bool);
+
+ signals:
+
+ void maximizeClicked(ButtonState);
+
+ protected:
+
+ void mouseReleaseEvent(TQMouseEvent *);
+
+ private:
+
+ bool on_;
+};
+
+} // End namespace
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/Palette.h b/twin-styles/riscos/Palette.h
new file mode 100644
index 00000000..3fb71ab0
--- /dev/null
+++ b/twin-styles/riscos/Palette.h
@@ -0,0 +1,69 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_PALETTE_H
+#define RISC_OS_PALETTE_H
+
+#include <tqmemarray.h>
+#include <tqglobal.h>
+
+namespace RiscOS
+{
+
+class Palette
+{
+ public:
+
+ Palette()
+ {
+ data_.resize(8);
+
+ data_[0] = 0xFFFFFFFF;
+ data_[1] = 0xFFDCDCDC;
+ data_[2] = 0xFFC3C3C3;
+ data_[3] = 0xFFA0A0A0;
+ data_[4] = 0xFF808080;
+ data_[5] = 0xFF585858;
+ data_[6] = 0xFF303030;
+ data_[7] = 0xFF000000;
+ }
+
+ TQRgb& operator [] (int idx)
+ {
+ return data_[idx];
+ }
+
+ TQRgb operator [] (int idx) const
+ {
+ return data_[idx];
+ }
+
+ private:
+
+ TQMemArray<TQRgb> data_;
+};
+
+} // End namespace
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/README b/twin-styles/riscos/README
new file mode 100644
index 00000000..39d1d959
--- /dev/null
+++ b/twin-styles/riscos/README
@@ -0,0 +1,90 @@
+This theme emulates the look and feel of the RISC OS 'window manager'.
+Actually, RISC OS doesn't have a window manager in the same way X
+does, but if you imagine it does, this is an emulation of that ;)
+
+The look is obviously quite different, but coming anywhere close to
+the unique look of RISC OS would be quite blatantly obvious, so to
+avoid copyright issues, the look of this theme is unique. You may
+consider it to be RISC OS grown up ;)
+
+Functions that will be implemented but are currently missing:
+ Transparent resize.
+ Shading.
+ Backward-resize.
+ NOTE: Backward-resize is an interesting feature and quite useful.
+ If you resize a window such that you hit the screen edge
+ in the process, the window resizes 'backwards' (i.e.
+ moves in the opposite direction to your drag and at the
+ same time continues increasing in size). So instead
+ of having to let go of the resize handle, move the window
+ and resize again, it just does what you want it to do.
+
+Button functions: (Missing functionality is marked with TODO)
+
+Button One:
+
+ Left button: TODO
+ Lower window and drop focus. This is currently unimplemented
+ in twin itself.
+
+Button Two:
+
+ Left button: Close window.
+
+ Right button: TODO, if I can be bothered.
+ Close window.
+ If window is filer window, open another filer window
+ in parent dir.
+ If window is document window, open a filer window in
+ dir containing document.
+ If you hold Shift, the window doesn't close.
+ NOTE:
+ This requires app support.
+ If I were to implement this, I would do it in konqy
+ and probably not bother for other apps.
+
+Titlebar:
+
+ Left button: Raise, focus and move window
+
+ Middle button: Move window
+
+ Right button: Menu
+ Note: Buttons are this way around for compatibility with
+ other twin themes.
+
+Button Three:
+
+ Left button: Iconify window.
+
+Button Four:
+
+ Left button: Maximise or restore window plus raise and focus.
+
+ Middle button: Maximise vertically or restore window plus raise and focus.
+
+ Right button: Maximise or restore window.
+
+Resize bar left/right:
+
+ Left button: Move that corner (resizes window) and raise
+
+ Other buttons: Same without raising
+
+Resize bar centre:
+
+ Left button: Move that edge (resizes window) and raise
+
+ Other buttons: Same without raising
+
+The lower bar is used for resizing. It works in the NeXT style.
+This doesn't exist on RISC OS. In RISC OS, there is a 'resize handle'
+in the lower right corner of the window (actually inside the window).
+
+To emulate this would mean covering part of the window with the decorations,
+which is not acceptable. RISC OS gets away with it by making sure that
+there is a vertical scrollbar visible at all times, which is just stupid.
+It's also an impossibility with X11, as the window manager does not know
+anything about scrollbars - they belong to the application, so don't ask
+me to implement it.
+
diff --git a/twin-styles/riscos/Static.cpp b/twin-styles/riscos/Static.cpp
new file mode 100644
index 00000000..7aac6f5a
--- /dev/null
+++ b/twin-styles/riscos/Static.cpp
@@ -0,0 +1,540 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+// for enable-final
+#ifdef Bool
+#undef Bool
+#endif
+
+#include <tqimage.h>
+#include <tqpixmap.h>
+#include <tqpainter.h>
+#include <tqptrlist.h>
+
+#include <kdecoration.h>
+
+// #include <ksimpleconfig.h>
+
+#include "Static.h"
+
+namespace RiscOS
+{
+
+/* XPM */
+static const char * const texture_xpm[] = {
+"64 12 3 1",
+" c None",
+"a c #000000",
+"b c #FFFFFF",
+" b b b b b b b a b ",
+" b aa b aaa aaa b a b aab bb a ",
+" b b a b b b b aa b b aa ",
+" b b b a a b b b b aa ab ab ",
+" b b b b b b b ba ",
+" aaa aaa aa b b b b b b ",
+" b b bb a b aa b a a aaa a b ",
+" b b b b b a b b b b b",
+" b b b b a a b b aa b baa ",
+" a b a bb aa bb aa aaa b aa a ",
+" a a aab b b aa aab a b ",
+" b a b b aaa a b bb b b b b"};
+
+Static* Static::instance_ = NULL;
+
+Static::Static()
+{
+ instance_ = this;
+ _init();
+}
+
+Static::~Static()
+{
+ instance_ = NULL;
+}
+
+const TQPixmap& Static::titleTextLeft(bool active) const
+{
+ return active ? aTitleTextLeft_ : iTitleTextLeft_;
+}
+
+const TQPixmap& Static::titleTextRight(bool active) const
+{
+ return active ? aTitleTextRight_ : iTitleTextRight_;
+}
+
+const TQPixmap& Static::resizeMidLeft(bool active) const
+{
+ return active ? aResizeMidLeft_ : iResizeMidLeft_;
+}
+
+const TQPixmap& Static::resizeMidRight(bool active) const
+{
+ return active ? aResizeMidRight_ : iResizeMidRight_;
+}
+
+const TQPixmap& Static::titleTextMid(bool active) const
+{
+ return active ? aTitleTextMid_ : iTitleTextMid_;
+}
+
+const TQPixmap& Static::resizeMidMid(bool active) const
+{
+ return active ? aResizeMid_ : iResizeMid_;
+}
+
+const TQPixmap& Static::resize(bool active) const
+{
+ return active ? aResize_ : iResize_;
+}
+
+int Static::animationStyle() const
+{
+ return animationStyle_;
+}
+
+int Static::titleHeight() const
+{
+ return titleHeight_;
+}
+
+int Static::resizeHeight() const
+{
+ return resizeHeight_;
+}
+
+void Static::_drawBorder(TQPixmap &pix, int w, int h)
+{
+ // 0111111113
+ // 1122222235
+ // 12 46
+ // 12 46
+ // 12 46
+ // 1344444476
+ // 3566666667
+
+ painter_.begin(&pix);
+ painter_.translate(transx, transy);
+
+ TQColor c0 = down_ ? palette_[7] : palette_[0];
+ TQColor c1 = down_ ? palette_[6] : palette_[1];
+ TQColor c2 = down_ ? palette_[5] : palette_[2];
+ TQColor c3 = down_ ? palette_[4] : palette_[3];
+ TQColor c4 = down_ ? palette_[3] : palette_[4];
+ TQColor c5 = down_ ? palette_[2] : palette_[5];
+ TQColor c6 = down_ ? palette_[2] : palette_[6];
+ TQColor c7 = down_ ? palette_[1] : palette_[7];
+
+ painter_.setPen(c0);
+ painter_.drawPoint(0, 0);
+
+ painter_.setPen(c1);
+ painter_.drawPoint(1, 1);
+ painter_.drawLine(1, 0, w - 1, 0);
+ painter_.drawLine(0, 1, 0, h - 1);
+
+ painter_.setPen(c2);
+ painter_.drawLine(2, 1, w - 2, 1);
+ painter_.drawLine(1, 2, 1, h - 2);
+
+ painter_.setPen(c3);
+ painter_.drawPoint(0, h);
+ painter_.drawPoint(1, h - 1);
+ painter_.drawPoint(w, 0);
+ painter_.drawPoint(w - 1, 1);
+ painter_.fillRect(2, 2, w - 2, h - 2, c3);
+
+ painter_.setPen(c4);
+ painter_.drawLine(2, h - 1, w - 2, h - 1);
+ painter_.drawLine(w - 1, 2, w - 1, h - 2);
+
+ painter_.setPen(c5);
+ painter_.drawPoint(w, 1);
+ painter_.drawPoint(1, h);
+
+ painter_.setPen(c6);
+ painter_.drawLine(w, 2, w, h - 1);
+ painter_.drawLine(2, h, w - 1, h);
+
+ painter_.setPen(c7);
+ painter_.drawPoint(w - 1, h - 1);
+ painter_.drawPoint(w, h);
+
+ painter_.end();
+
+ painter_.resetXForm();
+}
+
+void setPalette(Palette &pal, TQColor c)
+{
+ pal[3] = c.rgb();
+
+ int h, s, v;
+ c.hsv(&h, &s, &v);
+
+ if (v < 72)
+ c.setHsv(h, s, 72);
+
+ pal[0] = c.light(200).rgb();
+ pal[1] = c.light(166).rgb();
+ pal[2] = c.light(125).rgb();
+ pal[4] = c.dark(133).rgb();
+ pal[5] = c.dark(166).rgb();
+ pal[6] = c.dark(200).rgb();
+ pal[7] = c.dark(300).rgb();
+}
+
+void Static::_init()
+{
+ hicolour_ = TQPixmap::defaultDepth() > 8;
+ animationStyle_ = 0;
+ updatePixmaps();
+}
+
+void Static::reset()
+{
+ updatePixmaps();
+// Workspace::self()->slotResetAllClientsDelayed();
+}
+
+void Static::updatePixmaps()
+{
+ _initSizes();
+
+ _resizeAllPixmaps();
+
+ _blankAllPixmaps();
+
+ if (hicolour_)
+ {
+ _initPalettes();
+ _initTextures();
+ }
+
+ _drawTitleTextAreaSides();
+
+ _drawResizeCentralAreaSides();
+
+ _drawTitleTextAreaBackground();
+
+ _drawResizeCentralAreaBackground();
+
+ _drawResizeHandles();
+
+ _drawButtonBackgrounds();
+}
+
+void Static::_createTexture(TQPixmap &px, int t, bool active)
+{
+ const TQImage texture(TQPixmap((const char **)texture_xpm).convertToImage());
+ const TQRgb w(tqRgb(255, 255, 255));
+ const TQRgb b(tqRgb(0, 0, 0));
+
+ TQColor c(KDecoration::options()->color(KDecoration::ColorType(t), active));
+
+ TQRgb mid (c.rgb());
+ TQRgb light (c.light(110).rgb());
+ TQRgb dark (c.dark(110).rgb());
+
+ TQRgb* data(reinterpret_cast<TQRgb *>(const_cast<TQImage&>(texture).bits()));
+
+ for (int x = 0; x < 64*12; x++)
+ if (data[x] == w)
+ data[x] = light;
+ else if (data[x] == b)
+ data[x] = dark;
+ else
+ data[x] = mid;
+
+ px.convertFromImage(texture);
+}
+
+const TQPixmap& Static::buttonBase(bool active, bool down) const
+{
+ if (active)
+ return down ? aButtonDown_ : aButtonUp_;
+ else
+ return down ? iButtonDown_ : iButtonUp_;
+}
+
+void Static::_initSizes()
+{
+ TQFont f(KDecoration::options()->font(true)); // XXX false doesn't work right at the moment
+
+ TQFontMetrics fm(f);
+
+ int h = fm.height();
+
+ titleHeight_ = h + 6;
+
+ if (titleHeight_ < 20)
+ titleHeight_ = 20;
+
+ buttonSize_ = titleHeight_ - 1;
+
+ resizeHeight_ = 10;
+}
+
+void Static::_resizeAllPixmaps()
+{
+ aResize_ .resize(30, resizeHeight_);
+ iResize_ .resize(30, resizeHeight_);
+ aTitleTextLeft_ .resize( 3, titleHeight_);
+ aTitleTextRight_.resize( 3, titleHeight_);
+ iTitleTextLeft_ .resize( 3, titleHeight_);
+ iTitleTextRight_.resize( 3, titleHeight_);
+ aTitleTextMid_ .resize(64, titleHeight_);
+ iTitleTextMid_ .resize(64, titleHeight_);
+ aResizeMidLeft_ .resize( 3, resizeHeight_);
+ aResizeMidRight_.resize( 3, resizeHeight_);
+ iResizeMidLeft_ .resize( 3, resizeHeight_);
+ iResizeMidRight_.resize( 3, resizeHeight_);
+ aResizeMid_ .resize(64, resizeHeight_);
+ iResizeMid_ .resize(64, resizeHeight_);
+
+ aButtonUp_ .resize(buttonSize_, buttonSize_);
+ iButtonUp_ .resize(buttonSize_, buttonSize_);
+ aButtonDown_ .resize(buttonSize_, buttonSize_);
+ iButtonDown_ .resize(buttonSize_, buttonSize_);
+}
+
+void Static::_blankAllPixmaps()
+{
+ aResize_ .fill(TQt::black);
+ iResize_ .fill(TQt::black);
+ aTitleTextLeft_ .fill(TQt::black);
+ aTitleTextRight_.fill(TQt::black);
+ iTitleTextLeft_ .fill(TQt::black);
+ iTitleTextRight_.fill(TQt::black);
+ aTitleTextMid_ .fill(TQt::black);
+ iTitleTextMid_ .fill(TQt::black);
+ aResizeMidLeft_ .fill(TQt::black);
+ aResizeMidRight_.fill(TQt::black);
+ iResizeMidLeft_ .fill(TQt::black);
+ iResizeMidRight_.fill(TQt::black);
+ aResizeMid_ .fill(TQt::black);
+ iResizeMid_ .fill(TQt::black);
+ aButtonUp_ .fill(TQt::black);
+ iButtonUp_ .fill(TQt::black);
+ aButtonDown_ .fill(TQt::black);
+ iButtonDown_ .fill(TQt::black);
+}
+
+void Static::_initPalettes()
+{
+ const KDecorationOptions* options = KDecoration::options();
+ setPalette(aButPal_, options->color(KDecoration::ColorButtonBg, true));
+ setPalette(iButPal_, options->color(KDecoration::ColorButtonBg, false));
+
+ setPalette(aTitlePal_, options->color(KDecoration::ColorTitleBar, true));
+ setPalette(iTitlePal_, options->color(KDecoration::ColorTitleBar, false));
+
+ setPalette(aResizePal_, options->color(KDecoration::ColorTitleBar, true));
+ setPalette(iResizePal_, options->color(KDecoration::ColorTitleBar, false));
+}
+
+void Static::_initTextures()
+{
+ _createTexture(aTexture_, KDecoration::ColorTitleBar, true);
+ _createTexture(iTexture_, KDecoration::ColorTitleBar, false);
+ _createTexture(abTexture_, KDecoration::ColorButtonBg, true);
+ _createTexture(ibTexture_, KDecoration::ColorButtonBg, false);
+}
+
+void Static::_drawTitleTextAreaSides()
+{
+ TQPixmap temp(4, titleHeight_);
+ temp.fill(TQt::black);
+
+ transx = transy = 0.0;
+
+ palette_ = aTitlePal_;
+ down_ = false;
+
+ _drawBorder(temp, 4, titleHeight_ - 2);
+
+ painter_.begin(&aTitleTextLeft_);
+ painter_.tqdrawPixmap(1, 1, temp, 0, 1);
+ painter_.end();
+
+ painter_.begin(&aTitleTextRight_);
+ painter_.tqdrawPixmap(0, 1, temp, 2, 1);
+ painter_.end();
+
+ palette_ = iTitlePal_;
+ _drawBorder(temp, 4, titleHeight_ - 2);
+
+ painter_.begin(&iTitleTextLeft_);
+ painter_.tqdrawPixmap(1, 1, temp, 0, 1);
+ painter_.end();
+
+ painter_.begin(&iTitleTextRight_);
+ painter_.tqdrawPixmap(0, 1, temp, 2, 1);
+ painter_.end();
+}
+
+void Static::_drawResizeCentralAreaSides()
+{
+ TQPixmap temp(4, resizeHeight_);
+ temp.fill(TQt::black);
+
+ transy = 1.0;
+
+ palette_ = aResizePal_;
+
+ _drawBorder(temp, 4, resizeHeight_ - 3);
+
+ painter_.begin(&aResizeMidLeft_);
+ painter_.tqdrawPixmap(0, 1, temp, 0, 1);
+ painter_.end();
+
+ painter_.begin(&aResizeMidRight_);
+ painter_.tqdrawPixmap(0, 1, temp, 2, 1);
+ painter_.end();
+
+ palette_ = iResizePal_;
+ _drawBorder(temp, 4, resizeHeight_ - 3);
+
+ painter_.begin(&iResizeMidLeft_);
+ painter_.tqdrawPixmap(0, 1, temp, 0, 1);
+ painter_.end();
+
+ painter_.begin(&iResizeMidRight_);
+ painter_.tqdrawPixmap(0, 1, temp, 2, 1);
+ painter_.end();
+}
+
+void Static::_drawTitleTextAreaBackground()
+{
+ TQPixmap temp(70, titleHeight_);
+ temp.fill(TQt::black);
+
+ transx = transy = 0.0;
+
+ palette_ = aTitlePal_;
+ _drawBorder(temp, 70, titleHeight_ - 3);
+
+ painter_.begin(&aTitleTextMid_);
+ painter_.tqdrawPixmap(0, 1, temp, 2, 0);
+ if (hicolour_)
+ painter_.drawTiledPixmap(0, 4, 64, titleHeight_ - 8, aTexture_);
+ painter_.end();
+
+ palette_ = iTitlePal_;
+ _drawBorder(temp, 70, titleHeight_ - 3);
+
+ painter_.begin(&iTitleTextMid_);
+ painter_.tqdrawPixmap(0, 1, temp, 2, 0);
+ if (hicolour_)
+ painter_.drawTiledPixmap(0, 4, 64, titleHeight_ - 8, iTexture_);
+ painter_.end();
+}
+
+void Static::_drawResizeCentralAreaBackground()
+{
+ TQPixmap temp(70, titleHeight_);
+ temp.fill(TQt::black);
+
+ transy = 1.0;
+
+ palette_ = aResizePal_;
+ _drawBorder(temp, 70, resizeHeight_ - 3);
+
+ painter_.begin(&aResizeMid_);
+ painter_.tqdrawPixmap(0, 0, temp, 2, 0);
+ if (hicolour_)
+ painter_.drawTiledPixmap(0, 4, 64, resizeHeight_ - 8, aTexture_);
+ painter_.end();
+
+ palette_ = iResizePal_;
+ _drawBorder(temp, 70, 7);
+
+ painter_.begin(&iResizeMid_);
+ painter_.tqdrawPixmap(0, 0, temp, 2, 0);
+ if (hicolour_)
+ painter_.drawTiledPixmap(0, 4, 64, resizeHeight_ - 8, iTexture_);
+ painter_.end();
+}
+
+void Static::_drawResizeHandles()
+{
+ transx = transy = 1.0;
+
+ down_ = false;
+
+ palette_ = aResizePal_;
+ _drawBorder(aResize_, 28, resizeHeight_ - 3);
+
+ if (hicolour_)
+ {
+ painter_.begin(&aResize_);
+ painter_.drawTiledPixmap(4, 4, 20, resizeHeight_ - 8, aTexture_);
+ painter_.end();
+ }
+
+ palette_ = iResizePal_;
+ _drawBorder(iResize_, 28, resizeHeight_ - 3);
+
+ if (hicolour_)
+ {
+ painter_.begin(&iResize_);
+ painter_.drawTiledPixmap(4, 4, 20, resizeHeight_ - 8, iTexture_);
+ painter_.end();
+ }
+}
+
+void Static::_drawButtonBackgrounds()
+{
+ buttonSize_ -= 2;
+
+ down_ = false;
+ transx = 0.0;
+ transy = 1.0;
+ palette_ = aButPal_;
+ _drawBorder(aButtonUp_, buttonSize_, buttonSize_);
+ down_ = true;
+ _drawBorder(aButtonDown_, buttonSize_, buttonSize_);
+
+ palette_ = iButPal_;
+ _drawBorder(iButtonDown_, buttonSize_, buttonSize_);
+ down_ = false;
+ _drawBorder(iButtonUp_, buttonSize_, buttonSize_);
+
+ painter_.begin(&aButtonUp_);
+
+ if (hicolour_)
+ painter_.drawTiledPixmap(2, 4, buttonSize_ - 4, buttonSize_ - 5,
+ abTexture_);
+
+ painter_.end();
+
+ painter_.begin(&iButtonUp_);
+ if (hicolour_)
+ painter_.drawTiledPixmap(2, 4, buttonSize_ - 4, buttonSize_ - 5,
+ ibTexture_);
+
+ painter_.end();
+}
+
+} // End namespace
+
+// vim:ts=2:sw=2:tw=78
+
diff --git a/twin-styles/riscos/Static.h b/twin-styles/riscos/Static.h
new file mode 100644
index 00000000..0a5b4cdb
--- /dev/null
+++ b/twin-styles/riscos/Static.h
@@ -0,0 +1,134 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_STATIC_H
+#define RISC_OS_STATIC_H
+
+#include <tqimage.h>
+#include <tqpixmap.h>
+#include <tqpainter.h>
+#include <tqstringlist.h>
+
+#include "Palette.h"
+
+namespace RiscOS
+{
+
+enum SymbolType { Lower, Close, Iconify, Max, Unmax };
+
+class Static
+{
+ public:
+
+ Static();
+
+ ~Static();
+
+ static Static* instance()
+ {
+ if (instance_ == 0)
+ new Static;
+
+ return instance_;
+ }
+
+ void reset();
+ void updatePixmaps();
+
+ const TQPixmap& titleTextLeft(bool active) const;
+ const TQPixmap& titleTextRight(bool active) const;
+ const TQPixmap& resizeMidLeft(bool active) const;
+ const TQPixmap& resizeMidRight(bool active) const;
+ const TQPixmap& titleTextMid(bool active) const;
+ const TQPixmap& resizeMidMid(bool active) const;
+ const TQPixmap& buttonBase(bool active, bool down) const;
+ const TQPixmap& resize(bool active) const;
+
+ int animationStyle() const;
+ int titleHeight() const;
+ int resizeHeight() const;
+
+ private:
+
+ void _init();
+
+ void _drawBorder(TQPixmap&, int, int);
+ void _createTexture(TQPixmap&, int, bool);
+
+ void _initSizes();
+
+ void _resizeAllPixmaps();
+ void _blankAllPixmaps();
+
+ void _initPalettes();
+ void _initTextures();
+
+ void _drawTitleTextAreaSides();
+ void _drawResizeCentralAreaSides();
+ void _drawTitleTextAreaBackground();
+ void _drawResizeCentralAreaBackground();
+ void _drawResizeHandles();
+ void _drawButtonBackgrounds();
+
+ static Static *instance_;
+
+ Palette
+ aTitlePal_,
+ iTitlePal_,
+ aResizePal_,
+ iResizePal_,
+ aButPal_,
+ iButPal_;
+
+ TQPixmap
+ aButtonUp_, iButtonUp_,
+ aButtonDown_, iButtonDown_,
+ aResize_, iResize_,
+ aResizeDown_, iResizeDown_,
+ aTitleTextLeft_, iTitleTextLeft_,
+ aTitleTextRight_, iTitleTextRight_,
+ aTitleTextMid_, iTitleTextMid_,
+ aResizeMidLeft_, iResizeMidLeft_,
+ aResizeMidRight_, iResizeMidRight_,
+ aResizeMid_, iResizeMid_;
+
+ TQPixmap aTexture_, iTexture_, abTexture_, ibTexture_;
+
+ TQPainter painter_;
+ bool down_;
+ Palette palette_;
+ double transx, transy;
+
+ int animationStyle_;
+
+ int titleHeight_;
+ int buttonSize_;
+ int resizeHeight_;
+
+ bool hicolour_;
+};
+
+} // End namespace
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/StickyButton.cpp b/twin-styles/riscos/StickyButton.cpp
new file mode 100644
index 00000000..2229f915
--- /dev/null
+++ b/twin-styles/riscos/StickyButton.cpp
@@ -0,0 +1,99 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "StickyButton.h"
+
+#include <tqtooltip.h>
+
+namespace RiscOS
+{
+
+/* XPM */
+static const char * const unsticky_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+" ... ",
+" .+++. ",
+" .+++. ",
+" .+++. ",
+" .+++. ",
+" .+++++. ",
+" .+++++++. ",
+".+++++++++. ",
+".....+..... ",
+" .+. ",
+" .+. ",
+" . "};
+
+/* XPM */
+static const char * const sticky_xpm[] = {
+"12 12 3 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+" . ",
+" .+. ",
+" .+++. ",
+" .+++++.",
+" ....+++++. ",
+" .++++++. ",
+" .++++. ",
+" .+++. ",
+" .+..+. ",
+" .+. .. ",
+".+. . ",
+".. "};
+
+
+StickyButton::StickyButton(TQWidget *parent)
+ : Button(parent, i18n("On all desktops")), on_(false)
+{
+ setPixmap(TQPixmap((const char **)sticky_xpm));
+}
+
+void StickyButton::setOn(bool on)
+{
+ on_ = on;
+ setPixmap(on_ ? TQPixmap((const char **)unsticky_xpm) :
+ TQPixmap((const char **)sticky_xpm));
+ tqrepaint();
+ TQToolTip::remove(this);
+ TQToolTip::add(this, on_ ? i18n("Not on all desktops")
+ : i18n("On all desktops"));
+}
+
+void StickyButton::mouseReleaseEvent(TQMouseEvent *e)
+{
+ Button::mouseReleaseEvent(e);
+
+ if (!rect().contains(e->pos()))
+ return;
+
+ emit(toggleSticky());
+}
+
+} // End namespace
+
+// vim:ts=2:sw=2:tw=78
+#include "StickyButton.moc"
diff --git a/twin-styles/riscos/StickyButton.h b/twin-styles/riscos/StickyButton.h
new file mode 100644
index 00000000..26c0428e
--- /dev/null
+++ b/twin-styles/riscos/StickyButton.h
@@ -0,0 +1,61 @@
+/*
+ RISC OS KWin client
+
+ Copyright 2000
+ Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RISC_OS_STICKY_BUTTON_H
+#define RISC_OS_STICKY_BUTTON_H
+
+#include "Button.h"
+
+namespace RiscOS
+{
+
+class StickyButton : public Button
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+
+ StickyButton(TQWidget *parent);
+
+ public slots:
+
+ void setOn(bool);
+
+ signals:
+
+ void toggleSticky();
+
+ protected:
+
+ void mouseReleaseEvent(TQMouseEvent *);
+
+ private:
+
+ bool on_;
+};
+
+} // End namespace
+
+#endif
+
+// vim:ts=2:sw=2:tw=78
diff --git a/twin-styles/riscos/riscos.desktop b/twin-styles/riscos/riscos.desktop
new file mode 100644
index 00000000..b58aefda
--- /dev/null
+++ b/twin-styles/riscos/riscos.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=RISC OS
+Name[cs]=Risc OS
+Name[cy]= RISC OS
+Name[hi]=रिस्क ओएस
+Name[ta]=RISC இ.த
+Name[th]=ระบบปฏิบัติการบนชิพ RISC
+Name[uk]=RISC ОС
+Name[xh]=i RISC OS
+Name[zu]=IRISC OS
+X-KDE-Library=twin3_riscos