From 7d7e9df7fcdd450cd3eba8603f28433813542add Mon Sep 17 00:00:00 2001 From: Rik Hemsley Date: Mon, 10 Apr 2000 17:18:21 +0000 Subject: [PATCH] * Removed all pixmaps. All drawing is now done with code. * Implemented colour scheme support, including antialising of symbols and coloured edges to 3d items. * Increased speed and reduced memory usage. * Implemented raising when button-down on resize bar, unless you use the middle/right buttons, in which case you can resize without raising. svn path=/trunk/kdebase/kwin/; revision=46233 --- clients/riscos/Button.cpp | 58 ++ clients/riscos/Button.h | 68 ++ clients/riscos/CloseButton.cpp | 62 ++ clients/riscos/CloseButton.h | 48 ++ clients/riscos/DBWidget.cpp | 63 ++ clients/riscos/DBWidget.h | 63 ++ clients/riscos/IconifyButton.cpp | 64 ++ clients/riscos/IconifyButton.h | 49 ++ clients/riscos/LowerButton.cpp | 55 ++ clients/riscos/LowerButton.h | 48 ++ clients/riscos/Makefile.am | 40 +- clients/riscos/Manager.cpp | 197 ++++++ clients/riscos/Manager.h | 78 +++ clients/riscos/MaximiseButton.cpp | 71 ++ clients/riscos/MaximiseButton.h | 52 ++ clients/riscos/Palette.h | 69 ++ clients/riscos/Pixmaps.h | 98 +++ clients/riscos/ResizeBar.cpp | 62 ++ clients/riscos/ResizeBar.h | 58 ++ clients/riscos/ResizeLeft.cpp | 72 +++ clients/riscos/ResizeLeft.h | 55 ++ clients/riscos/ResizeMid.cpp | 79 +++ clients/riscos/ResizeMid.h | 56 ++ clients/riscos/ResizeRight.cpp | 68 ++ clients/riscos/ResizeRight.h | 53 ++ clients/riscos/ResizeSide.cpp | 83 +++ clients/riscos/ResizeSide.h | 57 ++ clients/riscos/Static.cpp | 618 ++++++++++++++++++ clients/riscos/Static.h | 129 ++++ clients/riscos/TitleBar.cpp | 93 +++ clients/riscos/TitleBar.h | 66 ++ clients/riscos/TitleText.cpp | 113 ++++ clients/riscos/TitleText.h | 63 ++ clients/riscos/Utils.cpp | 36 ++ clients/riscos/Utils.h | 47 ++ clients/riscos/button_base_down.xpm | 28 - clients/riscos/button_base_down_active.xpm | 29 - clients/riscos/button_base_up.xpm | 28 - clients/riscos/button_base_up_active.xpm | 29 - clients/riscos/button_close.xpm | 18 - clients/riscos/button_close_active.xpm | 19 - clients/riscos/button_iconify.xpm | 19 - clients/riscos/button_iconify_active.xpm | 19 - clients/riscos/button_lower.xpm | 22 - clients/riscos/button_lower_active.xpm | 20 - clients/riscos/button_max.xpm | 19 - clients/riscos/button_max_active.xpm | 19 - clients/riscos/button_unmax.xpm | 20 - clients/riscos/button_unmax_active.xpm | 19 - clients/riscos/resize.xpm | 21 - clients/riscos/resize_bar_left.xpm | 15 - clients/riscos/resize_bar_mid.xpm | 16 - clients/riscos/resize_bar_right.xpm | 16 - clients/riscos/riscosclient.cpp | 719 --------------------- clients/riscos/riscosclient.h | 299 --------- clients/riscos/title_active.xpm | 27 - clients/riscos/title_active_left.xpm | 27 - clients/riscos/title_active_right.xpm | 28 - clients/riscos/title_inactive.xpm | 28 - clients/riscos/title_inactive_left.xpm | 26 - clients/riscos/title_inactive_right.xpm | 29 - 61 files changed, 2985 insertions(+), 1565 deletions(-) create mode 100644 clients/riscos/Button.cpp create mode 100644 clients/riscos/Button.h create mode 100644 clients/riscos/CloseButton.cpp create mode 100644 clients/riscos/CloseButton.h create mode 100644 clients/riscos/DBWidget.cpp create mode 100644 clients/riscos/DBWidget.h create mode 100644 clients/riscos/IconifyButton.cpp create mode 100644 clients/riscos/IconifyButton.h create mode 100644 clients/riscos/LowerButton.cpp create mode 100644 clients/riscos/LowerButton.h create mode 100644 clients/riscos/Manager.cpp create mode 100644 clients/riscos/Manager.h create mode 100644 clients/riscos/MaximiseButton.cpp create mode 100644 clients/riscos/MaximiseButton.h create mode 100644 clients/riscos/Palette.h create mode 100644 clients/riscos/Pixmaps.h create mode 100644 clients/riscos/ResizeBar.cpp create mode 100644 clients/riscos/ResizeBar.h create mode 100644 clients/riscos/ResizeLeft.cpp create mode 100644 clients/riscos/ResizeLeft.h create mode 100644 clients/riscos/ResizeMid.cpp create mode 100644 clients/riscos/ResizeMid.h create mode 100644 clients/riscos/ResizeRight.cpp create mode 100644 clients/riscos/ResizeRight.h create mode 100644 clients/riscos/ResizeSide.cpp create mode 100644 clients/riscos/ResizeSide.h create mode 100644 clients/riscos/Static.cpp create mode 100644 clients/riscos/Static.h create mode 100644 clients/riscos/TitleBar.cpp create mode 100644 clients/riscos/TitleBar.h create mode 100644 clients/riscos/TitleText.cpp create mode 100644 clients/riscos/TitleText.h create mode 100644 clients/riscos/Utils.cpp create mode 100644 clients/riscos/Utils.h delete mode 100644 clients/riscos/button_base_down.xpm delete mode 100644 clients/riscos/button_base_down_active.xpm delete mode 100644 clients/riscos/button_base_up.xpm delete mode 100644 clients/riscos/button_base_up_active.xpm delete mode 100644 clients/riscos/button_close.xpm delete mode 100644 clients/riscos/button_close_active.xpm delete mode 100644 clients/riscos/button_iconify.xpm delete mode 100644 clients/riscos/button_iconify_active.xpm delete mode 100644 clients/riscos/button_lower.xpm delete mode 100644 clients/riscos/button_lower_active.xpm delete mode 100644 clients/riscos/button_max.xpm delete mode 100644 clients/riscos/button_max_active.xpm delete mode 100644 clients/riscos/button_unmax.xpm delete mode 100644 clients/riscos/button_unmax_active.xpm delete mode 100644 clients/riscos/resize.xpm delete mode 100644 clients/riscos/resize_bar_left.xpm delete mode 100644 clients/riscos/resize_bar_mid.xpm delete mode 100644 clients/riscos/resize_bar_right.xpm delete mode 100644 clients/riscos/riscosclient.cpp delete mode 100644 clients/riscos/riscosclient.h delete mode 100644 clients/riscos/title_active.xpm delete mode 100644 clients/riscos/title_active_left.xpm delete mode 100644 clients/riscos/title_active_right.xpm delete mode 100644 clients/riscos/title_inactive.xpm delete mode 100644 clients/riscos/title_inactive_left.xpm delete mode 100644 clients/riscos/title_inactive_right.xpm diff --git a/clients/riscos/Button.cpp b/clients/riscos/Button.cpp new file mode 100644 index 0000000000..5daa5bd110 --- /dev/null +++ b/clients/riscos/Button.cpp @@ -0,0 +1,58 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +#include "../../options.h" + +#include "Button.h" +#include "Manager.h" +#include "Static.h" + +namespace RiscOS +{ + +Button::Button(QWidget * parent, Manager * client, SymbolType t) + : QWidget (parent, "Button"), + client_ (client), + type_ (t), + align_ (Left), + down_ (false) +{ + setFixedSize(19, 20); +} + +Button::~Button() +{ + // Empty. +} + + void +Button::updateDisplay() +{ + setBackgroundPixmap(Static::instance()->button(type_, client_->isActive(), down_)); +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Button.h b/clients/riscos/Button.h new file mode 100644 index 0000000000..739a8c4e74 --- /dev/null +++ b/clients/riscos/Button.h @@ -0,0 +1,68 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_BUTTON_H +#define RISC_OS_BUTTON_H + +#include + +#include "Static.h" + +namespace RiscOS +{ + +class Manager; + +class Button : public QWidget +{ + public: + + enum Alignment { Left, Right }; + + Button(QWidget * parent, Manager * client, SymbolType); + virtual ~Button(); + + void updateDisplay(); + + void setAlign(Alignment a) { align_ = a; updateDisplay(); } + void setType(SymbolType t) { type_ = t; updateDisplay(); } + + protected: + + Manager * client() { return client_; } + + void mousePressEvent(QMouseEvent *) { down_ = true; updateDisplay(); } + void mouseReleaseEvent(QMouseEvent *) { down_ = false; updateDisplay(); } + + private: + + Manager * client_; + SymbolType type_; + Alignment align_; + bool down_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/CloseButton.cpp b/clients/riscos/CloseButton.cpp new file mode 100644 index 0000000000..c8cdd656fe --- /dev/null +++ b/clients/riscos/CloseButton.cpp @@ -0,0 +1,62 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "CloseButton.h" +#include "Manager.h" +#include "Static.h" + +namespace RiscOS +{ + +CloseButton::CloseButton(QWidget * parent, Manager * client) + : Button(parent, client, Close) +{ +} + + void +CloseButton::mouseReleaseEvent(QMouseEvent * e) +{ + Button::mouseReleaseEvent(e); + + if (!rect().contains(e->pos())) + return; + + switch (e->button()) + { + case RightButton: + client()->closeWindow(); + break; + + case MidButton: + client()->closeWindow(); + break; + + case LeftButton: + default: + client()->closeWindow(); + break; + } +} + +} // End namespace; + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/CloseButton.h b/clients/riscos/CloseButton.h new file mode 100644 index 0000000000..4c066fe5b2 --- /dev/null +++ b/clients/riscos/CloseButton.h @@ -0,0 +1,48 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_CLOSE_BUTTON_H +#define RISC_OS_CLOSE_BUTTON_H + +#include "Button.h" + +namespace RiscOS +{ + +class Manager; + +class CloseButton : public Button +{ + public: + + CloseButton(QWidget * parent, Manager * client); + + protected: + + void mouseReleaseEvent(QMouseEvent *); +}; + +} // End namespace; + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/DBWidget.cpp b/clients/riscos/DBWidget.cpp new file mode 100644 index 0000000000..76fc926676 --- /dev/null +++ b/clients/riscos/DBWidget.cpp @@ -0,0 +1,63 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "DBWidget.h" + +namespace RiscOS +{ + +DBWidget::DBWidget(QWidget * parent, const char * name) + : QWidget(parent, name, WResizeNoErase | WRepaintNoErase | WPaintUnclipped) +{ + buf_.resize(20, 20); + setBackgroundMode(NoBackground); +} + + void +DBWidget::updateDisplay() +{ + updatePixmap(); + repaint(false); +} + + void +DBWidget::paintEvent(QPaintEvent * e) +{ + QRect r(e->rect()); + bitBlt(this, r.topLeft(), &buf_, r, Qt::CopyROP); +} + + void +DBWidget::resizeEvent(QResizeEvent * e) +{ + QWidget::resizeEvent(e); + + if ( (buf_.width() < size().width()) || + (QABS(size().width() - buf_.width()) > 128) ) + buf_.resize(((size().width() / 128)* 128) + 128, size().height()); + + updateDisplay(); +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/DBWidget.h b/clients/riscos/DBWidget.h new file mode 100644 index 0000000000..345d956bee --- /dev/null +++ b/clients/riscos/DBWidget.h @@ -0,0 +1,63 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_DOUBLE_BUFFERED_WIDGET_H +#define RISC_OS_DOUBLE_BUFFERED_WIDGET_H + +#include +#include + +namespace RiscOS +{ + +class DBWidget : public QWidget +{ + public: + + DBWidget(QWidget * parent = 0, const char * name = 0); + virtual ~DBWidget() { /* Empty */ } + + virtual void updateDisplay(); + + protected: + + virtual void updatePixmap() = 0L; + + virtual void paintEvent(QPaintEvent * e); + virtual void resizeEvent(QResizeEvent * e); + + QPixmap & buf() { return buf_; } + + + private: + + DBWidget(const DBWidget &); + DBWidget & operator = (const DBWidget &); + + QPixmap buf_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/IconifyButton.cpp b/clients/riscos/IconifyButton.cpp new file mode 100644 index 0000000000..69b6817f1e --- /dev/null +++ b/clients/riscos/IconifyButton.cpp @@ -0,0 +1,64 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "IconifyButton.h" +#include "Manager.h" +#include "Static.h" + +namespace RiscOS +{ + +IconifyButton::IconifyButton(QWidget * parent, Manager * client) + : Button(parent, client, Iconify) +{ +} + + void +IconifyButton::mouseReleaseEvent(QMouseEvent * e) +{ + Button::mouseReleaseEvent(e); + + if (!rect().contains(e->pos())) + return; + + switch (e->button()) + { + case RightButton: + client()->iconify(); + break; + + case MidButton: + client()->iconify(); + break; + + case LeftButton: + default: + client()->iconify(); + break; + } + + +} + +} // End namespace; + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/IconifyButton.h b/clients/riscos/IconifyButton.h new file mode 100644 index 0000000000..f2ea323edf --- /dev/null +++ b/clients/riscos/IconifyButton.h @@ -0,0 +1,49 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_ICONIFY_BUTTON_H +#define RISC_OS_ICONIFY_BUTTON_H + +#include "Button.h" + +namespace RiscOS +{ + +class Manager; + + +class IconifyButton : public Button +{ + public: + + IconifyButton(QWidget * parent, Manager * client); + + protected: + + void mouseReleaseEvent(QMouseEvent *); +}; + +} // End namespace; + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/LowerButton.cpp b/clients/riscos/LowerButton.cpp new file mode 100644 index 0000000000..707487bf16 --- /dev/null +++ b/clients/riscos/LowerButton.cpp @@ -0,0 +1,55 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "LowerButton.h" +#include "Manager.h" +#include "Static.h" + +namespace RiscOS +{ + +LowerButton::LowerButton(QWidget * parent, Manager * client) + : Button(parent, client, Lower) +{ +} + + void +LowerButton::mouseReleaseEvent(QMouseEvent * e) +{ + Button::mouseReleaseEvent(e); + + if (!rect().contains(e->pos())) + return; + + switch (e->button()) + { + default: + qDebug("Need kwin support for lowering window"); + break; + } + +} + + +} // End namespace; + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/LowerButton.h b/clients/riscos/LowerButton.h new file mode 100644 index 0000000000..da04fed961 --- /dev/null +++ b/clients/riscos/LowerButton.h @@ -0,0 +1,48 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_LOWER_BUTTON_H +#define RISC_OS_LOWER_BUTTON_H + +#include "Button.h" + +namespace RiscOS +{ + +class Manager; + +class LowerButton : public Button +{ + public: + + LowerButton(QWidget * parent, Manager * client); + + protected: + + void mouseReleaseEvent(QMouseEvent *); +}; + +} // End namespace; + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Makefile.am b/clients/riscos/Makefile.am index 762994b1dd..5e88845559 100644 --- a/clients/riscos/Makefile.am +++ b/clients/riscos/Makefile.am @@ -1,19 +1,47 @@ +KDE_CXXFLAGS = -O0 -g3 -W -Wall + INCLUDES = $(all_includes) lib_LTLIBRARIES = libkwinriscos.la -libkwinriscos_la_SOURCES = riscosclient.cpp +libkwinriscos_la_SOURCES = \ +Button.cpp \ +CloseButton.cpp \ +DBWidget.cpp \ +IconifyButton.cpp \ +LowerButton.cpp \ +Manager.cpp \ +MaximiseButton.cpp \ +ResizeBar.cpp \ +ResizeMid.cpp \ +ResizeSide.cpp \ +TitleBar.cpp \ +TitleText.cpp \ +Utils.cpp \ +Static.cpp METASOURCES = AUTO -noinst_HEADERS = riscosclient.h +noinst_HEADERS = \ +Button.h \ +CloseButton.h \ +DBWidget.h \ +IconifyButton.h \ +LowerButton.h \ +Manager.h \ +MaximiseButton.h \ +ResizeBar.h \ +ResizeMid.h \ +ResizeSide.h \ +TitleBar.h \ +TitleText.h \ +Utils.h \ +Static.h lnkdir = $(kde_datadir)/kwin/ lnk_DATA = riscos.desktop EXTRA_DIST = $(lnk_DATA) -libkwinriscos_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -rdynamic +libkwinriscos_la_LIBADD = ../../kwin.la -lqt -lX11 +libkwinriscos_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -rdynamic -no-undefined -###KMAKE-start (don't edit or delete this block) - -###KMAKE-end diff --git a/clients/riscos/Manager.cpp b/clients/riscos/Manager.cpp new file mode 100644 index 0000000000..2d51e3e232 --- /dev/null +++ b/clients/riscos/Manager.cpp @@ -0,0 +1,197 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +#include "../../options.h" +#include "../../workspace.h" + +#include "Manager.h" +#include "Static.h" +#include "TitleBar.h" +#include "ResizeBar.h" + +extern "C" +{ + Client * allocate(Workspace * workSpace, WId winId) + { + return new RiscOS::Manager(workSpace, winId); + } +} + +namespace RiscOS +{ + +Manager::Manager( + Workspace * workSpace, + WId id, + QWidget * parent, + const char * name +) + : Client(workSpace, id, parent, name, WResizeNoErase | WRepaintNoErase | WPaintUnclipped) +{ + Static::instance()->update(); + + setBackgroundMode(NoBackground); + + connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); + + titleBar_ = new TitleBar(this, this); + resizeBar_ = new ResizeBar(this, this); + + // Layout + + // Border + // Window + // Border + QHBoxLayout * windowLayout = new QHBoxLayout(0, "windowLayout"); + windowLayout->addSpacing(1); + windowLayout->addWidget(windowWrapper(), 1); + windowLayout->addSpacing(1); + + // Border + // Titlebar + // Window layout + // Resize bar + QVBoxLayout * mainLayout = new QVBoxLayout(this, 0, 0, "mainLayout"); + mainLayout->addWidget(titleBar_); + mainLayout->addLayout(windowLayout, 1); + mainLayout->addWidget(resizeBar_); +} + +Manager::~Manager() +{ +} + + void +Manager::slotReset() +{ + Static::instance()->update(); + titleBar_->updateDisplay(); + resizeBar_->updateDisplay(); +} + + void +Manager::captionChange(const QString &) +{ + titleBar_->updateText(); +} + + void +Manager::paletteChange(const QPalette &) +{ + Static::instance()->update(); + titleBar_->updateDisplay(); +} + + void +Manager::activeChange(bool) +{ + titleBar_->updateDisplay(); + resizeBar_->updateDisplay(); +} + + void +Manager::maximizeChange(bool b) +{ + titleBar_->updateMaximise(b); +} + + void +Manager::maximizeAndRaise() +{ + maximize(MaximizeFull); + workspace()->raiseClient(this); + workspace()->requestFocus(this); +} + + void +Manager::maximizeVertically() +{ + maximize(MaximizeVertical); + workspace()->raiseClient(this); + workspace()->requestFocus(this); +} + + void +Manager::maximizeNoRaise() +{ + maximize(MaximizeFull); +} + + void +Manager::resize(int w, int h) +{ + Client::resize(w, h); +} + + void +Manager::updateDisplay() +{ + titleBar_->updateDisplay(); + resizeBar_->updateDisplay(); +} + + void +Manager::setShade(bool) +{ +#if 0 + // Hmm. This does screwy things to the layout. + if (b) + resizeBar_->hide(); + else + resizeBar_->show(); +#endif + + // And this is screwed. My window ends up the wrong size when unshaded. +// Client::setShade(b); +} + + void +Manager::paintEvent(QPaintEvent * e) +{ + QRect r(e->rect()); + + bool intersectsLeft = + r.intersects(QRect(0, 0, 1, height())); + + bool intersectsRight = + r.intersects(QRect(width() - 1, 0, width(), height())); + + if (intersectsLeft || intersectsRight) { + + QPainter p(this); +// ??? p.setPen(options->color(Options::Frame, isActive())); + p.setPen(Qt::black); + + if (intersectsLeft) + p.drawLine(0, r.top(), 0, r.bottom()); + + if (intersectsRight) + p.drawLine(width() - 1, r.top(), width() - 1, r.bottom()); + } +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Manager.h b/clients/riscos/Manager.h new file mode 100644 index 0000000000..cd1e77d945 --- /dev/null +++ b/clients/riscos/Manager.h @@ -0,0 +1,78 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_MANAGER_H +#define RISC_OS_MANAGER_H + +#include "../../client.h" + +namespace RiscOS +{ + +class TitleBar; +class ResizeBar; + +class Manager : public Client +{ + Q_OBJECT + + public: + + Manager(Workspace *, WId, QWidget * parent = 0, const char * name = 0); + ~Manager(); + + void maximizeVertically(); + void maximizeAndRaise(); + void maximizeNoRaise(); + void resize(int, int); + + void setShade(bool); + + void updateDisplay(); + + protected: + + void paletteChange(const QPalette &); + void activeChange(bool); + void maximizeChange(bool); + void paintEvent(QPaintEvent *); + void mouseMoveEvent(QMouseEvent *) {} // Disabled + void mousePressEvent(QMouseEvent *) {} // Disabled + void mouseReleaseEvent(QMouseEvent *) {} // Disabled + + protected slots: + + void captionChange(const QString &); + void slotReset(); + + private: + + TitleBar * titleBar_; + ResizeBar * resizeBar_; + +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/MaximiseButton.cpp b/clients/riscos/MaximiseButton.cpp new file mode 100644 index 0000000000..1c46d33781 --- /dev/null +++ b/clients/riscos/MaximiseButton.cpp @@ -0,0 +1,71 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "MaximiseButton.h" +#include "Static.h" +#include "Manager.h" + +namespace RiscOS +{ + +MaximiseButton::MaximiseButton(QWidget * parent, Manager * client) + : Button(parent, client, Max) +{ +} + + void +MaximiseButton::setOn(bool on) +{ + if (on) + setType(Unmax); + else + setType(Max); +} + + void +MaximiseButton::mouseReleaseEvent(QMouseEvent * e) +{ + Button::mouseReleaseEvent(e); + + if (!rect().contains(e->pos())) + return; + + switch (e->button()) + { + case RightButton: + client()->maximizeNoRaise(); + break; + + case MidButton: + client()->maximizeVertically(); + break; + + case LeftButton: + default: + client()->maximizeAndRaise(); + break; + } +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/MaximiseButton.h b/clients/riscos/MaximiseButton.h new file mode 100644 index 0000000000..9566307ece --- /dev/null +++ b/clients/riscos/MaximiseButton.h @@ -0,0 +1,52 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_MAXIMISE_BUTTON_H +#define RISC_OS_MAXIMISE_BUTTON_H + +#include + +#include "Button.h" + +namespace RiscOS +{ + +class Manager; + +class MaximiseButton : public Button +{ + public: + + MaximiseButton(QWidget * parent, Manager * client); + + void setOn(bool); + + protected: + + void mouseReleaseEvent(QMouseEvent *); +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Palette.h b/clients/riscos/Palette.h new file mode 100644 index 0000000000..f6383d440e --- /dev/null +++ b/clients/riscos/Palette.h @@ -0,0 +1,69 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_PALETTE_H +#define RISC_OS_PALETTE_H + +#include +#include + +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; + } + + QRgb & operator [] (int idx) + { + return data_[idx]; + } + + QRgb operator [] (int idx) const + { + return data_[idx]; + } + + private: + + QArray data_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Pixmaps.h b/clients/riscos/Pixmaps.h new file mode 100644 index 0000000000..3533d85b01 --- /dev/null +++ b/clients/riscos/Pixmaps.h @@ -0,0 +1,98 @@ +static const char * const button_close_xpm[] = { +"12 12 3 1", +" c None", +". c #585858", +"+ c #DCDCDC", +" .. .. ", +".++. .++.", +".+++. .+++.", +" .+++..+++. ", +" .++++++. ", +" .++++. ", +" .++++. ", +" .++++++. ", +" .+++..+++. ", +".+++. .+++.", +".++. .++.", +" .. .. "}; + +static const char * const button_iconify_xpm[] = { +"12 12 4 1", +" c None", +". c #808080", +"+ c #585858", +"@ c #DCDCDC", +" ", +" ", +" ", +" ", +" .++++++++. ", +" +@@@@@@@@+ ", +" +@@@@@@@@+ ", +" .++++++++. ", +" ", +" ", +" ", +" "}; + +static const char * const button_lower_xpm[] = { +"12 12 7 1", +" c None", +". c #585858", +"+ c #FFFFFF", +"@ c #808080", +"# c #C3C3C3", +"$ c #DCDCDC", +"% c #A0A0A0", +"@......@ ", +".++++++. ", +".++++++. ", +".++++++@ ", +".+++@......@", +".+++.$$#$$$.", +".+++.$$%$$$.", +"@..@.#%%$$$.", +" .$$$$$$.", +" .$$$$$$.", +" .$$$$$$.", +" @......@"}; + +static const char * const button_max_xpm[] = { +"12 12 4 1", +" c None", +". c #DCDCDC", +"+ c #585858", +"@ c #808080", +" ", +" ", +" @++++++@ ", +" +......+ ", +" +......+ ", +" +......+ ", +" +......+ ", +" +......+ ", +" +......+ ", +" @++++++@ ", +" ", +" "}; + +static const char * const button_unmax_xpm[] = { +"12 12 5 1", +" c None", +". c #808080", +"+ c #585858", +"@ c #C3C3C3", +"# c #DCDCDC", +".++++++++++.", +"+@########@+", +"+##########+", +"+##########+", +"+##########+", +"+##########+", +"+##########+", +"+##########+", +"+##########+", +"+##########+", +"+@########@+", +".++++++++++."}; + diff --git a/clients/riscos/ResizeBar.cpp b/clients/riscos/ResizeBar.cpp new file mode 100644 index 0000000000..5bc60d3dd2 --- /dev/null +++ b/clients/riscos/ResizeBar.cpp @@ -0,0 +1,62 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include "ResizeBar.h" +#include "ResizeMid.h" +#include "ResizeSide.h" + +#include + +namespace RiscOS +{ + +ResizeBar::ResizeBar(QWidget * parent, Manager * client) + : QWidget (parent, "ResizeBar"), + client_ (client) +{ + setBackgroundMode(NoBackground); + setFixedHeight(10); + + left_ = new ResizeSide(this, client_, ResizeSide::Left); + mid_ = new ResizeMid(this, client_); + right_ = new ResizeSide(this, client_, ResizeSide::Right); + + QHBoxLayout * layout = new QHBoxLayout(this); + + layout->addWidget(left_); + layout->addWidget(mid_, 1); + layout->addWidget(right_); +} + + void +ResizeBar::updateDisplay() +{ + left_ ->updateDisplay(); + mid_ ->updateDisplay(); + right_->updateDisplay(); +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeBar.h b/clients/riscos/ResizeBar.h new file mode 100644 index 0000000000..fdcc40e114 --- /dev/null +++ b/clients/riscos/ResizeBar.h @@ -0,0 +1,58 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_RESIZE_BAR_H +#define RISC_OS_RESIZE_BAR_H + +#include + +namespace RiscOS +{ + +class Manager; + +class ResizeMid; +class ResizeSide; + +class ResizeBar : public QWidget +{ + Q_OBJECT + + public: + + ResizeBar(QWidget * parent, Manager * client); + void updateDisplay(); + + private: + + Manager * client_; + + ResizeSide * left_; + ResizeMid * mid_; + ResizeSide * right_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeLeft.cpp b/clients/riscos/ResizeLeft.cpp new file mode 100644 index 0000000000..3d0fe82b79 --- /dev/null +++ b/clients/riscos/ResizeLeft.cpp @@ -0,0 +1,72 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include "ResizeSide.h" +#include "Manager.h" +#include "Static.h" +#include "Utils.h" + +namespace RiscOS +{ + +ResizeSide::ResizeSide(QWidget * parent, Manager * client, Side s) + : QWidget (parent, "ResizeSide"), + client_ (client), + side_ (s) +{ + setCursor(side_ == Left ? Qt::sizeBDiagCursor : Qt::sizeFDiagCursor); + setFixedSize(30, 10); + update(); +} + + void +ResizeSide::mouseMoveEvent(QMouseEvent * e) +{ + QRect g = client_->geometry(); + g.setBottom(e->globalPos().y()); + g.setSide(e->globalPos().x()); + + QSize adjustedSize = client_->adjustedSize(g.size()); + + if (adjustedSize != client_->size()) { + + if (side_ == Left) + g.setSide(g.right() + side_ - adjustedSize.width()); + else + g.setSide(g.right() + side_ + adjustedSize.width()); + + g.setBottom(g.top() + adjustedSize.height()); + client_->setGeometry(g); + } +} + + void +ResizeSide::update() +{ + setBackgroundPixmap(Static::instance()->resize(client_->isActive())); +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeLeft.h b/clients/riscos/ResizeLeft.h new file mode 100644 index 0000000000..888ca6c9d4 --- /dev/null +++ b/clients/riscos/ResizeLeft.h @@ -0,0 +1,55 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_RESIZE_SIDE_H +#define RISC_OS_RESIZE_SIDE_H + +#include + +namespace RiscOS +{ + +class Manager; + +class ResizeLeft : public QWidget +{ + public: + + enum Side { Left, Right }; + + ResizeLeft(QWidget * parent, Manager * client, Side); + void update(); + + protected: + + void mouseMoveEvent(QMouseEvent *); + + private: + + Manager * client_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeMid.cpp b/clients/riscos/ResizeMid.cpp new file mode 100644 index 0000000000..8f614d0546 --- /dev/null +++ b/clients/riscos/ResizeMid.cpp @@ -0,0 +1,79 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include "ResizeMid.h" +#include "Manager.h" +#include "Static.h" +#include "Utils.h" + +namespace RiscOS +{ + +ResizeMid::ResizeMid(QWidget * parent, Manager * client) + : DBWidget(parent, "ResizeMid"), + client_(client) +{ + setFixedHeight(10); + setCursor(Qt::sizeVerCursor); +} + +ResizeMid::~ResizeMid() +{ + // Empty. +} + + void +ResizeMid::updatePixmap() +{ + QPainter p(&buf()); + + p.drawPixmap(0, 0, Static::instance()->resizeMidLeft(client_->isActive())); + p.drawPixmap(width() - 2, 0, Static::instance()->resizeMidRight(client_->isActive())); + p.drawTiledPixmap(2, 0, width() - 4, 10, Static::instance()->resizeMidMid(client_->isActive())); +} + + void +ResizeMid::mouseMoveEvent(QMouseEvent * e) +{ + QRect g = client_->geometry(); + g.setBottom(e->globalPos().y()); + + QSize adjustedSize = client_->adjustedSize(g.size()); + + if (adjustedSize != client_->size()) { + g.setBottom(g.top() + adjustedSize.height()); + client_->setGeometry(g); + } +} + + void +ResizeMid::mousePressEvent(QMouseEvent * e) +{ + if (e->button() == LeftButton) + client_->raise(); +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeMid.h b/clients/riscos/ResizeMid.h new file mode 100644 index 0000000000..111d9bae66 --- /dev/null +++ b/clients/riscos/ResizeMid.h @@ -0,0 +1,56 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_RESIZE_MID_H +#define RISC_OS_RESIZE_MID_H + +#include "DBWidget.h" + +namespace RiscOS +{ + +class Manager; + +class ResizeMid : public DBWidget +{ + public: + + ResizeMid(QWidget * parent, Manager * client); + virtual ~ResizeMid(); + + protected: + + void updatePixmap(); + + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + + private: + + Manager * client_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeRight.cpp b/clients/riscos/ResizeRight.cpp new file mode 100644 index 0000000000..c9b29488f0 --- /dev/null +++ b/clients/riscos/ResizeRight.cpp @@ -0,0 +1,68 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include "ResizeRight.h" +#include "Manager.h" +#include "Static.h" +#include "Utils.h" + +namespace RiscOS +{ + +ResizeRight::ResizeRight(QWidget * parent, Manager * client) + : QWidget(parent, "ResizeRight"), + client_(client) +{ + setCursor(Qt::sizeFDiagCursor); + + setFixedSize(30, 10); + + update(); +} + + void +ResizeRight::mouseMoveEvent(QMouseEvent * e) +{ + QRect g = client_->geometry(); + g.setBottom(e->globalPos().y()); + g.setRight(e->globalPos().x()); + + QSize adjustedSize = client_->adjustedSize(g.size()); + + if (adjustedSize != client_->size()) { + g.setRight(g.left() + adjustedSize.width()); + g.setBottom(g.top() + adjustedSize.height()); + client_->setGeometry(g); + } +} + + void +ResizeRight::update() +{ + setBackgroundPixmap(Static::instance()->resize(client_->isActive())); +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeRight.h b/clients/riscos/ResizeRight.h new file mode 100644 index 0000000000..3c871f7962 --- /dev/null +++ b/clients/riscos/ResizeRight.h @@ -0,0 +1,53 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_RESIZE_RIGHT_H +#define RISC_OS_RESIZE_RIGHT_H + +#include + +namespace RiscOS +{ + +class Manager; + +class ResizeRight : public QWidget +{ + public: + + ResizeRight(QWidget * parent, Manager * client); + void update(); + + protected: + + void mouseMoveEvent(QMouseEvent *); + + private: + + Manager * client_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeSide.cpp b/clients/riscos/ResizeSide.cpp new file mode 100644 index 0000000000..9f6e0c6c5a --- /dev/null +++ b/clients/riscos/ResizeSide.cpp @@ -0,0 +1,83 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include "ResizeSide.h" +#include "Manager.h" +#include "Static.h" +#include "Utils.h" + +namespace RiscOS +{ + +ResizeSide::ResizeSide(QWidget * parent, Manager * client, Side s) + : QWidget (parent, "ResizeSide"), + client_ (client), + side_ (s) +{ + setCursor(side_ == Left ? Qt::sizeBDiagCursor : Qt::sizeFDiagCursor); + setFixedSize(30, 10); + updateDisplay(); +} + + void +ResizeSide::mouseMoveEvent(QMouseEvent * e) +{ + QRect g = client_->geometry(); + g.setBottom(e->globalPos().y()); + if (side_ == Left) + g.setLeft(e->globalPos().x()); + else + g.setRight(e->globalPos().x()); + + QSize adjustedSize = client_->adjustedSize(g.size()); + + if (adjustedSize != client_->size()) { + + if (side_ == Left) + g.setLeft(g.right() - adjustedSize.width()); + else + g.setRight(g.left() + adjustedSize.width()); + + g.setBottom(g.top() + adjustedSize.height()); + + client_->setGeometry(g); + } +} + + void +ResizeSide::updateDisplay() +{ + setBackgroundPixmap(Static::instance()->resize(client_->isActive())); +} + + void +ResizeSide::mousePressEvent(QMouseEvent * e) +{ + if (e->button() == LeftButton) + client_->raise(); +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/ResizeSide.h b/clients/riscos/ResizeSide.h new file mode 100644 index 0000000000..1b31e9d2c0 --- /dev/null +++ b/clients/riscos/ResizeSide.h @@ -0,0 +1,57 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_RESIZE_SIDE_H +#define RISC_OS_RESIZE_SIDE_H + +#include + +namespace RiscOS +{ + +class Manager; + +class ResizeSide : public QWidget +{ + public: + + enum Side { Left, Right }; + + ResizeSide(QWidget * parent, Manager * client, Side); + void updateDisplay(); + + protected: + + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + + private: + + Manager * client_; + Side side_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Static.cpp b/clients/riscos/Static.cpp new file mode 100644 index 0000000000..97083fb15d --- /dev/null +++ b/clients/riscos/Static.cpp @@ -0,0 +1,618 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "../../options.h" + +#include "Static.h" +#include "Utils.h" + +namespace RiscOS +{ + + void +Static::_drawButtonBorder(QPixmap & pix) +{ + _drawBorder(pix, 17, 17); +} + + void +Static::_drawBorder(QPixmap & pix, int w, int h) +{ +// 0111111113 +// 1022222235 +// 12 46 +// 12 46 +// 12 46 +// 1344444476 +// 3566666667 + + painter_.begin(&pix); + painter_.translate(transx, transy); + + QColor c0 = down_ ? palette_[7] : palette_[0]; + QColor c1 = down_ ? palette_[6] : palette_[1]; + QColor c2 = down_ ? palette_[5] : palette_[2]; + QColor c3 = down_ ? palette_[4] : palette_[3]; + QColor c4 = down_ ? palette_[3] : palette_[4]; + QColor c5 = down_ ? palette_[2] : palette_[5]; + QColor c6 = down_ ? palette_[2] : palette_[6]; + QColor 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(); +} + + QPixmap +recolour(const QImage & inputImage, const Palette & newPalette) +{ + QImage image(inputImage); + Palette & standard = Static::instance()->standardPalette(); + + int ncols = image.numColors(); + + QRgb r; + + for (int i = 0; i < ncols; i++) { + + r = image.color(i); + + for (int c = 0; c < 8; c++) { + + if (r == standard[c]) + { + image.setColor(i, newPalette[c]); + continue; + } + } + } + + QPixmap output; + output.convertFromImage(image); + return output; +} + + void +Static::_drawCloseSymbol(QPixmap & pixmap) +{ + painter_.begin(&pixmap); + painter_.translate(transx, transy); + + painter_.setPen(QColor(palette_[1])); + painter_.drawLine(2, 0, 11, 9); + painter_.drawLine(0, 2, 9, 11); + + painter_.drawLine(0, 9, 9, 0); + painter_.drawLine(2, 11, 11, 2); + + painter_.drawPoint(0, 1); + painter_.drawPoint(1, 0); + painter_.drawPoint(10, 0); + painter_.drawPoint(11, 1); + painter_.drawPoint(0, 10); + painter_.drawPoint(1, 11); + painter_.drawPoint(10, 11); + painter_.drawPoint(11, 10); + + painter_.setPen(QColor(palette_[6])); + painter_.drawLine(1, 2, 9, 10); + painter_.drawLine(1, 1, 10, 10); + painter_.drawLine(2, 1, 10, 9); + + painter_.drawLine(1, 9, 9, 1); + painter_.drawLine(1, 10, 10, 1); + painter_.drawLine(2, 10, 10, 2); + + painter_.end(); +} + + void +Static::_drawIconifySymbol(QPixmap & pixmap) +{ + painter_.begin(&pixmap); + painter_.translate(transx, transy); + + painter_.setPen(QColor(palette_[1])); + painter_.drawRect(1, 4, 10, 4); + + painter_.setPen(QColor(palette_[3])); + painter_.drawPoint(1, 4); + painter_.drawPoint(1, 7); + painter_.drawPoint(10, 4); + painter_.drawPoint(10, 7); + + painter_.setPen(QColor(palette_[6])); + painter_.drawLine(2, 5, 9, 5); + painter_.drawLine(2, 6, 9, 6); + + painter_.end(); +} + + void +Static::_drawLowerSymbol(QPixmap & pixmap) +{ + painter_.begin(&pixmap); + painter_.translate(transx, transy); + + painter_.fillRect(1, 1, 6, 6, QColor(palette_[6])); + painter_.fillRect(5, 5, 6, 6, QColor(palette_[6])); + + painter_.setPen(QColor(palette_[1])); + painter_.drawRect(0, 0, 8, 8); + painter_.drawRect(4, 4, 8, 8); + + painter_.setPen(QColor(palette_[3])); + painter_.drawPoint(0, 0); + painter_.drawPoint(7, 0); + painter_.drawPoint(0, 7); + painter_.drawPoint(3, 7); + painter_.drawPoint(7, 3); + painter_.drawPoint(4, 4); + painter_.drawPoint(11, 4); + painter_.drawPoint(4, 11); + painter_.drawPoint(11, 11); + + painter_.setPen(QColor(palette_[5])); + painter_.drawPoint(5, 7); + painter_.drawPoint(7, 5); + + painter_.setPen(QColor(palette_[4])); + painter_.drawPoint(7, 6); + painter_.drawPoint(7, 7); + painter_.drawPoint(6, 7); + + painter_.end(); +} + + void +Static::_drawMaxSymbol(QPixmap & pixmap) +{ + painter_.begin(&pixmap); + painter_.translate(transx, transy); + + painter_.setPen(QColor(palette_[1])); + painter_.drawRect(2, 2, 8, 8); + + painter_.setPen(QColor(palette_[3])); + painter_.drawPoint(2, 2); + painter_.drawPoint(2, 9); + painter_.drawPoint(9, 9); + painter_.drawPoint(9, 2); + + painter_.fillRect(3, 3, 6, 6, QColor(palette_[6])); + + painter_.end(); +} + + void +Static::_drawUnmaxSymbol(QPixmap & pixmap) +{ + painter_.begin(&pixmap); + painter_.translate(transx, transy); + + painter_.setPen(QColor(palette_[1])); + painter_.drawRect(0, 0, 11, 11); + + painter_.setPen(QColor(palette_[3])); + painter_.drawPoint(0, 0); + painter_.drawPoint(0, 11); + painter_.drawPoint(11, 0); + painter_.drawPoint(11, 11); + + painter_.fillRect(1, 1, 10, 10, QColor(palette_[6])); + + painter_.end(); +} + + void +setPalette(Palette & pal, QColor c) +{ + pal[0] = c.light(200).rgb(); + pal[1] = c.light(166).rgb(); + pal[2] = c.light(125).rgb(); + pal[3] = c.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 +setInversePalette(Palette & pal, QColor c) +{ + pal[7] = c.light(200).rgb(); + pal[6] = c.light(166).rgb(); + pal[5] = c.light(125).rgb(); + pal[4] = c.rgb(); + pal[3] = c.dark(133).rgb(); + pal[2] = c.dark(166).rgb(); + pal[1] = c.dark(200).rgb(); + pal[0] = c.dark(300).rgb(); +} + +Static * Static::instance_ = 0L; + + void +Static::_init() +{ + buttonPixmaps_.append(&aIconify_); + buttonPixmaps_.append(&aClose_); + buttonPixmaps_.append(&aLower_); + buttonPixmaps_.append(&aMax_); + buttonPixmaps_.append(&aUnmax_); + buttonPixmaps_.append(&iIconify_); + buttonPixmaps_.append(&iClose_); + buttonPixmaps_.append(&iLower_); + buttonPixmaps_.append(&iMax_); + buttonPixmaps_.append(&iUnmax_); + buttonPixmaps_.append(&aIconifyDown_); + buttonPixmaps_.append(&aCloseDown_); + buttonPixmaps_.append(&aLowerDown_); + buttonPixmaps_.append(&aMaxDown_); + buttonPixmaps_.append(&aUnmaxDown_); + buttonPixmaps_.append(&iIconifyDown_); + buttonPixmaps_.append(&iCloseDown_); + buttonPixmaps_.append(&iLowerDown_); + buttonPixmaps_.append(&iMaxDown_); + buttonPixmaps_.append(&iUnmaxDown_); + + for (QListIterator it(buttonPixmaps_); it.current(); ++it) { + + it.current()->setOptimization(QPixmap::MemoryOptim); + it.current()->resize(19, 20); + it.current()->fill(Qt::black); + } + + aResize_.setOptimization(QPixmap::MemoryOptim); + iResize_.setOptimization(QPixmap::MemoryOptim); + aResize_.resize(30, 10); + iResize_.resize(30, 10); + aResize_.fill(Qt::black); + iResize_.fill(Qt::black); + + aTitleTextLeft_.resize(3, 20); + aTitleTextRight_.resize(3, 20); + aTitleTextLeft_.fill(Qt::black); + aTitleTextRight_.fill(Qt::black); + + iTitleTextLeft_.resize(3, 20); + iTitleTextRight_.resize(3, 20); + iTitleTextLeft_.fill(Qt::black); + iTitleTextRight_.fill(Qt::black); + + aTitleTextMid_.resize(128, 20); + iTitleTextMid_.resize(128, 20); + aTitleTextMid_.fill(Qt::black); + iTitleTextMid_.fill(Qt::black); + + aResizeMidLeft_.resize(3, 12); + aResizeMidRight_.resize(3, 12); + aResizeMidLeft_.fill(Qt::black); + aResizeMidRight_.fill(Qt::black); + iResizeMidLeft_.resize(3, 12); + iResizeMidRight_.resize(3, 12); + iResizeMidLeft_.fill(Qt::black); + iResizeMidRight_.fill(Qt::black); + + aResizeMid_.resize(128, 10); + iResizeMid_.resize(128, 10); + aResizeMid_.fill(Qt::black); + iResizeMid_.fill(Qt::black); + + update(); +} + + void +Static::update() +{ + // ------------------------------------------------------------------------- + // Palettes + // ------------------------------------------------------------------------- + + Palette aBut, iBut; + Palette aSym, iSym; + + if (QPixmap::defaultDepth() > 8) { + + setPalette(aBut, options->color(Options::ButtonBg, true)); + setPalette(iBut, options->color(Options::ButtonBg, false)); + + setInversePalette(aSym, options->color(Options::ButtonFg, true)); + setInversePalette(iSym, options->color(Options::ButtonFg, false)); + + setPalette(aTitlePal_, options->color(Options::TitleBar, true)); + setPalette(iTitlePal_, options->color(Options::TitleBar, false)); + + setPalette(aResizePal_, options->color(Options::Handle, true)); + setPalette(iResizePal_, options->color(Options::Handle, false)); + } + + // ------------------------------------------------------------------------- + // Bevels + // ------------------------------------------------------------------------- + + transx = transy = 0.0; + + // Create sides of title text area and resize bar middle. + + QPixmap temp(4, 20); + temp.fill(Qt::black); + palette_ = aTitlePal_; + down_ = false; + + _drawBorder(temp, 4, 18); + + painter_.begin(&aTitleTextLeft_); + painter_.drawPixmap(1, 1, temp, 0, 1); + painter_.end(); + + painter_.begin(&aTitleTextRight_); + painter_.drawPixmap(0, 1, temp, 2, 1); + painter_.end(); + + palette_ = iTitlePal_; + _drawBorder(temp, 4, 18); + + painter_.begin(&iTitleTextLeft_); + painter_.drawPixmap(1, 1, temp, 0, 1); + painter_.end(); + + painter_.begin(&iTitleTextRight_); + painter_.drawPixmap(0, 1, temp, 2, 1); + painter_.end(); + + transy = 1.0; + + palette_ = aResizePal_; + temp.resize(4, 10); + temp.fill(Qt::black); + _drawBorder(temp, 4, 7); + + painter_.begin(&aResizeMidLeft_); + painter_.drawPixmap(0, 1, temp, 0, 1); + painter_.end(); + + painter_.begin(&aResizeMidRight_); + painter_.drawPixmap(0, 1, temp, 2, 1); + painter_.end(); + + palette_ = iResizePal_; + _drawBorder(temp, 4, 7); + + painter_.begin(&iResizeMidLeft_); + painter_.drawPixmap(0, 1, temp, 0, 1); + painter_.end(); + + painter_.begin(&iResizeMidRight_); + painter_.drawPixmap(0, 1, temp, 2, 1); + painter_.end(); + + transx = transy = 0.0; + + temp.resize(132, 20); + + temp.fill(Qt::black); + + palette_ = aTitlePal_; + _drawBorder(temp, 132, 17); + + painter_.begin(&aTitleTextMid_); + painter_.drawPixmap(0, 1, temp, 2, 0); + painter_.end(); + + palette_ = iTitlePal_; + _drawBorder(temp, 132, 17); + + painter_.begin(&iTitleTextMid_); + painter_.drawPixmap(0, 1, temp, 2, 0); + painter_.end(); + + transy = 1.0; + + temp.fill(Qt::black); + + palette_ = aResizePal_; + _drawBorder(temp, 132, 7); + + painter_.begin(&aResizeMid_); + painter_.drawPixmap(0, 0, temp, 2, 0); + painter_.end(); + + palette_ = iResizePal_; + _drawBorder(temp, 132, 7); + + painter_.begin(&iResizeMid_); + painter_.drawPixmap(0, 0, temp, 2, 0); + painter_.end(); + + down_ = false; + + palette_ = aBut; + transx = transy = 1.0; + _drawButtonBorder(aClose_); + _drawButtonBorder(aLower_); + transx = 0.0; + _drawButtonBorder(aIconify_); + _drawButtonBorder(aMax_); + _drawButtonBorder(aUnmax_); + + palette_ = iBut; + transx = transy = 1.0; + _drawButtonBorder(iClose_); + _drawButtonBorder(iLower_); + transx = 0.0; + _drawButtonBorder(iIconify_); + _drawButtonBorder(iMax_); + _drawButtonBorder(iUnmax_); + + down_ = true; + + palette_ = aBut; + transx = transy = 1.0; + _drawButtonBorder(aCloseDown_); + _drawButtonBorder(aLowerDown_); + transx = 0.0; + _drawButtonBorder(aIconifyDown_); + _drawButtonBorder(aMaxDown_); + _drawButtonBorder(aUnmaxDown_); + + palette_ = iBut; + transx = transy = 1.0; + _drawButtonBorder(iCloseDown_); + _drawButtonBorder(iLowerDown_); + transx = 0.0; + _drawButtonBorder(iIconifyDown_); + _drawButtonBorder(iMaxDown_); + _drawButtonBorder(iUnmaxDown_); + + // ------------------------------------------------------------------------- + // Button symbols + // ------------------------------------------------------------------------- + + transy = 4.0; + + palette_ = aSym; + + transx = 4.0; + _drawCloseSymbol (aClose_); + _drawLowerSymbol (aLower_); + transx = 3.0; + _drawIconifySymbol (aIconify_); + _drawMaxSymbol (aMax_); + _drawUnmaxSymbol (aUnmax_); + + transx = 4.0; + _drawCloseSymbol (aCloseDown_); + _drawLowerSymbol (aLowerDown_); + transx = 3.0; + _drawIconifySymbol (aIconifyDown_); + _drawMaxSymbol (aMaxDown_); + _drawUnmaxSymbol (aUnmaxDown_); + + palette_ = iSym; + + transx = 4.0; + _drawCloseSymbol (iClose_); + _drawLowerSymbol (iLower_); + transx = 3.0; + _drawIconifySymbol (iIconify_); + _drawMaxSymbol (iMax_); + _drawUnmaxSymbol (iUnmax_); + + transx = 4.0; + _drawCloseSymbol (iCloseDown_); + _drawLowerSymbol (iLowerDown_); + transx = 3.0; + _drawIconifySymbol (iIconifyDown_); + _drawMaxSymbol (iMaxDown_); + _drawUnmaxSymbol (iUnmaxDown_); + + // ------------------------------------------------------------------------- + // Resize handles + // ------------------------------------------------------------------------- + + transx = transy = 1.0; + + down_ = false; + + palette_ = aResizePal_; + _drawBorder(aResize_, 28, 7); + + palette_ = iResizePal_; + _drawBorder(iResize_, 28, 7); +} + + QPixmap +Static::button(SymbolType t, bool active, bool down) +{ + QPixmap p(19, 20); + + if (down) { + + switch (t) { + + case Iconify: p = active ? aIconifyDown_ : iIconifyDown_; break; + case Close: p = active ? aCloseDown_ : iCloseDown_; break; + case Lower: p = active ? aLowerDown_ : iLowerDown_; break; + case Max: p = active ? aMaxDown_ : iMaxDown_; break; + case Unmax: p = active ? aUnmaxDown_ : iUnmaxDown_; break; + default: break; + } + + } else { + + switch (t) { + + case Iconify: p = active ? aIconify_ : iIconify_; break; + case Close: p = active ? aClose_ : iClose_; break; + case Lower: p = active ? aLower_ : iLower_; break; + case Max: p = active ? aMax_ : iMax_; break; + case Unmax: p = active ? aUnmax_ : iUnmax_; break; + default: break; + } + + } + + return p; +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 + diff --git a/clients/riscos/Static.h b/clients/riscos/Static.h new file mode 100644 index 0000000000..d5c4081804 --- /dev/null +++ b/clients/riscos/Static.h @@ -0,0 +1,129 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_STATIC_H +#define RISC_OS_STATIC_H + +#include +#include +#include + +#include "Palette.h" + +namespace RiscOS +{ + +enum SymbolType { Lower, Close, Iconify, Max, Unmax }; + +class Static +{ + + public: + + Static() + { + instance_ = this; + _init(); + } + + ~Static() + { + instance_ = 0L; + } + + static Static * instance() + { + if (0 == instance_) + new Static; + + return instance_; + } + + void update(); + + QPixmap titleTextLeft(bool active) + { return active ? aTitleTextLeft_ : iTitleTextLeft_; } + + QPixmap titleTextRight(bool active) + { return active ? aTitleTextRight_ : iTitleTextRight_; } + + QPixmap resizeMidLeft(bool active) + { return active ? aResizeMidLeft_ : iResizeMidLeft_; } + + QPixmap resizeMidRight(bool active) + { return active ? aResizeMidRight_ : iResizeMidRight_; } + + QPixmap titleTextMid(bool active) + { return active ? aTitleTextMid_ : iTitleTextMid_; } + + QPixmap resizeMidMid(bool active) + { return active ? aResizeMid_ : iResizeMid_; } + + QPixmap button(SymbolType t, bool active, bool down); + + QPixmap resize(bool active) + { return active ? aResize_ : iResize_; } + + Palette & standardPalette() + { return standardPal_; } + + private: + + void _drawButtonBorder(QPixmap &); + void _drawBorder(QPixmap &, int w, int h); + void _init(); + void _drawCloseSymbol(QPixmap & pixmap); + void _drawIconifySymbol(QPixmap & pixmap); + void _drawLowerSymbol(QPixmap & pixmap); + void _drawMaxSymbol(QPixmap & pixmap); + void _drawUnmaxSymbol(QPixmap & pixmap); + + static Static * instance_; + + Palette standardPal_, aTitlePal_, iTitlePal_, aResizePal_, iResizePal_; + + QPixmap aIconify_, aClose_, aLower_, aMax_, aUnmax_, + iIconify_, iClose_, iLower_, iMax_, iUnmax_, + aResize_, iResize_, + aIconifyDown_, aCloseDown_, aLowerDown_, aMaxDown_, aUnmaxDown_, + iIconifyDown_, iCloseDown_, iLowerDown_, iMaxDown_, iUnmaxDown_, + aResizeDown_, iResizeDown_, + aTitleTextLeft_, aTitleTextRight_, + aResizeMidLeft_, aResizeMidRight_, + iTitleTextLeft_, iTitleTextRight_, + iResizeMidLeft_, iResizeMidRight_, + aTitleTextMid_, iTitleTextMid_, + aResizeMid_, iResizeMid_; + + QList buttonPixmaps_; + + QPainter painter_; + bool down_; + Palette palette_; + double transx, transy; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/TitleBar.cpp b/clients/riscos/TitleBar.cpp new file mode 100644 index 0000000000..35221a1032 --- /dev/null +++ b/clients/riscos/TitleBar.cpp @@ -0,0 +1,93 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include "Manager.h" +#include "TitleBar.h" +#include "TitleText.h" +#include "CloseButton.h" +#include "IconifyButton.h" +#include "LowerButton.h" +#include "MaximiseButton.h" + +namespace RiscOS +{ + +TitleBar::TitleBar(QWidget * parent, Manager * client) + : QWidget(parent), + client_(client) +{ + setBackgroundMode(NoBackground); + setFixedHeight(20); + + lower_ = new LowerButton (this, client_); + close_ = new CloseButton (this, client_); + text_ = new TitleText (this, client_); + iconify_ = new IconifyButton (this, client_); + maximise_ = new MaximiseButton (this, client_); + + lower_ ->setAlign(Button::Left); + close_ ->setAlign(Button::Left); + iconify_ ->setAlign(Button::Right); + maximise_ ->setAlign(Button::Right); + + // Lower | Close | Text | Iconify | Maximise + + QHBoxLayout * layout = new QHBoxLayout(this); + + layout->addWidget(lower_); + layout->addWidget(close_); + layout->addWidget(text_, 1); + layout->addWidget(iconify_); + layout->addWidget(maximise_); +} + + void +TitleBar::updateDisplay() +{ + lower_ ->updateDisplay(); + close_ ->updateDisplay(); + text_ ->updateDisplay(); + iconify_ ->updateDisplay(); + maximise_ ->updateDisplay(); +} + + void +TitleBar::updateMaximise(bool b) +{ + maximise_->setOn(b); +} + + void +TitleBar::updateText() +{ + text_->updateDisplay(); +} + +TitleBar::~TitleBar() +{ +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/TitleBar.h b/clients/riscos/TitleBar.h new file mode 100644 index 0000000000..2d8ec09d9c --- /dev/null +++ b/clients/riscos/TitleBar.h @@ -0,0 +1,66 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_TITLE_BAR_H +#define RISC_OS_TITLE_BAR_H + +#include + +namespace RiscOS +{ + +class Manager; +class LowerButton; +class CloseButton; +class TitleText; +class IconifyButton; +class MaximiseButton; + +class TitleBar : public QWidget +{ + public: + + TitleBar(QWidget * parent, Manager * client); + virtual ~TitleBar(); + + void updateDisplay(); + void updateText(); + void updateMaximise(bool); + + private: + + LowerButton * lower_; + CloseButton * close_; + + TitleText * text_; + + IconifyButton * iconify_; + MaximiseButton * maximise_; + + Manager * client_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/TitleText.cpp b/clients/riscos/TitleText.cpp new file mode 100644 index 0000000000..83e59d9202 --- /dev/null +++ b/clients/riscos/TitleText.cpp @@ -0,0 +1,113 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include "../../options.h" +#include "../../workspace.h" + +#include "TitleText.h" +#include "Manager.h" +#include "Static.h" +#include "Utils.h" + +namespace RiscOS +{ + +TitleText::TitleText(QWidget * parent, Manager * client) + : DBWidget(parent, "TitleText"), + client_(client) +{ + setFixedHeight(20); + updatePixmap(); +} + +TitleText::~TitleText() +{ +} + + void +TitleText::updatePixmap() +{ + QPainter p(&buf()); + + p.drawPixmap(0, 0, Static::instance()->titleTextLeft(client_->isActive())); + p.drawPixmap(width() - 3, 0, Static::instance()->titleTextRight(client_->isActive())); + p.drawTiledPixmap(3, 0, width() - 6, 20, Static::instance()->titleTextMid(client_->isActive())); + + p.setPen(options->color(Options::Font, client_->isActive())); + p.setFont(options->font()); + p.drawText(4, 0, width() - 8, 18, AlignCenter, client_->caption()); +} + + void +TitleText::mousePressEvent(QMouseEvent * e) +{ + switch (e->button()) { + + case MidButton: + client_->workspace()->clientPopup(client_)->popup(e->globalPos()); + break; + + case LeftButton: + client_->workspace()->raiseClient(client_); + client_->workspace()->requestFocus(client_); + + case RightButton: + + clientPosToMousePos_ = e->globalPos() - client_->pos(); + break; + + default: + break; + } +} + + void +TitleText::mouseReleaseEvent(QMouseEvent *) +{ + // Anything to do ? +} + + void +TitleText::mouseMoveEvent(QMouseEvent * e) +{ + // Need to be a little clever here. + + QPoint adjustedForCursor = e->globalPos() - clientPosToMousePos_; + + QPoint adjustedForSnap = + client_->workspace()->adjustClientPosition(client_, adjustedForCursor); + + client_->move(adjustedForSnap); +} + + void +TitleText::mouseDoubleClickEvent(QMouseEvent *) +{ + client_->setShade(!client_->isShade()); +} + +} // End namespace + +// vim:ts=2:sw=2:tw=78 + diff --git a/clients/riscos/TitleText.h b/clients/riscos/TitleText.h new file mode 100644 index 0000000000..db3e8d477a --- /dev/null +++ b/clients/riscos/TitleText.h @@ -0,0 +1,63 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_TITLE_TEXT_H +#define RISC_OS_TITLE_TEXT_H + +#include +#include + +#include "DBWidget.h" + +namespace RiscOS +{ + +class Manager; + +class TitleText : public DBWidget +{ + public: + + TitleText(QWidget * parent, Manager * client); + virtual ~TitleText(); + + protected: + + void updatePixmap(); + + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseDoubleClickEvent(QMouseEvent *); + + private: + + Manager * client_; + + QPoint clientPosToMousePos_; +}; + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Utils.cpp b/clients/riscos/Utils.cpp new file mode 100644 index 0000000000..781a7ba7ca --- /dev/null +++ b/clients/riscos/Utils.cpp @@ -0,0 +1,36 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include + +#include "../../options.h" + +#include "Utils.h" +#include "Static.h" + +namespace RiscOS +{ + +} // End namespace + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Utils.h b/clients/riscos/Utils.h new file mode 100644 index 0000000000..59a36f474e --- /dev/null +++ b/clients/riscos/Utils.h @@ -0,0 +1,47 @@ +/* + RISC OS KWin client + + Copyright 2000 + Rik Hemsley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef RISC_OS_UTILS_H +#define RISC_OS_UTILS_H + +#include +#include + +#include "Palette.h" + +namespace RiscOS { + +void drawBorder( + QPixmap & pix, + int x, int y, + int w, int h, + const Palette & pal, + bool down = false +); + +QPixmap recolour(const QImage &, const Palette &); + +} // End namespace + +#endif + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/button_base_down.xpm b/clients/riscos/button_base_down.xpm deleted file mode 100644 index a4ba10fc58..0000000000 --- a/clients/riscos/button_base_down.xpm +++ /dev/null @@ -1,28 +0,0 @@ -/* XPM */ -static char * button_base_down_xpm[] = { -"18 18 7 1", -" c None", -". c #A0A0A0", -"+ c #FFFFFF", -"@ c #585858", -"# c #808080", -"$ c #DCDCDC", -"% c #C3C3C3", -"@@@@@@@@@@@@@@@@#%", -"@###############%+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"@#..............$+", -"#%$$$$$$$$$$$$$$$+", -"%+++++++++++++++++"}; diff --git a/clients/riscos/button_base_down_active.xpm b/clients/riscos/button_base_down_active.xpm deleted file mode 100644 index 45d5e26d95..0000000000 --- a/clients/riscos/button_base_down_active.xpm +++ /dev/null @@ -1,29 +0,0 @@ -/* XPM */ -static char * button_base_down_active_xpm[] = { -"18 18 8 1", -" c None", -". c #000000", -"+ c #303030", -"@ c #585858", -"# c #C3C3C3", -"$ c #808080", -"% c #DCDCDC", -"& c #FFFFFF", -".+++++++++++++++@#", -"+@@@@@@@@@@@@@@@$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"+@..............$%", -"@$$$$$$$$$$$$$$$#%", -"#%%%%%%%%%%%%%%%%&"}; diff --git a/clients/riscos/button_base_up.xpm b/clients/riscos/button_base_up.xpm deleted file mode 100644 index 33fc9612c9..0000000000 --- a/clients/riscos/button_base_up.xpm +++ /dev/null @@ -1,28 +0,0 @@ -/* XPM */ -static char * button_base_up_xpm[] = { -"18 18 7 1", -" c None", -". c #C3C3C3", -"+ c #FFFFFF", -"@ c #585858", -"# c #A0A0A0", -"$ c #DCDCDC", -"% c #808080", -"+++++++++++++++++.", -"+$$$$$$$$$$$$$$$.%", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+$..............#@", -"+.###############@", -".%@@@@@@@@@@@@@@@@"}; diff --git a/clients/riscos/button_base_up_active.xpm b/clients/riscos/button_base_up_active.xpm deleted file mode 100644 index 96cbc8440f..0000000000 --- a/clients/riscos/button_base_up_active.xpm +++ /dev/null @@ -1,29 +0,0 @@ -/* XPM */ -static char * button_base_up_active_xpm[] = { -"18 18 8 1", -" c None", -". c #FFFFFF", -"+ c #DCDCDC", -"@ c #C3C3C3", -"# c #808080", -"$ c #585858", -"% c #000000", -"& c #303030", -".++++++++++++++++@", -"+@###############$", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#%%%%%%%%%%%%%%$&", -"+#$$$$$$$$$$$$$$$&", -"@$&&&&&&&&&&&&&&&%"}; diff --git a/clients/riscos/button_close.xpm b/clients/riscos/button_close.xpm deleted file mode 100644 index 85a7f38154..0000000000 --- a/clients/riscos/button_close.xpm +++ /dev/null @@ -1,18 +0,0 @@ -/* XPM */ -static char * button_close_xpm[] = { -"12 12 3 1", -" c None", -". c #585858", -"+ c #DCDCDC", -" .. .. ", -".++. .++.", -".+++. .+++.", -" .+++..+++. ", -" .++++++. ", -" .++++. ", -" .++++. ", -" .++++++. ", -" .+++..+++. ", -".+++. .+++.", -".++. .++.", -" .. .. "}; diff --git a/clients/riscos/button_close_active.xpm b/clients/riscos/button_close_active.xpm deleted file mode 100644 index 1544ade215..0000000000 --- a/clients/riscos/button_close_active.xpm +++ /dev/null @@ -1,19 +0,0 @@ -/* XPM */ -static char * button_close_active_xpm[] = { -"12 12 4 1", -" c None", -". c #585858", -"+ c #FFFFFF", -"@ c #303030", -".++. .++.", -"+..+. .+..+", -"+...+@@+...+", -".+...++...+.", -" .+......+. ", -" @+....+@ ", -" @+....+@ ", -" .+......+. ", -".+...++...+.", -"+...+@@+...+", -"+..+. .+..+", -".++. .++."}; diff --git a/clients/riscos/button_iconify.xpm b/clients/riscos/button_iconify.xpm deleted file mode 100644 index ceb8056e55..0000000000 --- a/clients/riscos/button_iconify.xpm +++ /dev/null @@ -1,19 +0,0 @@ -/* XPM */ -static char * button_iconify_xpm[] = { -"12 12 4 1", -" c None", -". c #808080", -"+ c #585858", -"@ c #DCDCDC", -" ", -" ", -" ", -" ", -" .++++++++. ", -" +@@@@@@@@+ ", -" +@@@@@@@@+ ", -" .++++++++. ", -" ", -" ", -" ", -" "}; diff --git a/clients/riscos/button_iconify_active.xpm b/clients/riscos/button_iconify_active.xpm deleted file mode 100644 index 641e87cc9b..0000000000 --- a/clients/riscos/button_iconify_active.xpm +++ /dev/null @@ -1,19 +0,0 @@ -/* XPM */ -static char * button_iconify_active_xpm[] = { -"12 12 4 1", -" c None", -". c #A0A0A0", -"+ c #FFFFFF", -"@ c #585858", -" ", -" ", -" ", -" ", -" .++++++++. ", -" +@@@@@@@@+ ", -" +@@@@@@@@+ ", -" .++++++++. ", -" ", -" ", -" ", -" "}; diff --git a/clients/riscos/button_lower.xpm b/clients/riscos/button_lower.xpm deleted file mode 100644 index 05c7e8a400..0000000000 --- a/clients/riscos/button_lower.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static char * button_lower_xpm[] = { -"12 12 7 1", -" c None", -". c #585858", -"+ c #FFFFFF", -"@ c #808080", -"# c #C3C3C3", -"$ c #DCDCDC", -"% c #A0A0A0", -"@......@ ", -".++++++. ", -".++++++. ", -".++++++@ ", -".+++@......@", -".+++.$$#$$$.", -".+++.$$%$$$.", -"@..@.#%%$$$.", -" .$$$$$$.", -" .$$$$$$.", -" .$$$$$$.", -" @......@"}; diff --git a/clients/riscos/button_lower_active.xpm b/clients/riscos/button_lower_active.xpm deleted file mode 100644 index cc71b15395..0000000000 --- a/clients/riscos/button_lower_active.xpm +++ /dev/null @@ -1,20 +0,0 @@ -/* XPM */ -static char * button_lower_active_xpm[] = { -"12 12 5 1", -" c None", -". c #A0A0A0", -"+ c #FFFFFF", -"@ c #808080", -"# c #585858", -".++++++. ", -"+@@@@@@+ ", -"+@@@@@@+ ", -"+@@@@@@. ", -"+@@@.++++++.", -"+@@@+##@###+", -"+@@@+##.###+", -".++.+@..###+", -" +######+", -" +######+", -" +######+", -" .++++++."}; diff --git a/clients/riscos/button_max.xpm b/clients/riscos/button_max.xpm deleted file mode 100644 index ffefe1fdfc..0000000000 --- a/clients/riscos/button_max.xpm +++ /dev/null @@ -1,19 +0,0 @@ -/* XPM */ -static char * button_max_xpm[] = { -"12 12 4 1", -" c None", -". c #DCDCDC", -"+ c #585858", -"@ c #808080", -" ", -" ", -" @++++++@ ", -" +......+ ", -" +......+ ", -" +......+ ", -" +......+ ", -" +......+ ", -" +......+ ", -" @++++++@ ", -" ", -" "}; diff --git a/clients/riscos/button_max_active.xpm b/clients/riscos/button_max_active.xpm deleted file mode 100644 index 628767e611..0000000000 --- a/clients/riscos/button_max_active.xpm +++ /dev/null @@ -1,19 +0,0 @@ -/* XPM */ -static char * button_max_active_xpm[] = { -"12 12 4 1", -" c None", -". c #A0A0A0", -"+ c #FFFFFF", -"@ c #585858", -" ", -" ", -" .++++++. ", -" +@@@@@@+ ", -" +@@@@@@+ ", -" +@@@@@@+ ", -" +@@@@@@+ ", -" +@@@@@@+ ", -" +@@@@@@+ ", -" .++++++. ", -" ", -" "}; diff --git a/clients/riscos/button_unmax.xpm b/clients/riscos/button_unmax.xpm deleted file mode 100644 index 6897666b0d..0000000000 --- a/clients/riscos/button_unmax.xpm +++ /dev/null @@ -1,20 +0,0 @@ -/* XPM */ -static char * button_unmax_xpm[] = { -"12 12 5 1", -" c None", -". c #808080", -"+ c #585858", -"@ c #C3C3C3", -"# c #DCDCDC", -".++++++++++.", -"+@########@+", -"+##########+", -"+##########+", -"+##########+", -"+##########+", -"+##########+", -"+##########+", -"+##########+", -"+##########+", -"+@########@+", -".++++++++++."}; diff --git a/clients/riscos/button_unmax_active.xpm b/clients/riscos/button_unmax_active.xpm deleted file mode 100644 index 64ce4e4282..0000000000 --- a/clients/riscos/button_unmax_active.xpm +++ /dev/null @@ -1,19 +0,0 @@ -/* XPM */ -static char * button_unmax_active_xpm[] = { -"12 12 4 1", -" c None", -". c #A0A0A0", -"+ c #FFFFFF", -"@ c #585858", -".++++++++++.", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -"+@@@@@@@@@@+", -".++++++++++."}; diff --git a/clients/riscos/resize.xpm b/clients/riscos/resize.xpm deleted file mode 100644 index a1ba2d2f9b..0000000000 --- a/clients/riscos/resize.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static char * resize_xpm[] = { -"12 12 6 1", -" c None", -". c #DCDCDC", -"+ c #585858", -"@ c #FFFFFF", -"# c #808080", -"$ c #C3C3C3", -"#++++++++++#", -"+.@@.#$...$+", -"+@@@@+.....+", -"+@@@@+.....+", -"+.@@.+.....+", -"+#++++.....+", -"+$.........+", -"+..........+", -"+..........+", -"+..........+", -"+$........$+", -"#++++++++++#"}; diff --git a/clients/riscos/resize_bar_left.xpm b/clients/riscos/resize_bar_left.xpm deleted file mode 100644 index 891dab11e4..0000000000 --- a/clients/riscos/resize_bar_left.xpm +++ /dev/null @@ -1,15 +0,0 @@ -/* XPM */ -static char * resize_bar_left_xpm[] = { -"2 7 5 1", -" c None", -". c #FFFFFF", -"+ c #DCDCDC", -"@ c #C3C3C3", -"# c #808080", -"..", -".+", -".+", -".+", -".+", -".@", -"@#"}; diff --git a/clients/riscos/resize_bar_mid.xpm b/clients/riscos/resize_bar_mid.xpm deleted file mode 100644 index 7d3547e379..0000000000 --- a/clients/riscos/resize_bar_mid.xpm +++ /dev/null @@ -1,16 +0,0 @@ -/* XPM */ -static char * resize_bar_mid_xpm[] = { -"25 7 6 1", -" c None", -". c #C3C3C3", -"+ c #585858", -"@ c #A0A0A0", -"# c #DCDCDC", -"$ c #FFFFFF", -"$$$$$$$$$$$$$$$$$$$$$$$$$", -"#########################", -".........................", -".........................", -".........................", -"@@@@@@@@@@@@@@@@@@@@@@@@@", -"+++++++++++++++++++++++++"}; diff --git a/clients/riscos/resize_bar_right.xpm b/clients/riscos/resize_bar_right.xpm deleted file mode 100644 index 3d78421294..0000000000 --- a/clients/riscos/resize_bar_right.xpm +++ /dev/null @@ -1,16 +0,0 @@ -/* XPM */ -static char * resize_bar_right_xpm[] = { -"2 7 6 1", -" c None", -". c #585858", -"+ c #A0A0A0", -"@ c #C3C3C3", -"# c #808080", -"$ c #FFFFFF", -"$@", -"@#", -"+.", -"+.", -"+.", -"+.", -".."}; diff --git a/clients/riscos/riscosclient.cpp b/clients/riscos/riscosclient.cpp deleted file mode 100644 index c224d69644..0000000000 --- a/clients/riscos/riscosclient.cpp +++ /dev/null @@ -1,719 +0,0 @@ -/* - RISC OS KWin client - - Copyright 2000 - Rik Hemsley - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -// Qt includes -#include -#include -#include - -// Local includes -#include "../../options.h" -#include "../../workspace.h" -#include "riscosclient.h" - -#include "title_inactive_left.xpm" -#include "title_inactive.xpm" -#include "title_inactive_right.xpm" -#include "title_active_left.xpm" -#include "title_active.xpm" -#include "title_active_right.xpm" -#include "resize_bar_left.xpm" -#include "resize_bar_mid.xpm" -#include "resize_bar_right.xpm" -#include "button_base_up.xpm" -#include "button_base_down.xpm" -#include "button_base_up_active.xpm" -#include "button_base_down_active.xpm" -#include "button_close.xpm" -#include "button_unmax.xpm" -#include "button_max.xpm" -#include "button_lower.xpm" -#include "button_iconify.xpm" -#include "button_close_active.xpm" -#include "button_unmax_active.xpm" -#include "button_max_active.xpm" -#include "button_lower_active.xpm" -#include "button_iconify_active.xpm" - -#include - -extern "C" -{ - Client * allocate(Workspace * workSpace, WId winId) - { - return new RiscOS::Manager(workSpace, winId); - } -} - -using namespace RiscOS; - -QPixmap * px_button_base_up = 0L; -QPixmap * px_button_base_down = 0L; -QPixmap * px_button_base_up_active = 0L; -QPixmap * px_button_base_down_active = 0L; -QPixmap * px_button_iconify = 0L; -QPixmap * px_button_close = 0L; -QPixmap * px_button_lower = 0L; -QPixmap * px_button_max = 0L; -QPixmap * px_button_unmax = 0L; -QPixmap * px_button_iconify_active = 0L; -QPixmap * px_button_close_active = 0L; -QPixmap * px_button_lower_active = 0L; -QPixmap * px_button_max_active = 0L; -QPixmap * px_button_unmax_active = 0L; -QPixmap * px_title_inactive_left = 0L; -QPixmap * px_title_inactive = 0L; -QPixmap * px_title_inactive_right = 0L; -QPixmap * px_title_active_left = 0L; -QPixmap * px_title_active = 0L; -QPixmap * px_title_active_right = 0L; -QPixmap * px_resize_left = 0L; -QPixmap * px_resize_mid = 0L; -QPixmap * px_resize_right = 0L; - -Button::Button(Manager * parent) - : QButton(parent, "Button"), - client_(parent), - px_symbol_inactive_(0L), - px_symbol_active_(0L) -{ - setFixedSize(18, 18); - - XSetWindowAttributes wsa; - wsa.save_under = true; - XChangeWindowAttributes(qt_xdisplay(), winId(), 0, &wsa); -} - - void -Button::update() -{ - repaint(false); -} - - void -Button::drawButton(QPainter * p) -{ - // Excuse my minimalism. - QPixmap * px = - client_->isActive() ? - (isDown() ? px_button_base_down_active : px_button_base_up_active) : - (isDown() ? px_button_base_down : px_button_base_up); - - p->drawPixmap(0, 0, *px); - - if (client_->isActive()) - p->drawPixmap(3, 3, *px_symbol_active_); - else - p->drawPixmap(3, 3, *px_symbol_inactive_); -} - - void -Button::setSymbols(QPixmap * inactive, QPixmap * active) -{ - px_symbol_inactive_ = inactive; - px_symbol_active_ = active; - repaint(false); -} - -LowerButton::LowerButton(Manager * parent) - : Button(parent) -{ -// TODO connect(this, SIGNAL(clicked()), client(), (SLOT(lowerAndDeactivate()))); - setSymbols(px_button_lower, px_button_lower_active); -} - -CloseButton::CloseButton(Manager * parent) - : Button(parent) -{ - connect(this, SIGNAL(clicked()), client(), (SLOT(closeWindow()))); - setSymbols(px_button_close, px_button_close_active); -} - -IconifyButton::IconifyButton(Manager * parent) - : Button(parent) -{ - connect(this, SIGNAL(clicked()), client(), (SLOT(iconify()))); - setSymbols(px_button_iconify, px_button_iconify_active); -} - -MaximiseButton::MaximiseButton(Manager * parent) - : Button(parent) -{ - setSymbols(px_button_max, px_button_max_active); -} - - void -MaximiseButton::setOn(bool on) -{ - if (on) - setSymbols(px_button_unmax, px_button_unmax_active); - else - setSymbols(px_button_max, px_button_max_active); -} - - void -MaximiseButton::mouseReleaseEvent(QMouseEvent * e) -{ - Button::mouseReleaseEvent(e); - - if (!rect().contains(e->pos())) - return; - - switch (e->button()) - { - case RightButton: - client()->maximizeNoRaise(); - break; - - case MidButton: - client()->maximizeVertically(); - break; - - case LeftButton: - default: - client()->maximizeAndRaise(); - break; - } -} - -ResizeButton::ResizeButton(Manager * parent) - : Button(parent) -{ -} - -TitleBar::TitleBar(Manager * parent) - : QWidget(parent, "TitleBar"), - client_(parent) -{ - setFixedHeight(18); - - XSetWindowAttributes wsa; - wsa.save_under = true; - XChangeWindowAttributes(qt_xdisplay(), winId(), 0, &wsa); - - buf_ = new QPixmap; - buf_->resize(128, 18); - _updatePixmap(); -} - -TitleBar::~TitleBar() -{ - delete buf_; -} - - void -TitleBar::_updatePixmap() -{ - if (size().width() > buf_->width()) - buf_->resize(size()); - - QPainter p; - p.begin(buf_); - - if (client_->isActive()) { - - p.drawPixmap(0, 0, *px_title_active_left); - p.drawTiledPixmap(2, 0, width() - 4, 18, *px_title_active); - p.drawPixmap(width() - 2, 0, *px_title_active_right); - p.setPen(Qt::white); - p.setFont(options->font()); - p.drawText(3, 0, width() - 6, 18, AlignCenter, client_->caption()); - - } else { - - p.drawPixmap(0, 0, *px_title_inactive_left); - p.drawTiledPixmap(2, 0, width() - 4, 18, *px_title_inactive); - p.drawPixmap(width() - 2, 0, *px_title_inactive_right); - p.setPen(QColor(0xC3, 0xC3, 0xC3)); - p.setFont(options->font()); - - QRect textRect; - - p.drawText( - 3, 0, width() - 6, 18, AlignCenter, client_->caption(), -1, &textRect); - - textRect.setTop(2); - textRect.setBottom(15); - textRect.setLeft(textRect.left() - 4); - textRect.setRight(textRect.right() + 4); - - p.fillRect(textRect, QBrush(QColor(0xC3, 0xC3, 0xC3))); - - int l = textRect.left() - 2; - int r = textRect.right() + 2; - - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - l -= 1; r += 1; - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - l -= 1; r += 1; - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - l -= 2; r += 2; - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - l -= 1; r += 1; - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - l -= 1; r += 1; - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - l -= 2; r += 2; - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - l -= 2; r += 2; - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - l -= 2; r += 2; - p.drawLine(l, 2, l, 15); - p.drawLine(r, 2, r, 15); - - p.setPen(Qt::black); - p.drawText(3, 0, width() - 6, 18, AlignCenter, client_->caption()); - - } -} - - void -TitleBar::resizeEvent(QResizeEvent * e) -{ - QWidget::resizeEvent(e); - _updatePixmap(); -} - - void -TitleBar::paintEvent(QPaintEvent * e) -{ - QRect r(e->rect()); - bitBlt(this, r.topLeft(), buf_, r, Qt::CopyROP); -} - - void -TitleBar::mousePressEvent(QMouseEvent * e) -{ - switch (e->button()) { - - case MidButton: - client_->workspace()->clientPopup(client_)->popup(e->globalPos()); - break; - - case LeftButton: - client_->workspace()->raiseClient(client_); - client_->workspace()->requestFocus(client_); - - case RightButton: - - clientPosToMousePos_ = e->globalPos() - client_->pos(); - break; - - default: - break; - } -} - - void -TitleBar::mouseReleaseEvent(QMouseEvent *) -{ -} - - void -TitleBar::mouseMoveEvent(QMouseEvent * e) -{ - QPoint adjustedForCursor = e->globalPos() - clientPosToMousePos_; - - QPoint adjustedForSnap = - client_->workspace()->adjustClientPosition(client_, adjustedForCursor); - - client_->move(adjustedForSnap); - -// Do we really need this ? -// QApplication::syncX(); -} - - void -TitleBar::mouseDoubleClickEvent(QMouseEvent *) -{ - client_->setShade(!client_->isShade()); -} - - void -TitleBar::update() -{ - _updatePixmap(); - repaint(false); -} - -ResizeBar::ResizeBar(Manager * parent) - : QWidget(parent, "ResizeBar") -{ - setFixedHeight(8); - - left_ = new ResizeLeft(this, parent); - mid_ = new ResizeMid(this, parent); - right_ = new ResizeRight(this, parent); - - QHBoxLayout * layout = new QHBoxLayout(this); - - layout->addWidget(left_); - layout->addWidget(mid_, 1); - layout->addWidget(right_); - - XSetWindowAttributes wsa; - wsa.save_under = true; - - XChangeWindowAttributes(qt_xdisplay(), winId(), 0, &wsa); - XChangeWindowAttributes(qt_xdisplay(), left_->winId(), 0, &wsa); - XChangeWindowAttributes(qt_xdisplay(), mid_->winId(), 0, &wsa); - XChangeWindowAttributes(qt_xdisplay(), right_->winId(), 0, &wsa); -} - - void -ResizeBar::update() -{ - mid_->update(); -} - -ResizeMid::ResizeMid(ResizeBar * parent, Manager * c) - : QWidget(parent, "ResizeMid"), - client_(c) -{ - setCursor(Qt::sizeVerCursor); - buf_ = new QPixmap; - buf_->resize(128, 8); -} - -ResizeMid::~ResizeMid() -{ - delete buf_; -} - - void -ResizeMid::_updatePixmap() -{ - if (size().width() > buf_->width()) - buf_->resize(size()); - - QPainter p; - p.begin(buf_); - p.drawLine(0, 8, width(), 8); - - p.drawPixmap(0, 0, *px_resize_left); - p.drawTiledPixmap(2, 0, width() - 4, 7, *px_resize_mid); - p.drawPixmap(width() - 2, 0, *px_resize_right); -} - - void -ResizeMid::update() -{ - _updatePixmap(); - repaint(false); -} - - void -ResizeMid::resizeEvent(QResizeEvent * e) -{ - QWidget::resizeEvent(e); - _updatePixmap(); -} - - void -ResizeMid::paintEvent(QPaintEvent * e) -{ - QRect r(e->rect()); - bitBlt(this, r.topLeft(), buf_, r, Qt::CopyROP); -} - - void -ResizeMid::mouseMoveEvent(QMouseEvent * e) -{ - QRect g = client_->geometry(); - g.setBottom(e->globalPos().y()); - - QSize adjustedSize = client_->adjustedSize(g.size()); - - if (adjustedSize != client_->size()) { - g.setBottom(g.top() + adjustedSize.height()); - client_->setGeometry(g); - } -} - -ResizeLeft::ResizeLeft(ResizeBar * parent, Manager * c) - : QWidget(parent, "ResizeLeft"), - client_(c) -{ - setCursor(Qt::sizeBDiagCursor); - - setFixedSize(30, 8); - setBackgroundColor(Qt::black); - QPixmap pixmap; - pixmap.resize(30, 8); - pixmap.fill(Qt::black); - QPainter p(&pixmap); - p.drawPixmap(1, 0, *px_resize_left); - p.drawPixmap(3, 0, *px_resize_mid); - p.drawPixmap(28, 0, *px_resize_right); - setBackgroundPixmap(pixmap); -} - - void -ResizeLeft::mouseMoveEvent(QMouseEvent * e) -{ - QRect g = client_->geometry(); - g.setBottom(e->globalPos().y()); - g.setLeft(e->globalPos().x()); - - QSize adjustedSize = client_->adjustedSize(g.size()); - - if (adjustedSize != client_->size()) { - g.setLeft(g.right() - adjustedSize.width()); - g.setBottom(g.top() + adjustedSize.height()); - client_->setGeometry(g); - } -} - -ResizeRight::ResizeRight(ResizeBar * parent, Manager * c) - : QWidget(parent, "ResizeRight"), - client_(c) -{ - setCursor(Qt::sizeFDiagCursor); - - setFixedSize(30, 8); - setBackgroundColor(Qt::black); - QPixmap pixmap; - pixmap.resize(30, 8); - pixmap.fill(Qt::black); - QPainter p(&pixmap); - p.drawPixmap(0, 0, *px_resize_left); - p.drawPixmap(2, 0, *px_resize_mid); - p.drawPixmap(27, 0, *px_resize_right); - setBackgroundPixmap(pixmap); -} - - void -ResizeRight::mouseMoveEvent(QMouseEvent * e) -{ - QRect g = client_->geometry(); - g.setBottom(e->globalPos().y()); - g.setRight(e->globalPos().x()); - - QSize adjustedSize = client_->adjustedSize(g.size()); - - if (adjustedSize != client_->size()) { - g.setRight(g.left() + adjustedSize.width()); - g.setBottom(g.top() + adjustedSize.height()); - client_->setGeometry(g); - } -} - -Manager::Manager( - Workspace * workSpace, - WId winId, - QWidget * parent, - const char * name -) - : Client(workSpace, winId, parent, name, WResizeNoErase), - pixmapsLoaded_(false) -{ - setMouseTracking(false); // I don't want this ! - setBackgroundColor(Qt::black); - - _loadPixmaps(); - - connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); - - lower_ = new LowerButton (this); - close_ = new CloseButton (this); - title_ = new TitleBar (this); - iconify_ = new IconifyButton (this); - maximize_ = new MaximiseButton (this); - resizeBar_ = new ResizeBar (this); - - // Layout - - // Border | Close | Titlebar | Max | Lower | Border - QHBoxLayout * titleLayout = new QHBoxLayout(0, "titleLayout"); - titleLayout->addSpacing(1); - titleLayout->addWidget(lower_); - titleLayout->addSpacing(1); - titleLayout->addWidget(close_); - titleLayout->addSpacing(1); - titleLayout->addWidget(title_, 1); - titleLayout->addSpacing(1); - titleLayout->addWidget(iconify_); - titleLayout->addSpacing(1); - titleLayout->addWidget(maximize_); - titleLayout->addSpacing(1); - - // Border - // Window - // Border - QHBoxLayout * windowLayout = new QHBoxLayout(0, "windowLayout"); - windowLayout->addSpacing(1); - windowLayout->addWidget(windowWrapper(), 1); - windowLayout->addSpacing(1); - - // Border - // Titlebar - // Window layout - // Resize bar - QVBoxLayout * mainLayout = new QVBoxLayout(this, 0, 0, "mainLayout"); - mainLayout->addSpacing(1); - mainLayout->addLayout(titleLayout); - mainLayout->addSpacing(1); - mainLayout->addLayout(windowLayout, 1); - mainLayout->addSpacing(1); - mainLayout->addWidget(resizeBar_); - - title_->update(); - resizeBar_->update(); -} - - void -Manager::slotReset() -{ - // Empty. -} - - void -Manager::captionChange(const QString &) -{ - title_->update(); -} - - void -Manager::activeChange(bool) -{ - title_->update(); - lower_->update(); - close_->update(); - iconify_->update(); - maximize_->update(); -} - - void -Manager::maximizeChange(bool b) -{ - maximize_->setOn(b); -} - - void -Manager::maximizeAndRaise() -{ - maximize(MaximizeFull); - workspace()->raiseClient(this); - workspace()->requestFocus(this); -} - - void -Manager::maximizeVertically() -{ - maximize(MaximizeVertical); - workspace()->raiseClient(this); - workspace()->requestFocus(this); -} - - void -Manager::maximizeNoRaise() -{ - maximize(MaximizeFull); -} - - void -Manager::resize(int w, int h) -{ - Client::resize(w, h); -} - - void -Manager::setShade(bool) -{ -#if 0 - // Hmm. This does screwy things to the layout. - if (b) - resizeBar_->hide(); - else - resizeBar_->show(); -#endif - - // And this is screwed. My window ends up the wrong size when unshaded. -// Client::setShade(b); -} - - void -Manager::_loadPixmaps() -{ - if (pixmapsLoaded_) { - - delete px_button_base_up; px_button_base_up = 0L; - delete px_button_base_down; px_button_base_down = 0L; - delete px_button_base_up_active; px_button_base_up_active = 0L; - delete px_button_base_down_active; px_button_base_down_active = 0L; - delete px_button_iconify; px_button_iconify = 0L; - delete px_button_close; px_button_close = 0L; - delete px_button_lower; px_button_lower = 0L; - delete px_button_max; px_button_max = 0L; - delete px_button_unmax; px_button_unmax = 0L; - delete px_button_iconify_active; px_button_iconify_active = 0L; - delete px_button_close_active; px_button_close_active = 0L; - delete px_button_lower_active; px_button_lower_active = 0L; - delete px_button_max_active; px_button_max_active = 0L; - delete px_button_unmax_active; px_button_unmax_active = 0L; - delete px_title_inactive_left; px_title_inactive_left = 0L; - delete px_title_inactive; px_title_inactive = 0L; - delete px_title_inactive_right; px_title_inactive_right = 0L; - delete px_title_active_left; px_title_active_left = 0L; - delete px_title_active; px_title_active = 0L; - delete px_title_active_right; px_title_active_right = 0L; - delete px_resize_left; px_resize_left = 0L; - delete px_resize_mid; px_resize_mid = 0L; - delete px_resize_right; px_resize_right = 0L; - } - - px_button_base_up = new QPixmap(button_base_up_xpm); - px_button_base_down = new QPixmap(button_base_down_xpm); - px_button_base_up_active = new QPixmap(button_base_up_active_xpm); - px_button_base_down_active = new QPixmap(button_base_down_active_xpm); - px_button_iconify = new QPixmap(button_iconify_xpm); - px_button_close = new QPixmap(button_close_xpm); - px_button_lower = new QPixmap(button_lower_xpm); - px_button_max = new QPixmap(button_max_xpm); - px_button_unmax = new QPixmap(button_unmax_xpm); - px_button_iconify_active = new QPixmap(button_iconify_active_xpm); - px_button_close_active = new QPixmap(button_close_active_xpm); - px_button_lower_active = new QPixmap(button_lower_active_xpm); - px_button_max_active = new QPixmap(button_max_active_xpm); - px_button_unmax_active = new QPixmap(button_unmax_active_xpm); - px_title_inactive_left = new QPixmap(title_inactive_left_xpm); - px_title_inactive = new QPixmap(title_inactive_xpm); - px_title_inactive_right = new QPixmap(title_inactive_right_xpm); - px_title_active_left = new QPixmap(title_active_left_xpm); - px_title_active = new QPixmap(title_active_xpm); - px_title_active_right = new QPixmap(title_active_right_xpm); - px_resize_left = new QPixmap(resize_bar_left_xpm); - px_resize_mid = new QPixmap(resize_bar_mid_xpm); - px_resize_right = new QPixmap(resize_bar_right_xpm); - - pixmapsLoaded_ = true; -} - -// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/riscosclient.h b/clients/riscos/riscosclient.h deleted file mode 100644 index e05b1b0a99..0000000000 --- a/clients/riscos/riscosclient.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - RISC OS KWin client - - Copyright 2000 - Rik Hemsley - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef RISC_OS_CLIENT_H -#define RISC_OS_CLIENT_H - -#include -#include - -#include "../../client.h" - -class QPixmap; - -namespace RiscOS { - -class Manager; - -class Button : public QButton -{ - Q_OBJECT - - public: - - Button(Manager * parent); - - void update(); - - protected: - - void drawButton(QPainter *); - void setSymbols(QPixmap *, QPixmap *); - - protected: - - Manager * client() { return client_; } - - private: - - Manager * client_; - - QPixmap * px_symbol_inactive_; - QPixmap * px_symbol_active_; -}; - -// -------------------------------------------------------------------------- - -class LowerButton : public Button -{ - Q_OBJECT - - public: - - LowerButton(Manager * parent); -}; - -// -------------------------------------------------------------------------- - -class CloseButton : public Button -{ - Q_OBJECT - - public: - - CloseButton(Manager * parent); -}; - -// -------------------------------------------------------------------------- - -class IconifyButton : public Button -{ - Q_OBJECT - - public: - - IconifyButton(Manager * parent); -}; - -// -------------------------------------------------------------------------- - -class MaximiseButton : public Button -{ - Q_OBJECT - - public: - - MaximiseButton(Manager * parent); - - void setOn(bool); - - protected: - - void mouseReleaseEvent(QMouseEvent *); -}; - -// -------------------------------------------------------------------------- - -class ResizeButton : public Button -{ - Q_OBJECT - - public: - - ResizeButton(Manager * parent); -}; - -// -------------------------------------------------------------------------- - -class TitleBar : public QWidget -{ - Q_OBJECT - - public: - - TitleBar(Manager * parent); - virtual ~TitleBar(); - - void update(); - - protected: - - void paintEvent(QPaintEvent *); - void resizeEvent(QResizeEvent *); - - void mousePressEvent(QMouseEvent *); - void mouseReleaseEvent(QMouseEvent *); - void mouseMoveEvent(QMouseEvent *); - void mouseDoubleClickEvent(QMouseEvent *); - - private: - - void _updatePixmap(); - - Manager * client_; - - QPixmap * buf_; - - bool active_; - - QPoint clientPosToMousePos_; -}; - -// -------------------------------------------------------------------------- - -class ResizeBar; - -class ResizeMid : public QWidget -{ - Q_OBJECT - - public: - - ResizeMid(ResizeBar * parent, Manager * client); - virtual ~ResizeMid(); - - void update(); - - protected: - - void resizeEvent(QResizeEvent *); - void paintEvent(QPaintEvent *); - void mouseMoveEvent(QMouseEvent *); - - private: - - Manager * client_; - - void _updatePixmap(); - - QPixmap * buf_; -}; - -// -------------------------------------------------------------------------- - -class ResizeLeft : public QWidget -{ - Q_OBJECT - - public: - - ResizeLeft(ResizeBar * parent, Manager * client); - - protected: - - void mouseMoveEvent(QMouseEvent *); - - private: - - Manager * client_; -}; - -// -------------------------------------------------------------------------- - -class ResizeRight : public QWidget -{ - Q_OBJECT - - public: - - ResizeRight(ResizeBar * parent, Manager * client); - - protected: - - void mouseMoveEvent(QMouseEvent *); - - private: - - Manager * client_; -}; - -// -------------------------------------------------------------------------- - -class ResizeBar : public QWidget -{ - Q_OBJECT - - public: - - ResizeBar(Manager * parent); - void update(); - - private: - - ResizeLeft * left_; - ResizeMid * mid_; - ResizeRight * right_; -}; - -// -------------------------------------------------------------------------- - -class Manager : public Client -{ - Q_OBJECT - - public: - - Manager(Workspace *, WId, QWidget * parent = 0, const char * name = 0); - ~Manager() {} - - QColor colour() const { return options->color(Options::Font, isActive()); } - QFont font() const { return options->font(isActive()); } - - void maximizeVertically(); - void maximizeAndRaise(); - void maximizeNoRaise(); - void resize(int, int); - - void setShade(bool); - - protected: - - void activeChange(bool); - void maximizeChange(bool); - void mousePressEvent(QMouseEvent *) {} // Disabled - void mouseReleaseEvent(QMouseEvent *) {} // Disabled - - protected slots: - - void captionChange(const QString &); - void slotReset(); - - private: - - LowerButton * lower_; - CloseButton * close_; - - TitleBar * title_; - - IconifyButton * iconify_; - MaximiseButton * maximize_; - - ResizeBar * resizeBar_; - - void _loadPixmaps(); - bool pixmapsLoaded_; -}; - -} // End namespace `RiscOS' - -#endif -// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/title_active.xpm b/clients/riscos/title_active.xpm deleted file mode 100644 index cfcdba5539..0000000000 --- a/clients/riscos/title_active.xpm +++ /dev/null @@ -1,27 +0,0 @@ -/* XPM */ -static char * title_active_xpm[] = { -"128 18 6 1", -" c None", -". c #DCDCDC", -"+ c #808080", -"@ c #000000", -"# c #303030", -"$ c #585858", -"................................................................................................................................", -"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"################################################################################################################################", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"################################################################################################################################", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"################################################################################################################################", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"################################################################################################################################", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", -"################################################################################################################################"}; diff --git a/clients/riscos/title_active_left.xpm b/clients/riscos/title_active_left.xpm deleted file mode 100644 index 2755a4a5ee..0000000000 --- a/clients/riscos/title_active_left.xpm +++ /dev/null @@ -1,27 +0,0 @@ -/* XPM */ -static char * title_active_left_xpm[] = { -"2 18 6 1", -" c None", -". c #FFFFFF", -"+ c #DCDCDC", -"@ c #C3C3C3", -"# c #808080", -"$ c #585858", -".+", -"+@", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"+#", -"@$"}; diff --git a/clients/riscos/title_active_right.xpm b/clients/riscos/title_active_right.xpm deleted file mode 100644 index 9e6c4c6da5..0000000000 --- a/clients/riscos/title_active_right.xpm +++ /dev/null @@ -1,28 +0,0 @@ -/* XPM */ -static char * title_active_right_xpm[] = { -"2 18 7 1", -" c None", -". c #DCDCDC", -"+ c #C3C3C3", -"@ c #808080", -"# c #585858", -"$ c #303030", -"% c #000000", -".+", -"@#", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"#$", -"$%"}; diff --git a/clients/riscos/title_inactive.xpm b/clients/riscos/title_inactive.xpm deleted file mode 100644 index e83f613433..0000000000 --- a/clients/riscos/title_inactive.xpm +++ /dev/null @@ -1,28 +0,0 @@ -/* XPM */ -static char * title_inactive_xpm[] = { -"128 18 7 1", -" c None", -". c #FFFFFF", -"+ c #DCDCDC", -"@ c #C3C3C3", -"# c #A0A0A0", -"$ c #808080", -"% c #585858", -"................................................................................................................................", -"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"################################################################################################################################", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"################################################################################################################################", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"################################################################################################################################", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"################################################################################################################################", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", -"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"}; diff --git a/clients/riscos/title_inactive_left.xpm b/clients/riscos/title_inactive_left.xpm deleted file mode 100644 index 13b2aa06b5..0000000000 --- a/clients/riscos/title_inactive_left.xpm +++ /dev/null @@ -1,26 +0,0 @@ -/* XPM */ -static char * title_inactive_left_xpm[] = { -"2 18 5 1", -" c None", -". c #FFFFFF", -"+ c #DCDCDC", -"@ c #C3C3C3", -"# c #A0A0A0", -"..", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".+", -".@", -"+#"}; diff --git a/clients/riscos/title_inactive_right.xpm b/clients/riscos/title_inactive_right.xpm deleted file mode 100644 index 22708868a8..0000000000 --- a/clients/riscos/title_inactive_right.xpm +++ /dev/null @@ -1,29 +0,0 @@ -/* XPM */ -static char * title_inactive_right_xpm[] = { -"2 18 8 1", -" c None", -". c #FFFFFF", -"+ c #DCDCDC", -"@ c #C3C3C3", -"# c #808080", -"$ c #A0A0A0", -"% c #585858", -"& c #303030", -".+", -"@#", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"$%", -"%&"};