diff --git a/clients/riscos/Makefile.am b/clients/riscos/Makefile.am new file mode 100644 index 0000000000..6a7e04891f --- /dev/null +++ b/clients/riscos/Makefile.am @@ -0,0 +1,20 @@ + +INCLUDES = $(all_includes) + +lib_LTLIBRARIES = libkwinriscos.la + +libkwinriscos_la_SOURCES = riscosclient.cpp + +METASOURCES = AUTO +noinst_HEADERS = riscosclient.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 + +###KMAKE-start (don't edit or delete this block) + +###KMAKE-end diff --git a/clients/riscos/README b/clients/riscos/README new file mode 100644 index 0000000000..b86d60cd8c --- /dev/null +++ b/clients/riscos/README @@ -0,0 +1,67 @@ +This theme emulates the look and feel of the RISC OS 'window manager'. +Actually, RISC OS doesn't have a window manager in the same way X +does, but if you imagine it does, this is an emulation of that ;) + +I've optimised it for speed, so you should find it quite nippy. +Particularly the fact that the left and right borders are single-pixel +gives a large speedup on my Matrox card when dragging windows. + +I've requested save-under in the window decorations for that extra +speed kick, plus double-buffered the title bar and resize bar. + +Functions that will be implemented but are currently missing: + Transparent resize. + Shading. + Backward-resize. + NOTE: Backward-resize is an interesting feature and quite useful. + If you resize a window such that you hit the screen edge + in the process, the window resizes 'backwards' (i.e. + moves in the opposite direction to your drag and at the + same time continues increasing in size). So instead + of having to let go of the resize handle, move the window + and resize again, it just does what you want it to do. + +Button functions: (Missing functionality is marked with TODO) + +Button One: + + Left button: TODO + Lower window and drop focus. This is currently unimplemented + in kwin itself. + +Button Two: + + Left button: Close window. + + Right button: TODO, if I can be bothered. + Close window. + If window is filer window, open another filer window + in parent dir. + If window is document window, open a filer window in + dir containing document. + If you hold Shift, the window doesn't close. + NOTE: + This requires app support. + If I were to implement this, I would do it in konqy + and probably not bother for other apps. + +Button Three: + + Left button: Iconify window. + +Button Four: + + Left button: Maximise or restore window plus raise and focus. + + Middle button: Maximise vertically or restore window plus raise and focus. + + Right button: Maximise or restore window. + +The lower bar is used for resizing. It works in the NeXT style. +This doesn't exist on RISC OS. In RISC OS, there is a 'resize handle' +in the lower right corner of the window (actually inside the window). + +To emulate this would mean covering part of the window with the decorations, +which is not acceptable. RISC OS gets away with it by making sure that +there is a vertical scrollbar visible at all times, which is just stupid. + diff --git a/clients/riscos/bar.xpm b/clients/riscos/bar.xpm new file mode 100644 index 0000000000..f609ce8c71 --- /dev/null +++ b/clients/riscos/bar.xpm @@ -0,0 +1,20 @@ +/* XPM */ +static char * bar_xpm[] = { +"12 12 5 1", +" c None", +". c #BBBBBB", +"+ c #555555", +"@ c #FFFFFF", +"# c #999999", +" ", +" ", +" ", +" ", +" +++++++++. ", +" +........@ ", +" +........@ ", +" #@@@@@@@@@ ", +" ", +" ", +" ", +" "}; diff --git a/clients/riscos/base_down.xpm b/clients/riscos/base_down.xpm new file mode 100644 index 0000000000..f3331975f0 --- /dev/null +++ b/clients/riscos/base_down.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * base_down_xpm[] = { +"18 18 8 1", +" c None", +". c #555555", +"+ c #777777", +"@ c #BBBBBB", +"# c #969696", +"$ c #FFFFFF", +"% c #A8A8A8", +"& c #DDDDDD", +"................+@", +".###############@$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +".#%%%%%%%%%%%%%%&$", +"+@&&&&&&&&&&&&&&&$", +"@$$$$$$$$$$$$$$$$$"}; diff --git a/clients/riscos/base_up.xpm b/clients/riscos/base_up.xpm new file mode 100644 index 0000000000..ee52cfac46 --- /dev/null +++ b/clients/riscos/base_up.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * base_up_xpm[] = { +"18 18 7 1", +" c None", +". c #FFFFFF", +"+ c #BBBBBB", +"@ c #DDDDDD", +"# c #777777", +"$ c #999999", +"% c #555555", +".................+", +".@@@@@@@@@@@@@@@+#", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".@++++++++++++++$%", +".+$$$$$$$$$$$$$$$%", +"+#%%%%%%%%%%%%%%%%"}; diff --git a/clients/riscos/close.xpm b/clients/riscos/close.xpm new file mode 100644 index 0000000000..e2da935e90 --- /dev/null +++ b/clients/riscos/close.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * close_xpm[] = { +"12 12 7 1", +" c None", +". c #BBBBBB", +"+ c #DDDDDD", +"@ c #555555", +"# c #777777", +"$ c #999999", +"% c #FFFFFF", +" ", +"+@#+ @$+", +"+%@#+ @$++", +" +%@#+ @$++ ", +" +%@$#$%+ ", +" ++$$%+ ", +" @$$@+ ", +" @$+%$@ ", +" @$+++%$@ ", +" @$++ +%$@ ", +" $++ +%$ ", +" ++ ++ "}; diff --git a/clients/riscos/lower.xpm b/clients/riscos/lower.xpm new file mode 100644 index 0000000000..158957ec43 --- /dev/null +++ b/clients/riscos/lower.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * lower_xpm[] = { +"12 12 7 1", +" c None", +". c #555555", +"+ c #777777", +"@ c #BBBBBB", +"# c #FFFFFF", +"$ c #DDDDDD", +"% c #999999", +".......+ ", +".######@$ ", +".# +# ", +".# .......+ ", +".# .######@$", +".# .# +#", +".# .# .#", +".@+.# .#", +"%$#.# .#", +" .# .#", +" .@+.....#", +" %$#######"}; diff --git a/clients/riscos/max.xpm b/clients/riscos/max.xpm new file mode 100644 index 0000000000..aafdb98d07 --- /dev/null +++ b/clients/riscos/max.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * max_xpm[] = { +"12 12 7 1", +" c None", +". c #BBBBBB", +"+ c #555555", +"@ c #777777", +"# c #FFFFFF", +"$ c #DDDDDD", +"% c #999999", +" ", +" ", +" ++++++@. ", +" +#####.$ ", +" +# @# ", +" +# +# ", +" +# +# ", +" +# +# ", +" +.@++++# ", +" %$###### ", +" ", +" "}; diff --git a/clients/riscos/resize.xpm b/clients/riscos/resize.xpm new file mode 100644 index 0000000000..710c7f039b --- /dev/null +++ b/clients/riscos/resize.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * resize_xpm[] = { +"12 12 7 1", +" c None", +". c #FFFFFF", +"+ c #BBBBBB", +"@ c #DDDDDD", +"# c #777777", +"$ c #999999", +"% c #555555", +"%%%%%%%%%%%+", +"%....+....+@", +"%. #. #.", +"%. %. %.", +"%. %. %.", +"%+#%%%. %.", +"%...... %.", +"%. %.", +"%. %.", +"%. %.", +"%+#%%%%%%%%.", +"$@.........."}; diff --git a/clients/riscos/resize_bar_left.xpm b/clients/riscos/resize_bar_left.xpm new file mode 100644 index 0000000000..0ab9278e24 --- /dev/null +++ b/clients/riscos/resize_bar_left.xpm @@ -0,0 +1,15 @@ +/* XPM */ +static char * resize_bar_left_xpm[] = { +"2 7 5 1", +" c None", +". c #FFFFFF", +"+ c #DDDDDD", +"@ c #BBBBBB", +"# c #777777", +"..", +".+", +".+", +".+", +".+", +".@", +"@#"}; diff --git a/clients/riscos/resize_bar_mid.xpm b/clients/riscos/resize_bar_mid.xpm new file mode 100644 index 0000000000..019745bf20 --- /dev/null +++ b/clients/riscos/resize_bar_mid.xpm @@ -0,0 +1,16 @@ +/* XPM */ +static char * resize_bar_mid_xpm[] = { +"25 7 6 1", +" c None", +". c #FFFFFF", +"+ c #DDDDDD", +"@ c #BBBBBB", +"# c #999999", +"$ c #555555", +".........................", +"+++++++++++++++++++++++++", +"@@@@@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@@@@@@@@@@", +"#########################", +"$$$$$$$$$$$$$$$$$$$$$$$$$"}; diff --git a/clients/riscos/resize_bar_right.xpm b/clients/riscos/resize_bar_right.xpm new file mode 100644 index 0000000000..dd1decf117 --- /dev/null +++ b/clients/riscos/resize_bar_right.xpm @@ -0,0 +1,16 @@ +/* XPM */ +static char * resize_bar_right_xpm[] = { +"2 7 6 1", +" c None", +". c #FFFFFF", +"+ c #BBBBBB", +"@ c #777777", +"# c #999999", +"$ c #555555", +".+", +"+@", +"#$", +"#$", +"#$", +"#$", +"$$"}; diff --git a/clients/riscos/riscos.desktop b/clients/riscos/riscos.desktop new file mode 100644 index 0000000000..a7773f9a4d --- /dev/null +++ b/clients/riscos/riscos.desktop @@ -0,0 +1,3 @@ +[Desktop Entry] +Name=RISC OS +X-KDE-Library=libkwinriscos diff --git a/clients/riscos/riscosclient.cpp b/clients/riscos/riscosclient.cpp new file mode 100644 index 0000000000..8741ff2bda --- /dev/null +++ b/clients/riscos/riscosclient.cpp @@ -0,0 +1,566 @@ +/* + 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 +#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 "base_up.xpm" +#include "base_down.xpm" +#include "close.xpm" +#include "unmax.xpm" +#include "max.xpm" +#include "lower.xpm" +#include "bar.xpm" + +#include + +extern "C" +{ + Client * allocate(Workspace * workSpace, WId winId) + { + return new RiscOSClient(workSpace, winId); + } +} + +RiscOSButton::RiscOSButton(RiscOSClient * parent) + : QButton(parent, "RiscOSButton"), + client_(parent) +{ + setFixedSize(18, 18); + px_base_up_ = QPixmap(base_up_xpm); + px_base_down_ = QPixmap(base_down_xpm); + + XSetWindowAttributes wsa; + wsa.save_under = true; + XChangeWindowAttributes(qt_xdisplay(), winId(), 0, &wsa); +} + + void +RiscOSButton::drawButton(QPainter * p) +{ + if (isDown()) + p->drawPixmap(0, 0, px_base_down_); + else + p->drawPixmap(0, 0, px_base_up_); + + p->drawPixmap(3, 3, px_symbol_); +} + + void +RiscOSButton::setSymbol(const QPixmap & p) +{ + px_symbol_ = p; + repaint(false); +} + +RiscOSLowerButton::RiscOSLowerButton(RiscOSClient * parent) + : RiscOSButton(parent) +{ +// TODO connect(this, SIGNAL(clicked()), client(), (SLOT(lowerAndDeactivate()))); + setSymbol(QPixmap(lower_xpm)); +} + +RiscOSCloseButton::RiscOSCloseButton(RiscOSClient * parent) + : RiscOSButton(parent) +{ + connect(this, SIGNAL(clicked()), client(), (SLOT(closeWindow()))); + setSymbol(QPixmap(close_xpm)); +} + +RiscOSIconifyButton::RiscOSIconifyButton(RiscOSClient * parent) + : RiscOSButton(parent) +{ + connect(this, SIGNAL(clicked()), client(), (SLOT(iconify()))); + setSymbol(QPixmap(bar_xpm)); +} + +RiscOSMaximiseButton::RiscOSMaximiseButton(RiscOSClient * parent) + : RiscOSButton(parent) +{ + setSymbol(QPixmap(max_xpm)); +} + + void +RiscOSMaximiseButton::setOn(bool on) +{ + if (on) + setSymbol(QPixmap(unmax_xpm)); + else + setSymbol(QPixmap(max_xpm)); +} + + void +RiscOSMaximiseButton::mouseReleaseEvent(QMouseEvent * e) +{ + RiscOSButton::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; + } +} + +RiscOSResizeButton::RiscOSResizeButton(RiscOSClient * parent) + : RiscOSButton(parent) +{ +} + +RiscOSTitleBar::RiscOSTitleBar(RiscOSClient * parent) + : QWidget(parent, "RiscOSTitleBar"), + client_(parent) +{ + setFixedHeight(18); + + px_inactive_left_ = QPixmap(title_inactive_left_xpm); + px_inactive_ = QPixmap(title_inactive_xpm); + px_inactive_right_ = QPixmap(title_inactive_right_xpm); + px_active_left_ = QPixmap(title_active_left_xpm); + px_active_ = QPixmap(title_active_xpm); + px_active_right_ = QPixmap(title_active_right_xpm); + + XSetWindowAttributes wsa; + wsa.save_under = true; + XChangeWindowAttributes(qt_xdisplay(), winId(), 0, &wsa); + + buf_.resize(128,18); + _updatePixmap(); +} + + void +RiscOSTitleBar::_updatePixmap() +{ + if (size().width() > buf_.width()) + buf_.resize(size()); + + QPainter p; + p.begin(&buf_); + + if (client_->isActive()) { + + p.drawPixmap(0, 0, px_active_left_); + p.drawTiledPixmap(2, 0, width() - 4, 18, px_active_); + p.drawPixmap(width() - 2, 0, px_active_right_); + + } else { + + p.drawPixmap(0, 0, px_inactive_left_); + p.drawTiledPixmap(2, 0, width() - 4, 18, px_inactive_); + p.drawPixmap(width() - 2, 0, px_inactive_right_); + + } + + p.setPen(client_->colour()); + p.setFont(client_->font()); + p.setFont(QFont("times", 10, QFont::Bold)); + p.drawText(3, 0, width() - 6, 18, AlignCenter, client_->caption()); +} + + void +RiscOSTitleBar::resizeEvent(QResizeEvent * e) +{ + QWidget::resizeEvent(e); + _updatePixmap(); +} + + void +RiscOSTitleBar::paintEvent(QPaintEvent * e) +{ + QRect r(e->rect()); + bitBlt(this, r.topLeft(), &buf_, r, Qt::CopyROP); +} + + void +RiscOSTitleBar::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 +RiscOSTitleBar::mouseReleaseEvent(QMouseEvent * e) +{ +} + + void +RiscOSTitleBar::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 +RiscOSTitleBar::mouseDoubleClickEvent(QMouseEvent * e) +{ + client_->setShade(!client_->isShade()); +} + + void +RiscOSTitleBar::update() +{ + _updatePixmap(); + repaint(false); +} + +RiscOSResizeBar::RiscOSResizeBar(RiscOSClient * parent) + : QWidget(parent, "RiscOSResizeBar") +{ + setFixedHeight(8); + + left_ = new RiscOSResizeLeft(this, parent); + mid_ = new RiscOSResizeMid(this, parent); + right_ = new RiscOSResizeRight(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 +RiscOSResizeBar::update() +{ + mid_->update(); +} + +RiscOSResizeMid::RiscOSResizeMid(RiscOSResizeBar * parent, RiscOSClient * c) + : QWidget(parent, "RiscOSResizeMid"), + client_(c) +{ + setCursor(Qt::sizeVerCursor); + + px_left_ = QPixmap(resize_bar_left_xpm); + px_mid_ = QPixmap(resize_bar_mid_xpm); + px_right_ = QPixmap(resize_bar_right_xpm); +} + + void +RiscOSResizeMid::_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_left_); + p.drawTiledPixmap(2, 0, width() - 4, 7, px_mid_); + p.drawPixmap(width() - 2, 0, px_right_); +} + + void +RiscOSResizeMid::update() +{ + _updatePixmap(); + repaint(false); +} + + void +RiscOSResizeMid::resizeEvent(QResizeEvent * e) +{ + QWidget::resizeEvent(e); + _updatePixmap(); +} + + void +RiscOSResizeMid::paintEvent(QPaintEvent * e) +{ + QRect r(e->rect()); + bitBlt(this, r.topLeft(), &buf_, r, Qt::CopyROP); +} + + void +RiscOSResizeMid::mouseMoveEvent(QMouseEvent * e) +{ + QRect g = client_->geometry(); + g.setHeight(e->globalPos().y()); + + QSize adjustedSize = client_->adjustedSize(g.size()); + + if (adjustedSize != client_->size()) { + g.setBottom(g.top() + adjustedSize.height()); + client_->setGeometry(g); + } +} + +RiscOSResizeLeft::RiscOSResizeLeft(RiscOSResizeBar * parent, RiscOSClient * c) + : QWidget(parent, "RiscOSResizeLeft"), + 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, QPixmap(resize_bar_left_xpm)); + p.drawPixmap(3, 0, QPixmap(resize_bar_mid_xpm)); + p.drawPixmap(28, 0, QPixmap(resize_bar_right_xpm)); + setBackgroundPixmap(pixmap); +} + + void +RiscOSResizeLeft::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); + } +} + +RiscOSResizeRight::RiscOSResizeRight(RiscOSResizeBar * parent, RiscOSClient * c) + : QWidget(parent, "RiscOSResizeRight"), + 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, QPixmap(resize_bar_left_xpm)); + p.drawPixmap(2, 0, QPixmap(resize_bar_mid_xpm)); + p.drawPixmap(27, 0, QPixmap(resize_bar_right_xpm)); + setBackgroundPixmap(pixmap); +} + + void +RiscOSResizeRight::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); + } +} + +RiscOSClient::RiscOSClient( + Workspace * workSpace, + WId winId, + QWidget * parent, + const char * name +) + : Client(workSpace, winId, parent, name, WResizeNoErase) +{ + setMouseTracking(false); // I don't want this ! + setBackgroundColor(Qt::black); + + connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); + + lower_ = new RiscOSLowerButton(this); + close_ = new RiscOSCloseButton(this); + + title_ = new RiscOSTitleBar(this); + + iconify_ = new RiscOSIconifyButton(this); + maximize_ = new RiscOSMaximiseButton(this); + + resizeBar_ = new RiscOSResizeBar(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 +RiscOSClient::slotReset() +{ + // Empty. +} + + void +RiscOSClient::captionChange(const QString &) +{ + title_->update(); +} + + void +RiscOSClient::activeChange(bool b) +{ + title_->update(); +} + + void +RiscOSClient::maximizeChange(bool b) +{ + maximize_->setOn(b); +} + + void +RiscOSClient::maximizeAndRaise() +{ + maximize(MaximizeFull); + workspace()->raiseClient(this); + workspace()->requestFocus(this); +} + + void +RiscOSClient::maximizeVertically() +{ + maximize(MaximizeVertical); + workspace()->raiseClient(this); + workspace()->requestFocus(this); +} + + void +RiscOSClient::maximizeNoRaise() +{ + maximize(MaximizeFull); +} + + void +RiscOSClient::resize(int w, int h) +{ + Client::resize(w, h); +} + + void +RiscOSClient::setShade(bool b) +{ +#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); +} + +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/riscosclient.h b/clients/riscos/riscosclient.h new file mode 100644 index 0000000000..368d060474 --- /dev/null +++ b/clients/riscos/riscosclient.h @@ -0,0 +1,279 @@ +/* + 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 + +#include "../../client.h" + +class RiscOSClient; + +class RiscOSButton : public QButton +{ + Q_OBJECT + + public: + + RiscOSButton(RiscOSClient * parent); + + protected: + + void drawButton(QPainter *); + void setSymbol(const QPixmap &); + + protected: + + RiscOSClient * client() { return client_; } + + private: + + RiscOSClient * client_; + + QPixmap px_base_up_; + QPixmap px_base_down_; + + QPixmap px_symbol_; +}; + +class RiscOSLowerButton : public RiscOSButton +{ + Q_OBJECT + + public: + + RiscOSLowerButton(RiscOSClient * parent); +}; + +class RiscOSCloseButton : public RiscOSButton +{ + Q_OBJECT + + public: + + RiscOSCloseButton(RiscOSClient * parent); +}; + +class RiscOSIconifyButton : public RiscOSButton +{ + Q_OBJECT + + public: + + RiscOSIconifyButton(RiscOSClient * parent); +}; + +class RiscOSMaximiseButton : public RiscOSButton +{ + Q_OBJECT + + public: + + RiscOSMaximiseButton(RiscOSClient * parent); + + void setOn(bool); + + protected: + + void mouseReleaseEvent(QMouseEvent *); +}; + +class RiscOSResizeButton : public RiscOSButton +{ + Q_OBJECT + + public: + + RiscOSResizeButton(RiscOSClient * parent); +}; + +class RiscOSTitleBar : public QWidget +{ + Q_OBJECT + + public: + + RiscOSTitleBar(RiscOSClient * parent); + void update(); + + protected: + + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseDoubleClickEvent(QMouseEvent *); + + private: + + void _updatePixmap(); + + RiscOSClient * client_; + + QPixmap px_inactive_left_; + QPixmap px_inactive_; + QPixmap px_inactive_right_; + QPixmap px_active_left_; + QPixmap px_active_; + QPixmap px_active_right_; + + QPixmap buf_; + + bool active_; + + QPoint clientPosToMousePos_; +}; + +class RiscOSResizeLeft; +class RiscOSResizeMid; +class RiscOSResizeRight; + +class RiscOSResizeBar : public QWidget +{ + Q_OBJECT + + public: + + RiscOSResizeBar(RiscOSClient * parent); + void update(); + + private: + + RiscOSResizeLeft * left_; + RiscOSResizeMid * mid_; + RiscOSResizeRight * right_; +}; + +class RiscOSResizeMid : public QWidget +{ + Q_OBJECT + + public: + + RiscOSResizeMid(RiscOSResizeBar * parent, RiscOSClient * client); + + void update(); + + protected: + + void resizeEvent(QResizeEvent *); + void paintEvent(QPaintEvent *); + void mouseMoveEvent(QMouseEvent *); + + private: + + RiscOSClient * client_; + + void _updatePixmap(); + + QPixmap buf_; + + QPixmap px_left_; + QPixmap px_mid_; + QPixmap px_right_; +}; + +class RiscOSResizeLeft : public QWidget +{ + Q_OBJECT + + public: + + RiscOSResizeLeft(RiscOSResizeBar * parent, RiscOSClient * client); + + protected: + + void mouseMoveEvent(QMouseEvent *); + + private: + + RiscOSClient * client_; +}; + +class RiscOSResizeRight : public QWidget +{ + Q_OBJECT + + public: + + RiscOSResizeRight(RiscOSResizeBar * parent, RiscOSClient * client); + + protected: + + void mouseMoveEvent(QMouseEvent *); + + private: + + RiscOSClient * client_; +}; + +class RiscOSClient : public Client +{ + Q_OBJECT + + public: + + RiscOSClient(Workspace *, WId, QWidget * parent = 0, const char * name = 0); + ~RiscOSClient() {} + + 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: + + RiscOSLowerButton * lower_; + RiscOSCloseButton * close_; + + RiscOSTitleBar * title_; + + RiscOSIconifyButton * iconify_; + RiscOSMaximiseButton * maximize_; + + RiscOSResizeBar * resizeBar_; +}; + +#endif +// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/title.xpm b/clients/riscos/title.xpm new file mode 100644 index 0000000000..9d81d2caa7 --- /dev/null +++ b/clients/riscos/title.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static char * title_xpm[] = { +"8 20 5 1", +"f c #FFFFFF", +"- c #DCDCDC", +"/ c #C3C3C3", +". c #585858", +"o c #000000", +"ffffffff", +"--------", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"////////", +"........", +"oooooooo"}; + + diff --git a/clients/riscos/title_active.xpm b/clients/riscos/title_active.xpm new file mode 100644 index 0000000000..d7a9a11f3d --- /dev/null +++ b/clients/riscos/title_active.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static char * title_active_xpm[] = { +"128 18 6 1", +" c None", +". c #FFFFFF", +"+ c #E7E7E7", +"@ c #E7E7A5", +"# c #C6C684", +"$ c #636363", +"................................................................................................................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"@+@@@.@.@+++@@@..@+@@+@+@+@.+@..@@@@@@@@@+@+++@@@@.@@@++++@@@@..@+@.@@@@@@@@@@@@+.+++++.@@.@@.@.@..@.@.@@@++++++++++@@@@@@@+++++", +".@@@@@.@++++@@.+@.@++@+@+@@@@@+.@@@@@@@+@@++++@@@.@@@+@@++@@@.@@.@+@.@@@@@..@@.@@@+++++@@@@@@@.@@@@.@.@.@@+++++@+@@@+@@@@@++++@+", +".@.@@@+@@++@@@@@@@@@@++@@+@.@..+@@@@@@@@+@++++@@+@@@@@@@+@+@@@@.@+@.@@@@@@@@@@@@@+@+++@+@+@@@@@@@.@.@.@@.@@++++++++@+@+@+@++++@+", +"@@@@@@@@@@@@@@.@.@.+@@@+@@+@.+@@@++@@@@+++@+@+@@@@@@@+@+@+@+@@+@.@.@@@@@@@@.@@@+.@+++++@+@+@.@.@+@@@@@+@+@.++@@@++@+@++@+@@++@@+", +"@@@@+++@+@+@@@.@@@@.@.@+@@@@@@@+++++@@@+@+++@@@@@@@@@@@@@@@+@@@.@+@.+@@@@@++@+@+@@@@++@+++@@@@@@@@@@@++@@@@+@@@@+++@++@+@@@@++@+", +"+@@@+++@@@@@@@@@+@@@@@@.@@@@@+@+@+++@@+@++@@@.@@@@@@@+@@@@@@+@@@@@+.@@@@@@@+++++@.@@@++@@+@@.@@@@+++++++@@@+@+@.@++@+@++@@@++@@@", +"+@@@+@@+@+@+@@.@@@@@+@@@@@+@@@@@++++@@@+++@+@@@@@+@@@@@.@@@+@@+@@@.@+@@@@@+@+++@+@@@+@@@@@.@@@+@@@@@@++@@@@@@@@@@++@@+@+@@@@++@+", +"@@@@@+@++@@@.@@++@@@@@@+@@++++@+@++++.+@@@@@@@@@@@.@@@@@+@@+@+@+++.+@@+@++@+@+@+@++@@+@+@@@@@@@@@@++@+@+@+@@+@@+@+@.++@@@@.@@@@@", +"@@@@@@++@+@@@+@@@@@@@@@@@@++.+@@@@+@+++@@@@@@@@@@@+@@+@+@@+@@@++@++@@@@@@@+.@@@@@@.@+@+@+@@@+@+@@+@@@+@.+@@+@@@@@@@@@@@@+@@@@@@@", +"@@@@@@@@@@+@@@@@+@@@@@+@@++@+++@@@@+++@@+@+@+@+@+++@@@@@@+@@+@+@++@@@+@@@@@@@@@@+@@@@@@@@+.@@+@@@+@+@+@+@+@@@@@+@+@@@@@@++@@@@@@", +"@@@+@@@@@@@@++@@@@@+@+@@+@++@@@@@@@@+@@@+@++@++++@++@+@+@@@+@++@++@@@+@@@+@@@+@@@+@+@@+@+@@@@@@+@@+@@++@+++@@@+++@@@@@@+@@@@@++@", +"@@@@@@@@@@+@@@@@@@+@@@@+@@@@@@@+@+@@+@@++@+@+@@+++@++@@@@+@@++++@+++@@+@+@@@@@@+@@@@+@@+@@@@@@+@@@+@+@++@@++@+@+@+@+@@+@@+@+@@@+", +"@@@@+@@@+@+@+@@++@+@+@@@+@@+@@@+@+@+@++@++@++@++@@++@@@@@@@+++@++@+@@@@@+@+@@@@@@+@@@+++@+@@@@@@@@+@@+@@@++++@+@@+++++@+@+@+@@++", +"@@@@@+@+@+++@@+@++@@+@+@@@+@+@+++@@@++@+@@+@+@+@++@++@@@@@@@@@+@+++@@@@+@@@++++@@@@++@+@+@@@@@@@@@@@@++@+++++@@+@@+@+@+@@+@@@@@+", +"################################################################################################################################", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"}; diff --git a/clients/riscos/title_active_left.xpm b/clients/riscos/title_active_left.xpm new file mode 100644 index 0000000000..fb4676c8d8 --- /dev/null +++ b/clients/riscos/title_active_left.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char * title_active_left_xpm[] = { +"2 18 5 1", +" c None", +". c #FFFFFF", +"+ c #E7E7E7", +"@ c #E7E7A5", +"# c #9C9C9C", +"..", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".@", +"@#"}; diff --git a/clients/riscos/title_active_right.xpm b/clients/riscos/title_active_right.xpm new file mode 100644 index 0000000000..af2bece6bb --- /dev/null +++ b/clients/riscos/title_active_right.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static char * title_active_right_xpm[] = { +"2 18 6 1", +" c None", +". c #FFFFFF", +"+ c #E7E7A5", +"@ c #9C9C9C", +"# c #C6C684", +"$ c #636363", +".+", +"+@", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"$$"}; diff --git a/clients/riscos/title_inactive.xpm b/clients/riscos/title_inactive.xpm new file mode 100644 index 0000000000..6d9530a36c --- /dev/null +++ b/clients/riscos/title_inactive.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static char * title_inactive_xpm[] = { +"128 18 6 1", +" c None", +". c #FFFFFF", +"+ c #DDDDDD", +"@ c #BBBBBB", +"# c #999999", +"$ c #555555", +"................................................................................................................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"@+@@@.@.@+++@@@..@+@@+@+@+@.+@..@@@@@@@@@+@+++@@@@.@@@++++@@@@..@+@.@@@@@@@@@@@@+.+++++.@@.@@.@.@..@.@.@@@++++++++++@@@@@@@+++++", +".@@@@@.@++++@@.+@.@++@+@+@@@@@+.@@@@@@@+@@++++@@@.@@@+@@++@@@.@@.@+@.@@@@@..@@.@@@+++++@@@@@@@.@@@@.@.@.@@+++++@+@@@+@@@@@++++@+", +".@.@@@+@@++@@@@@@@@@@++@@+@.@..+@@@@@@@@+@++++@@+@@@@@@@+@+@@@@.@+@.@@@@@@@@@@@@@+@+++@+@+@@@@@@@.@.@.@@.@@++++++++@+@+@+@++++@+", +"@@@@@@@@@@@@@@.@.@.+@@@+@@+@.+@@@++@@@@+++@+@+@@@@@@@+@+@+@+@@+@.@.@@@@@@@@.@@@+.@+++++@+@+@.@.@+@@@@@+@+@.++@@@++@+@++@+@@++@@+", +"@@@@+++@+@+@@@.@@@@.@.@+@@@@@@@+++++@@@+@+++@@@@@@@@@@@@@@@+@@@.@+@.+@@@@@++@+@+@@@@++@+++@@@@@@@@@@@++@@@@+@@@@+++@++@+@@@@++@+", +"+@@@+++@@@@@@@@@+@@@@@@.@@@@@+@+@+++@@+@++@@@.@@@@@@@+@@@@@@+@@@@@+.@@@@@@@+++++@.@@@++@@+@@.@@@@+++++++@@@+@+@.@++@+@++@@@++@@@", +"+@@@+@@+@+@+@@.@@@@@+@@@@@+@@@@@++++@@@+++@+@@@@@+@@@@@.@@@+@@+@@@.@+@@@@@+@+++@+@@@+@@@@@.@@@+@@@@@@++@@@@@@@@@@++@@+@+@@@@++@+", +"@@@@@+@++@@@.@@++@@@@@@+@@++++@+@++++.+@@@@@@@@@@@.@@@@@+@@+@+@+++.+@@+@++@+@+@+@++@@+@+@@@@@@@@@@++@+@+@+@@+@@+@+@.++@@@@.@@@@@", +"@@@@@@++@+@@@+@@@@@@@@@@@@++.+@@@@+@+++@@@@@@@@@@@+@@+@+@@+@@@++@++@@@@@@@+.@@@@@@.@+@+@+@@@+@+@@+@@@+@.+@@+@@@@@@@@@@@@+@@@@@@@", +"@@@@@@@@@@+@@@@@+@@@@@+@@++@+++@@@@+++@@+@+@+@+@+++@@@@@@+@@+@+@++@@@+@@@@@@@@@@+@@@@@@@@+.@@+@@@+@+@+@+@+@@@@@+@+@@@@@@++@@@@@@", +"@@@+@@@@@@@@++@@@@@+@+@@+@++@@@@@@@@+@@@+@++@++++@++@+@+@@@+@++@++@@@+@@@+@@@+@@@+@+@@+@+@@@@@@+@@+@@++@+++@@@+++@@@@@@+@@@@@++@", +"@@@@@@@@@@+@@@@@@@+@@@@+@@@@@@@+@+@@+@@++@+@+@@+++@++@@@@+@@++++@+++@@+@+@@@@@@+@@@@+@@+@@@@@@+@@@+@+@++@@++@+@+@+@+@@+@@+@+@@@+", +"@@@@+@@@+@+@+@@++@+@+@@@+@@+@@@+@+@+@++@++@++@++@@++@@@@@@@+++@++@+@@@@@+@+@@@@@@+@@@+++@+@@@@@@@@+@@+@@@++++@+@@+++++@+@+@+@@++", +"@@@@@+@+@+++@@+@++@@+@+@@@+@+@+++@@@++@+@@+@+@+@++@++@@@@@@@@@+@+++@@@@+@@@++++@@@@++@+@+@@@@@@@@@@@@++@+++++@@+@@+@+@+@@+@@@@@+", +"################################################################################################################################", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"}; diff --git a/clients/riscos/title_inactive_left.xpm b/clients/riscos/title_inactive_left.xpm new file mode 100644 index 0000000000..75fe33cb47 --- /dev/null +++ b/clients/riscos/title_inactive_left.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char * title_inactive_left_xpm[] = { +"2 18 5 1", +" c None", +". c #FFFFFF", +"+ c #DDDDDD", +"@ c #BBBBBB", +"# c #777777", +"..", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".+", +".@", +"@#"}; diff --git a/clients/riscos/title_inactive_right.xpm b/clients/riscos/title_inactive_right.xpm new file mode 100644 index 0000000000..5e834b7842 --- /dev/null +++ b/clients/riscos/title_inactive_right.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static char * title_inactive_right_xpm[] = { +"2 18 6 1", +" c None", +". c #FFFFFF", +"+ c #BBBBBB", +"@ c #777777", +"# c #999999", +"$ c #555555", +".+", +"+@", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"#$", +"$$"}; diff --git a/clients/riscos/title_left.xpm b/clients/riscos/title_left.xpm new file mode 100644 index 0000000000..29d486428c --- /dev/null +++ b/clients/riscos/title_left.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * title_left_xpm[] = { +"2 20 4 1", +"f c #FFFFFF", +"- c #DCDCDC", +"/ c #C3C3C3", +"o c #000000", +"ff", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f-", +"f/", +"/o"}; + diff --git a/clients/riscos/title_right.xpm b/clients/riscos/title_right.xpm new file mode 100644 index 0000000000..53bad7504f --- /dev/null +++ b/clients/riscos/title_right.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * title_right_xpm[] = { +"2 20 4 1", +"f c #FFFFFF", +"/ c #C3C3C3", +". c #585858", +"o c #000000", +"f/", +"/o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +".o", +"oo"}; + + diff --git a/clients/riscos/unmax.xpm b/clients/riscos/unmax.xpm new file mode 100644 index 0000000000..c34135bf12 --- /dev/null +++ b/clients/riscos/unmax.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * unmax_xpm[] = { +"12 12 7 1", +" c None", +". c #5A5A5A", +"+ c #7B7B7B", +"@ c #BDBDBD", +"# c #FFFFFF", +"$ c #DEDEDE", +"% c #9C9C9C", +"..........+@", +".#########@$", +".# +#", +".# .#", +".# .#", +".# .#", +".# .#", +".# .#", +".# .#", +".# .#", +".@+........#", +"%$##########"};