Many behavioural fixes and new glyphs for buttons.
Still need to do sticky and help buttons. svn path=/trunk/kdebase/kwin/; revision=65548icc-effect-5.14.5
parent
625d26a6ef
commit
3e5e774e10
|
@ -26,13 +26,13 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
Button::Button(QWidget * parent, SymbolType t)
|
Button::Button(QWidget * parent)
|
||||||
: QWidget (parent, "Button", WRepaintNoErase | WPaintUnclipped),
|
: QWidget (parent, "Button"),
|
||||||
type_ (t),
|
alignment_(Left),
|
||||||
align_ (Left),
|
|
||||||
down_ (false),
|
down_ (false),
|
||||||
active_ (false)
|
active_ (false)
|
||||||
{
|
{
|
||||||
|
setBackgroundColor(Qt::black);
|
||||||
setFixedSize(19, 20);
|
setFixedSize(19, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,29 +42,54 @@ Button::~Button()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Button::updateDisplay()
|
Button::setAlignment(Alignment a)
|
||||||
{
|
{
|
||||||
setBackgroundPixmap(
|
alignment_ = a;
|
||||||
Static::instance()->button(type_, active_, down_)
|
repaint();
|
||||||
);
|
|
||||||
|
|
||||||
repaint(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Button::setType(SymbolType t)
|
|
||||||
{
|
|
||||||
type_ = t;
|
|
||||||
updateDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Button::setActive(bool b)
|
Button::setActive(bool b)
|
||||||
{
|
{
|
||||||
active_ = b;
|
active_ = b;
|
||||||
updateDisplay();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button::Alignment
|
||||||
|
Button::alignment() const
|
||||||
|
{
|
||||||
|
return alignment_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Button::mousePressEvent(QMouseEvent *)
|
||||||
|
{
|
||||||
|
down_ = true;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Button::mouseReleaseEvent(QMouseEvent *)
|
||||||
|
{
|
||||||
|
down_ = false;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Button::setPixmap(const QPixmap & p)
|
||||||
|
{
|
||||||
|
pixmap_ = p;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Button::paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
bitBlt(this, alignment_ == Left ? 1 : 0, 0,
|
||||||
|
&Static::instance()->buttonBase(active_, down_));
|
||||||
|
bitBlt(this, alignment_ == Left ? 4 : 3, 4, &pixmap_);
|
||||||
|
}
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
// vim:ts=2:sw=2:tw=78
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#ifndef RISC_OS_BUTTON_H
|
#ifndef RISC_OS_BUTTON_H
|
||||||
#define RISC_OS_BUTTON_H
|
#define RISC_OS_BUTTON_H
|
||||||
|
|
||||||
#include "Static.h"
|
#include <qpixmap.h>
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
|
@ -37,29 +37,29 @@ class Button : public QWidget
|
||||||
|
|
||||||
enum Alignment { Left, Right };
|
enum Alignment { Left, Right };
|
||||||
|
|
||||||
Button(QWidget * parent, SymbolType);
|
Button(QWidget * parent);
|
||||||
virtual ~Button();
|
virtual ~Button();
|
||||||
|
|
||||||
void updateDisplay();
|
|
||||||
|
|
||||||
void setAlign(Alignment a) { align_ = a; updateDisplay(); }
|
|
||||||
void setType(SymbolType t);
|
|
||||||
|
|
||||||
|
void setAlignment(Alignment);
|
||||||
void setActive(bool);
|
void setActive(bool);
|
||||||
|
|
||||||
|
Alignment alignment() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool active() const { return active_; }
|
void paintEvent(QPaintEvent *);
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *) { down_ = true; updateDisplay(); }
|
void mousePressEvent(QMouseEvent *);
|
||||||
void mouseReleaseEvent(QMouseEvent *) { down_ = false; updateDisplay(); }
|
void mouseReleaseEvent(QMouseEvent *);
|
||||||
|
|
||||||
|
void setPixmap(const QPixmap &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SymbolType type_;
|
Alignment alignment_;
|
||||||
Alignment align_;
|
|
||||||
bool down_;
|
bool down_;
|
||||||
bool active_;
|
bool active_;
|
||||||
|
QPixmap pixmap_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -25,9 +25,29 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char * const close_xpm[] = {
|
||||||
|
"12 12 3 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #FFFFFF",
|
||||||
|
" .. .. ",
|
||||||
|
". +. .+ .",
|
||||||
|
".+ +. .+ +.",
|
||||||
|
" .+ +..+ +. ",
|
||||||
|
" .+ + +. ",
|
||||||
|
" .+ + . ",
|
||||||
|
" . + +. ",
|
||||||
|
" .+ + +. ",
|
||||||
|
" .+ +..+ +. ",
|
||||||
|
".+ +. .+ +.",
|
||||||
|
". +. .+ .",
|
||||||
|
" .. .. "};
|
||||||
|
|
||||||
CloseButton::CloseButton(QWidget * parent)
|
CloseButton::CloseButton(QWidget * parent)
|
||||||
: Button(parent, Close)
|
: Button(parent)
|
||||||
{
|
{
|
||||||
|
setPixmap(QPixmap((const char **)close_xpm));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 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 <qwidget.h>
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
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() = 0;
|
|
||||||
|
|
||||||
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
|
|
|
@ -25,9 +25,29 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char * const iconify_xpm[] = {
|
||||||
|
"12 12 3 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #FFFFFF",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" .......... ",
|
||||||
|
".+ + + + + .",
|
||||||
|
". + + + + +.",
|
||||||
|
" .......... ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
||||||
|
|
||||||
IconifyButton::IconifyButton(QWidget * parent)
|
IconifyButton::IconifyButton(QWidget * parent)
|
||||||
: Button(parent, Iconify)
|
: Button(parent)
|
||||||
{
|
{
|
||||||
|
setPixmap(QPixmap((const char **)iconify_xpm));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -53,8 +73,6 @@ IconifyButton::mouseReleaseEvent(QMouseEvent * e)
|
||||||
emit(iconifyClient());
|
emit(iconifyClient());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End namespace;
|
} // End namespace;
|
||||||
|
|
|
@ -25,9 +25,29 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char * const lower_xpm[] = {
|
||||||
|
"12 12 3 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #FFFFFF",
|
||||||
|
" ..... ",
|
||||||
|
".+ + +. ",
|
||||||
|
". + + . ",
|
||||||
|
".+ + +. ",
|
||||||
|
". + + ..... ",
|
||||||
|
".+ + .+ + +.",
|
||||||
|
". + +. + + .",
|
||||||
|
" .....+ + +.",
|
||||||
|
" . + + .",
|
||||||
|
" .+ + +.",
|
||||||
|
" . + + .",
|
||||||
|
" ..... "};
|
||||||
|
|
||||||
LowerButton::LowerButton(QWidget * parent)
|
LowerButton::LowerButton(QWidget * parent)
|
||||||
: Button(parent, Lower)
|
: Button(parent)
|
||||||
{
|
{
|
||||||
|
setPixmap(QPixmap((const char **)lower_xpm));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -46,7 +66,6 @@ LowerButton::mouseReleaseEvent(QMouseEvent * e)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End namespace;
|
} // End namespace;
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
// vim:ts=2:sw=2:tw=78
|
||||||
|
|
|
@ -5,16 +5,10 @@ lib_LTLIBRARIES = libkwinriscos.la
|
||||||
libkwinriscos_la_SOURCES = \
|
libkwinriscos_la_SOURCES = \
|
||||||
Button.cpp \
|
Button.cpp \
|
||||||
CloseButton.cpp \
|
CloseButton.cpp \
|
||||||
DBWidget.cpp \
|
|
||||||
IconifyButton.cpp \
|
IconifyButton.cpp \
|
||||||
LowerButton.cpp \
|
LowerButton.cpp \
|
||||||
Manager.cpp \
|
Manager.cpp \
|
||||||
MaximiseButton.cpp \
|
MaximiseButton.cpp \
|
||||||
ResizeBar.cpp \
|
|
||||||
ResizeMid.cpp \
|
|
||||||
ResizeSide.cpp \
|
|
||||||
TitleBar.cpp \
|
|
||||||
TitleText.cpp \
|
|
||||||
Static.cpp
|
Static.cpp
|
||||||
libkwinriscos_la_LIBADD = ../../kwin.la
|
libkwinriscos_la_LIBADD = ../../kwin.la
|
||||||
libkwinriscos_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
|
libkwinriscos_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
|
||||||
|
@ -23,16 +17,11 @@ METASOURCES = AUTO
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
Button.h \
|
Button.h \
|
||||||
CloseButton.h \
|
CloseButton.h \
|
||||||
DBWidget.h \
|
|
||||||
IconifyButton.h \
|
IconifyButton.h \
|
||||||
LowerButton.h \
|
LowerButton.h \
|
||||||
Manager.h \
|
|
||||||
MaximiseButton.h \
|
MaximiseButton.h \
|
||||||
ResizeBar.h \
|
StickyButton.h \
|
||||||
ResizeMid.h \
|
Manager.h \
|
||||||
ResizeSide.h \
|
|
||||||
TitleBar.h \
|
|
||||||
TitleText.h \
|
|
||||||
Static.h
|
Static.h
|
||||||
|
|
||||||
lnkdir = $(kde_datadir)/kwin/
|
lnkdir = $(kde_datadir)/kwin/
|
||||||
|
|
|
@ -22,14 +22,15 @@
|
||||||
|
|
||||||
#include <qpainter.h>
|
#include <qpainter.h>
|
||||||
#include <qlayout.h>
|
#include <qlayout.h>
|
||||||
|
|
||||||
#include "../../options.h"
|
#include "../../options.h"
|
||||||
#include "../../workspace.h"
|
#include "../../workspace.h"
|
||||||
|
|
||||||
#include "Manager.h"
|
#include "Manager.h"
|
||||||
#include "Static.h"
|
#include "Static.h"
|
||||||
#include "TitleBar.h"
|
#include "LowerButton.h"
|
||||||
#include "ResizeBar.h"
|
#include "CloseButton.h"
|
||||||
|
#include "IconifyButton.h"
|
||||||
|
#include "MaximiseButton.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -54,10 +55,43 @@ Manager::Manager(
|
||||||
|
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
|
|
||||||
titleBar_ = new TitleBar(this);
|
QVBoxLayout * l = new QVBoxLayout(this, 0, 0);
|
||||||
resizeBar_ = new ResizeBar(this, this);
|
|
||||||
|
|
||||||
activateLayout();
|
lower_ = new LowerButton (this);
|
||||||
|
close_ = new CloseButton (this);
|
||||||
|
iconify_ = new IconifyButton (this);
|
||||||
|
maximise_ = new MaximiseButton (this);
|
||||||
|
|
||||||
|
lower_ ->setAlignment(Button::Left);
|
||||||
|
close_ ->setAlignment(Button::Left);
|
||||||
|
iconify_ ->setAlignment(Button::Right);
|
||||||
|
maximise_ ->setAlignment(Button::Right);
|
||||||
|
|
||||||
|
// Lower | Close | Text | Iconify | Maximise
|
||||||
|
|
||||||
|
QHBoxLayout * titleLayout = new QHBoxLayout(l);
|
||||||
|
|
||||||
|
titleLayout->addWidget(lower_);
|
||||||
|
titleLayout->addWidget(close_);
|
||||||
|
titleSpacer_ = new QSpacerItem(0, 20);
|
||||||
|
titleLayout->addItem(titleSpacer_);
|
||||||
|
titleLayout->addWidget(iconify_);
|
||||||
|
titleLayout->addWidget(maximise_);
|
||||||
|
|
||||||
|
QHBoxLayout * midLayout = new QHBoxLayout(l);
|
||||||
|
midLayout->addSpacing(1);
|
||||||
|
midLayout->addWidget(windowWrapper());
|
||||||
|
midLayout->addSpacing(1);
|
||||||
|
|
||||||
|
l->addSpacing(10);
|
||||||
|
|
||||||
|
connect(lower_, SIGNAL(lowerClient()), this, SLOT(lower()));
|
||||||
|
connect(close_, SIGNAL(closeClient()), this, SLOT(closeWindow()));
|
||||||
|
connect(iconify_, SIGNAL(iconifyClient()), this, SLOT(iconify()));
|
||||||
|
connect(maximise_, SIGNAL(maximiseClient()), this, SLOT(maximize()));
|
||||||
|
connect(maximise_, SIGNAL(vMaxClient()), this, SLOT(vMax()));
|
||||||
|
connect(maximise_, SIGNAL(raiseClient()), this, SLOT(raise()));
|
||||||
|
connect(this, SIGNAL(maximiseChanged(bool)), maximise_,SLOT(setOn(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager::~Manager()
|
Manager::~Manager()
|
||||||
|
@ -68,26 +102,26 @@ Manager::~Manager()
|
||||||
Manager::slotReset()
|
Manager::slotReset()
|
||||||
{
|
{
|
||||||
Static::instance()->update();
|
Static::instance()->update();
|
||||||
_updateDisplay();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::captionChange(const QString &)
|
Manager::captionChange(const QString &)
|
||||||
{
|
{
|
||||||
titleBar_->updateText();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::paletteChange(const QPalette &)
|
Manager::paletteChange(const QPalette &)
|
||||||
{
|
{
|
||||||
Static::instance()->update();
|
Static::instance()->update();
|
||||||
_updateDisplay();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::activeChange(bool b)
|
Manager::activeChange(bool)
|
||||||
{
|
{
|
||||||
titleBar_->setActive(b);
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -96,22 +130,11 @@ Manager::maximizeChange(bool b)
|
||||||
emit(maximiseChanged(b));
|
emit(maximiseChanged(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Manager::_updateDisplay()
|
|
||||||
{
|
|
||||||
titleBar_->updateDisplay();
|
|
||||||
resizeBar_->updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Manager::setShade(bool)
|
|
||||||
{
|
|
||||||
// Wait for parent class version to work.
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::paintEvent(QPaintEvent * e)
|
Manager::paintEvent(QPaintEvent * e)
|
||||||
{
|
{
|
||||||
|
QPainter p(this);
|
||||||
|
|
||||||
QRect r(e->rect());
|
QRect r(e->rect());
|
||||||
|
|
||||||
bool intersectsLeft =
|
bool intersectsLeft =
|
||||||
|
@ -122,7 +145,6 @@ Manager::paintEvent(QPaintEvent * e)
|
||||||
|
|
||||||
if (intersectsLeft || intersectsRight) {
|
if (intersectsLeft || intersectsRight) {
|
||||||
|
|
||||||
QPainter p(this);
|
|
||||||
p.setPen(Qt::black);
|
p.setPen(Qt::black);
|
||||||
|
|
||||||
if (intersectsLeft)
|
if (intersectsLeft)
|
||||||
|
@ -131,15 +153,35 @@ Manager::paintEvent(QPaintEvent * e)
|
||||||
if (intersectsRight)
|
if (intersectsRight)
|
||||||
p.drawLine(width() - 1, r.top(), width() - 1, r.bottom());
|
p.drawLine(width() - 1, r.top(), width() - 1, r.bottom());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Client::MousePosition
|
Static * s = Static::instance();
|
||||||
Manager::mousePosition(const QPoint & p) const
|
|
||||||
{
|
bool active = isActive();
|
||||||
if (titleBar_->rect().contains(p))
|
|
||||||
return Client::Center;
|
QRect tr = titleSpacer_->geometry();
|
||||||
else
|
|
||||||
return Client::Nowhere;
|
|
||||||
|
// Title bar.
|
||||||
|
p.drawPixmap(tr.left(), 0, s->titleTextLeft(active));
|
||||||
|
|
||||||
|
p.drawTiledPixmap(tr.left() + 3, 0, tr.width() - 6, 20, s->titleTextMid(active));
|
||||||
|
p.setPen(options->color(Options::Font, active));
|
||||||
|
p.setFont(options->font());
|
||||||
|
p.drawText(tr.left() + 4, 0, tr.width() - 8, 18, AlignCenter, caption());
|
||||||
|
|
||||||
|
p.drawPixmap(tr.right() - 2, 0, s->titleTextRight(active));
|
||||||
|
|
||||||
|
// Resize bar.
|
||||||
|
|
||||||
|
int rbt = height() - 10; // Resize bar top.
|
||||||
|
|
||||||
|
p.drawPixmap(0, rbt, s->resize(active));
|
||||||
|
|
||||||
|
p.drawPixmap(30, rbt, s->resizeMidLeft(active));
|
||||||
|
p.drawTiledPixmap(32, rbt, width() - 34, 10, s->resizeMidMid(active));
|
||||||
|
p.drawPixmap(width() - 32, rbt, s->resizeMidRight(active));
|
||||||
|
|
||||||
|
p.drawPixmap(width() - 30, rbt, s->resize(active));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -161,43 +203,72 @@ Manager::vMax()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::resizeEvent(QResizeEvent * e)
|
Manager::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
Client::resizeEvent(e);
|
int sizeProblem = 0;
|
||||||
_updateLayout();
|
|
||||||
|
if (width() < 80) sizeProblem = 3;
|
||||||
|
else if (width() < 100) sizeProblem = 2;
|
||||||
|
else if (width() < 120) sizeProblem = 1;
|
||||||
|
|
||||||
|
switch (sizeProblem) {
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
lower_ ->hide();
|
||||||
|
iconify_ ->show();
|
||||||
|
maximise_ ->hide();
|
||||||
|
close_ ->show();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
lower_ ->hide();
|
||||||
|
iconify_ ->hide();
|
||||||
|
maximise_ ->hide();
|
||||||
|
close_ ->show();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
lower_ ->hide();
|
||||||
|
iconify_ ->hide();
|
||||||
|
maximise_ ->hide();
|
||||||
|
close_ ->hide();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
lower_ ->show();
|
||||||
|
iconify_ ->show();
|
||||||
|
maximise_ ->show();
|
||||||
|
close_ ->show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Client::MousePosition
|
||||||
|
Manager::mousePosition(const QPoint & p) const
|
||||||
|
{
|
||||||
|
MousePosition m = Center;
|
||||||
|
|
||||||
|
if (p.y() > (height() - 10)) {
|
||||||
|
// Keep order !
|
||||||
|
if (p.x() >= (width() - 30))
|
||||||
|
m = BottomRight;
|
||||||
|
else if (p.x() <= 30)
|
||||||
|
m = BottomLeft;
|
||||||
|
else
|
||||||
|
m = Bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::_updateLayout()
|
Manager::mouseDoubleClickEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
titleBar_ -> setGeometry(0, 0, width(), 20);
|
if (titleSpacer_->geometry().contains(e->pos()))
|
||||||
windowWrapper() -> setGeometry(1, 20, width() - 2, height() - 30);
|
workspace()
|
||||||
resizeBar_ -> setGeometry(0, height() - 10, width(), 10);
|
->performWindowOperation(this, options->operationTitlebarDblClick());
|
||||||
|
workspace()->requestFocus(this);
|
||||||
_updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Manager::activateLayout()
|
|
||||||
{
|
|
||||||
_updateLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Manager::fakeMouseEvent(QMouseEvent * e, QWidget * w)
|
|
||||||
{
|
|
||||||
QPoint adjustedPos = w->pos() + e->pos();
|
|
||||||
|
|
||||||
QMouseEvent fake(e->type(), adjustedPos, e->button(), e->state());
|
|
||||||
|
|
||||||
Client::event(&fake);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Manager::mouseDoubleClickEvent( QMouseEvent * )
|
|
||||||
{
|
|
||||||
workspace()->performWindowOperation( this, options->operationTitlebarDblClick() );
|
|
||||||
workspace()->requestFocus( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -25,11 +25,15 @@
|
||||||
|
|
||||||
#include "../../client.h"
|
#include "../../client.h"
|
||||||
|
|
||||||
|
class QSpacerItem;
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
class TitleBar;
|
class LowerButton;
|
||||||
class ResizeBar;
|
class CloseButton;
|
||||||
|
class IconifyButton;
|
||||||
|
class MaximiseButton;
|
||||||
|
|
||||||
class Manager : public Client
|
class Manager : public Client
|
||||||
{
|
{
|
||||||
|
@ -40,10 +44,6 @@ class Manager : public Client
|
||||||
Manager(Workspace *, WId, QWidget * parent = 0, const char * name = 0);
|
Manager(Workspace *, WId, QWidget * parent = 0, const char * name = 0);
|
||||||
~Manager();
|
~Manager();
|
||||||
|
|
||||||
void setShade(bool);
|
|
||||||
|
|
||||||
void fakeMouseEvent(QMouseEvent *, QWidget *);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void maximiseChanged(bool);
|
void maximiseChanged(bool);
|
||||||
|
@ -62,9 +62,8 @@ class Manager : public Client
|
||||||
void maximizeChange(bool);
|
void maximizeChange(bool);
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
void resizeEvent(QResizeEvent *);
|
void resizeEvent(QResizeEvent *);
|
||||||
void activateLayout();
|
void mouseDoubleClickEvent(QMouseEvent *);
|
||||||
void mouseDoubleClickEvent( QMouseEvent * );
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void captionChange(const QString &);
|
void captionChange(const QString &);
|
||||||
|
@ -72,12 +71,13 @@ class Manager : public Client
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void _updateDisplay();
|
LowerButton * lower_;
|
||||||
void _updateLayout();
|
CloseButton * close_;
|
||||||
|
|
||||||
TitleBar * titleBar_;
|
|
||||||
ResizeBar * resizeBar_;
|
|
||||||
|
|
||||||
|
IconifyButton * iconify_;
|
||||||
|
MaximiseButton * maximise_;
|
||||||
|
|
||||||
|
QSpacerItem * titleSpacer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -25,16 +25,56 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char * const maximise_xpm[] = {
|
||||||
|
"12 12 3 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #FFFFFF",
|
||||||
|
" .......... ",
|
||||||
|
".+ + + + + .",
|
||||||
|
". + + + + +.",
|
||||||
|
".+ + + + + .",
|
||||||
|
". + + + + +.",
|
||||||
|
".+ + + + + .",
|
||||||
|
". + + + + +.",
|
||||||
|
".+ + + + + .",
|
||||||
|
". + + + + +.",
|
||||||
|
".+ + + + + .",
|
||||||
|
". + + + + +.",
|
||||||
|
" .......... "};
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char * const unmaximise_xpm[] = {
|
||||||
|
"12 12 3 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #FFFFFF",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ...... ",
|
||||||
|
" .+ + + . ",
|
||||||
|
" . + + +. ",
|
||||||
|
" .+ + + . ",
|
||||||
|
" . + + +. ",
|
||||||
|
" .+ + + . ",
|
||||||
|
" . + + +. ",
|
||||||
|
" ...... ",
|
||||||
|
" ",
|
||||||
|
" "};
|
||||||
|
|
||||||
MaximiseButton::MaximiseButton(QWidget * parent)
|
MaximiseButton::MaximiseButton(QWidget * parent)
|
||||||
: Button(parent, Max)
|
: Button(parent),
|
||||||
|
on_(false)
|
||||||
{
|
{
|
||||||
|
setPixmap(QPixmap((const char **)maximise_xpm));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MaximiseButton::setOn(bool on)
|
MaximiseButton::setOn(bool on)
|
||||||
{
|
{
|
||||||
setType(on ? Unmax: Max);
|
on_ = on;
|
||||||
updateDisplay();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -49,6 +49,10 @@ class MaximiseButton : public Button
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void mouseReleaseEvent(QMouseEvent *);
|
void mouseReleaseEvent(QMouseEvent *);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool on_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
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",
|
|
||||||
".++++++++++.",
|
|
||||||
"+@########@+",
|
|
||||||
"+##########+",
|
|
||||||
"+##########+",
|
|
||||||
"+##########+",
|
|
||||||
"+##########+",
|
|
||||||
"+##########+",
|
|
||||||
"+##########+",
|
|
||||||
"+##########+",
|
|
||||||
"+##########+",
|
|
||||||
"+@########@+",
|
|
||||||
".++++++++++."};
|
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ResizeBar.h"
|
|
||||||
#include "ResizeMid.h"
|
|
||||||
#include "ResizeSide.h"
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
|
|
||||||
namespace RiscOS
|
|
||||||
{
|
|
||||||
|
|
||||||
ResizeBar::ResizeBar(QWidget * parent, Manager * client)
|
|
||||||
: QWidget (parent, "ResizeBar"),
|
|
||||||
client_ (client)
|
|
||||||
{
|
|
||||||
setBackgroundMode(NoBackground);
|
|
||||||
|
|
||||||
left_ = new ResizeSide(this, client_, ResizeSide::Left);
|
|
||||||
mid_ = new ResizeMid(this, client_);
|
|
||||||
right_ = new ResizeSide(this, client_, ResizeSide::Right);
|
|
||||||
|
|
||||||
mid_->move(30, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ResizeBar::updateDisplay()
|
|
||||||
{
|
|
||||||
left_ ->updateDisplay();
|
|
||||||
mid_ ->updateDisplay();
|
|
||||||
right_->updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ResizeBar::resizeEvent(QResizeEvent *)
|
|
||||||
{
|
|
||||||
mid_->resize(width() - 60, 10);
|
|
||||||
right_->move(width() - 30, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End namespace
|
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
|
||||||
#include "ResizeBar.moc"
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RISC_OS_RESIZE_BAR_H
|
|
||||||
#define RISC_OS_RESIZE_BAR_H
|
|
||||||
|
|
||||||
#include <qwidget.h>
|
|
||||||
|
|
||||||
namespace RiscOS
|
|
||||||
{
|
|
||||||
|
|
||||||
class Manager;
|
|
||||||
|
|
||||||
class ResizeMid;
|
|
||||||
class ResizeSide;
|
|
||||||
|
|
||||||
class ResizeBar : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ResizeBar(QWidget * parent, Manager * client);
|
|
||||||
void updateDisplay();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Manager * client_;
|
|
||||||
|
|
||||||
ResizeSide * left_;
|
|
||||||
ResizeMid * mid_;
|
|
||||||
ResizeSide * right_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // End namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
#include "ResizeSide.h"
|
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.h"
|
|
||||||
|
|
||||||
namespace RiscOS
|
|
||||||
{
|
|
||||||
|
|
||||||
ResizeSide::ResizeSide(QWidget * parent, Manager * client, Side s)
|
|
||||||
: QWidget (parent, "ResizeSide", WRepaintNoErase | WPaintUnclipped)
|
|
||||||
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
|
|
|
@ -1,55 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RISC_OS_RESIZE_SIDE_H
|
|
||||||
#define RISC_OS_RESIZE_SIDE_H
|
|
||||||
|
|
||||||
#include <qwidget.h>
|
|
||||||
|
|
||||||
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
|
|
|
@ -1,78 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
#include "ResizeMid.h"
|
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.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
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 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
|
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
#include "ResizeRight.h"
|
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.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
|
|
|
@ -1,82 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
#include "ResizeSide.h"
|
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.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
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RISC_OS_RESIZE_SIDE_H
|
|
||||||
#define RISC_OS_RESIZE_SIDE_H
|
|
||||||
|
|
||||||
#include <qwidget.h>
|
|
||||||
|
|
||||||
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
|
|
|
@ -95,138 +95,6 @@ Static::_drawBorder(QPixmap & pix, int w, int h)
|
||||||
painter_.drawPoint(w - 1, h - 1);
|
painter_.drawPoint(w - 1, h - 1);
|
||||||
painter_.drawPoint(w, h);
|
painter_.drawPoint(w, h);
|
||||||
|
|
||||||
painter_.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
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_[3]));
|
|
||||||
|
|
||||||
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, 12, 12);
|
|
||||||
|
|
||||||
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();
|
painter_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,65 +118,54 @@ setPalette(Palette & pal, QColor c)
|
||||||
pal[7] = c.dark(300).rgb();
|
pal[7] = c.dark(300).rgb();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
setInversePalette(Palette & pal, QColor c)
|
|
||||||
{
|
|
||||||
pal[4] = c.rgb();
|
|
||||||
|
|
||||||
int h, s, v;
|
|
||||||
c.hsv(&h, &s, &v);
|
|
||||||
|
|
||||||
if (v < 72)
|
|
||||||
c.setHsv(h, s, 72);
|
|
||||||
|
|
||||||
pal[7] = c.light(200).rgb();
|
|
||||||
pal[6] = c.light(166).rgb();
|
|
||||||
pal[5] = c.light(125).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;
|
Static * Static::instance_ = 0L;
|
||||||
|
|
||||||
void
|
void
|
||||||
Static::_init()
|
Static::_init()
|
||||||
{
|
{
|
||||||
buttonPixmaps_.append(&aIconify_);
|
aResize_ .resize(30, 10);
|
||||||
buttonPixmaps_.append(&aClose_);
|
iResize_ .resize(30, 10);
|
||||||
buttonPixmaps_.append(&aLower_);
|
aTitleTextLeft_ .resize(3, 20);
|
||||||
buttonPixmaps_.append(&aMax_);
|
aTitleTextRight_ .resize(3, 20);
|
||||||
buttonPixmaps_.append(&aUnmax_);
|
iTitleTextLeft_ .resize(3, 20);
|
||||||
buttonPixmaps_.append(&iIconify_);
|
iTitleTextRight_ .resize(3, 20);
|
||||||
buttonPixmaps_.append(&iClose_);
|
aTitleTextMid_ .resize(128, 20);
|
||||||
buttonPixmaps_.append(&iLower_);
|
iTitleTextMid_ .resize(128, 20);
|
||||||
buttonPixmaps_.append(&iMax_);
|
aResizeMidLeft_ .resize(3, 12);
|
||||||
buttonPixmaps_.append(&iUnmax_);
|
aResizeMidRight_ .resize(3, 12);
|
||||||
buttonPixmaps_.append(&aIconifyDown_);
|
iResizeMidLeft_ .resize(3, 12);
|
||||||
buttonPixmaps_.append(&aCloseDown_);
|
iResizeMidRight_ .resize(3, 12);
|
||||||
buttonPixmaps_.append(&aLowerDown_);
|
aResizeMid_ .resize(128, 10);
|
||||||
buttonPixmaps_.append(&aMaxDown_);
|
iResizeMid_ .resize(128, 10);
|
||||||
buttonPixmaps_.append(&aUnmaxDown_);
|
aButtonUp_ .resize(19, 19);
|
||||||
buttonPixmaps_.append(&iIconifyDown_);
|
iButtonUp_ .resize(19, 19);
|
||||||
buttonPixmaps_.append(&iCloseDown_);
|
aButtonDown_ .resize(19, 19);
|
||||||
buttonPixmaps_.append(&iLowerDown_);
|
iButtonDown_ .resize(19, 19);
|
||||||
buttonPixmaps_.append(&iMaxDown_);
|
|
||||||
buttonPixmaps_.append(&iUnmaxDown_);
|
|
||||||
|
|
||||||
for (QListIterator<QPixmap> it(buttonPixmaps_); it.current(); ++it) {
|
aResize_ .fill(Qt::black);
|
||||||
|
iResize_ .fill(Qt::black);
|
||||||
|
aTitleTextLeft_ .fill(Qt::black);
|
||||||
|
aTitleTextRight_ .fill(Qt::black);
|
||||||
|
iTitleTextLeft_ .fill(Qt::black);
|
||||||
|
iTitleTextRight_ .fill(Qt::black);
|
||||||
|
aTitleTextMid_ .fill(Qt::black);
|
||||||
|
iTitleTextMid_ .fill(Qt::black);
|
||||||
|
aResizeMidLeft_ .fill(Qt::black);
|
||||||
|
aResizeMidRight_ .fill(Qt::black);
|
||||||
|
iResizeMidLeft_ .fill(Qt::black);
|
||||||
|
iResizeMidRight_ .fill(Qt::black);
|
||||||
|
aResizeMid_ .fill(Qt::black);
|
||||||
|
iResizeMid_ .fill(Qt::black);
|
||||||
|
aButtonUp_ .fill(Qt::black);
|
||||||
|
iButtonUp_ .fill(Qt::black);
|
||||||
|
aButtonDown_ .fill(Qt::black);
|
||||||
|
iButtonDown_ .fill(Qt::black);
|
||||||
|
|
||||||
it.current()->setOptimization(QPixmap::MemoryOptim);
|
aButtonUp_ .setOptimization(QPixmap::MemoryOptim);
|
||||||
it.current()->resize(19, 20);
|
aButtonDown_ .setOptimization(QPixmap::MemoryOptim);
|
||||||
it.current()->fill(Qt::black);
|
|
||||||
}
|
|
||||||
|
|
||||||
aResize_.setOptimization(QPixmap::MemoryOptim);
|
iButtonUp_ .setOptimization(QPixmap::MemoryOptim);
|
||||||
iResize_.setOptimization(QPixmap::MemoryOptim);
|
iButtonDown_ .setOptimization(QPixmap::MemoryOptim);
|
||||||
aResize_.resize(30, 10);
|
|
||||||
iResize_.resize(30, 10);
|
|
||||||
aResize_.fill(Qt::black);
|
|
||||||
iResize_.fill(Qt::black);
|
|
||||||
|
|
||||||
aTitleTextLeft_ .setOptimization(QPixmap::BestOptim);
|
aTitleTextLeft_ .setOptimization(QPixmap::BestOptim);
|
||||||
aTitleTextRight_ .setOptimization(QPixmap::BestOptim);
|
aTitleTextRight_ .setOptimization(QPixmap::BestOptim);
|
||||||
|
@ -326,35 +183,8 @@ Static::_init()
|
||||||
iResizeMidRight_ .setOptimization(QPixmap::BestOptim);
|
iResizeMidRight_ .setOptimization(QPixmap::BestOptim);
|
||||||
iResizeMid_ .setOptimization(QPixmap::BestOptim);
|
iResizeMid_ .setOptimization(QPixmap::BestOptim);
|
||||||
|
|
||||||
aTitleTextLeft_ .resize(3, 20);
|
aResize_ .setOptimization(QPixmap::BestOptim);
|
||||||
aTitleTextRight_ .resize(3, 20);
|
iResize_ .setOptimization(QPixmap::BestOptim);
|
||||||
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();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -367,25 +197,12 @@ Static::update()
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
Palette aBut, iBut;
|
Palette aBut, iBut;
|
||||||
Palette aSym, iSym;
|
|
||||||
|
|
||||||
if (QPixmap::defaultDepth() > 8) {
|
if (QPixmap::defaultDepth() > 8) {
|
||||||
|
|
||||||
setPalette(aBut, options->color(Options::ButtonBg, true));
|
setPalette(aBut, options->color(Options::ButtonBg, true));
|
||||||
setPalette(iBut, options->color(Options::ButtonBg, false));
|
setPalette(iBut, options->color(Options::ButtonBg, false));
|
||||||
|
|
||||||
QColor btnForeground;
|
|
||||||
if(qGray(options->color(Options::ButtonBg, true).rgb()) > 128)
|
|
||||||
btnForeground = Qt::black;
|
|
||||||
else
|
|
||||||
btnForeground = Qt::white;
|
|
||||||
setInversePalette(aSym, btnForeground);
|
|
||||||
if(qGray(options->color(Options::ButtonBg, false).rgb()) > 128)
|
|
||||||
btnForeground = Qt::black;
|
|
||||||
else
|
|
||||||
btnForeground = Qt::white;
|
|
||||||
setInversePalette(iSym, btnForeground);
|
|
||||||
|
|
||||||
setPalette(aTitlePal_, options->color(Options::TitleBar, true));
|
setPalette(aTitlePal_, options->color(Options::TitleBar, true));
|
||||||
setPalette(iTitlePal_, options->color(Options::TitleBar, false));
|
setPalette(iTitlePal_, options->color(Options::TitleBar, false));
|
||||||
|
|
||||||
|
@ -493,85 +310,18 @@ Static::update()
|
||||||
|
|
||||||
down_ = false;
|
down_ = false;
|
||||||
|
|
||||||
|
transx = 0.0;
|
||||||
palette_ = aBut;
|
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_);
|
|
||||||
|
|
||||||
|
palette_ = aBut;
|
||||||
|
_drawButtonBorder(aButtonUp_);
|
||||||
down_ = true;
|
down_ = true;
|
||||||
|
_drawButtonBorder(aButtonDown_);
|
||||||
palette_ = aBut;
|
|
||||||
transx = transy = 1.0;
|
|
||||||
_drawButtonBorder(aCloseDown_);
|
|
||||||
_drawButtonBorder(aLowerDown_);
|
|
||||||
transx = 0.0;
|
|
||||||
_drawButtonBorder(aIconifyDown_);
|
|
||||||
_drawButtonBorder(aMaxDown_);
|
|
||||||
_drawButtonBorder(aUnmaxDown_);
|
|
||||||
|
|
||||||
palette_ = iBut;
|
palette_ = iBut;
|
||||||
transx = transy = 1.0;
|
_drawButtonBorder(iButtonDown_);
|
||||||
_drawButtonBorder(iCloseDown_);
|
down_ = false;
|
||||||
_drawButtonBorder(iLowerDown_);
|
_drawButtonBorder(iButtonUp_);
|
||||||
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
|
// Resize handles
|
||||||
|
@ -588,38 +338,19 @@ Static::update()
|
||||||
_drawBorder(iResize_, 28, 7);
|
_drawBorder(iResize_, 28, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap
|
const QPixmap &
|
||||||
Static::button(SymbolType t, bool active, bool down)
|
Static::buttonBase(bool active, bool down) const
|
||||||
{
|
{
|
||||||
QPixmap p(19, 20);
|
if (active)
|
||||||
|
if (down)
|
||||||
if (down) {
|
return aButtonDown_;
|
||||||
|
else
|
||||||
switch (t) {
|
return aButtonUp_;
|
||||||
|
else
|
||||||
case Iconify: p = active ? aIconifyDown_ : iIconifyDown_; break;
|
if (down)
|
||||||
case Close: p = active ? aCloseDown_ : iCloseDown_; break;
|
return iButtonDown_;
|
||||||
case Lower: p = active ? aLowerDown_ : iLowerDown_; break;
|
else
|
||||||
case Max: p = active ? aMaxDown_ : iMaxDown_; break;
|
return iButtonUp_;
|
||||||
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
|
} // End namespace
|
||||||
|
|
|
@ -61,41 +61,36 @@ class Static
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
QPixmap titleTextLeft(bool active)
|
const QPixmap & titleTextLeft(bool active) const
|
||||||
{ return active ? aTitleTextLeft_ : iTitleTextLeft_; }
|
{ return active ? aTitleTextLeft_ : iTitleTextLeft_; }
|
||||||
|
|
||||||
QPixmap titleTextRight(bool active)
|
const QPixmap & titleTextRight(bool active) const
|
||||||
{ return active ? aTitleTextRight_ : iTitleTextRight_; }
|
{ return active ? aTitleTextRight_ : iTitleTextRight_; }
|
||||||
|
|
||||||
QPixmap resizeMidLeft(bool active)
|
const QPixmap & resizeMidLeft(bool active) const
|
||||||
{ return active ? aResizeMidLeft_ : iResizeMidLeft_; }
|
{ return active ? aResizeMidLeft_ : iResizeMidLeft_; }
|
||||||
|
|
||||||
QPixmap resizeMidRight(bool active)
|
const QPixmap & resizeMidRight(bool active) const
|
||||||
{ return active ? aResizeMidRight_ : iResizeMidRight_; }
|
{ return active ? aResizeMidRight_ : iResizeMidRight_; }
|
||||||
|
|
||||||
QPixmap titleTextMid(bool active)
|
const QPixmap & titleTextMid(bool active) const
|
||||||
{ return active ? aTitleTextMid_ : iTitleTextMid_; }
|
{ return active ? aTitleTextMid_ : iTitleTextMid_; }
|
||||||
|
|
||||||
QPixmap resizeMidMid(bool active)
|
const QPixmap & resizeMidMid(bool active) const
|
||||||
{ return active ? aResizeMid_ : iResizeMid_; }
|
{ return active ? aResizeMid_ : iResizeMid_; }
|
||||||
|
|
||||||
QPixmap button(SymbolType t, bool active, bool down);
|
const QPixmap & buttonBase(bool active, bool down) const;
|
||||||
|
|
||||||
QPixmap resize(bool active)
|
const QPixmap & resize(bool active) const
|
||||||
{ return active ? aResize_ : iResize_; }
|
{ return active ? aResize_ : iResize_; }
|
||||||
|
|
||||||
Palette & standardPalette()
|
const Palette & standardPalette() const
|
||||||
{ return standardPal_; }
|
{ return standardPal_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void _drawButtonBorder (QPixmap &);
|
void _drawButtonBorder (QPixmap &);
|
||||||
void _drawBorder (QPixmap &, int, int);
|
void _drawBorder (QPixmap &, int, int);
|
||||||
void _drawCloseSymbol (QPixmap &);
|
|
||||||
void _drawIconifySymbol(QPixmap &);
|
|
||||||
void _drawLowerSymbol (QPixmap &);
|
|
||||||
void _drawMaxSymbol (QPixmap &);
|
|
||||||
void _drawUnmaxSymbol (QPixmap &);
|
|
||||||
|
|
||||||
void _init();
|
void _init();
|
||||||
|
|
||||||
|
@ -103,20 +98,17 @@ class Static
|
||||||
|
|
||||||
Palette standardPal_, aTitlePal_, iTitlePal_, aResizePal_, iResizePal_;
|
Palette standardPal_, aTitlePal_, iTitlePal_, aResizePal_, iResizePal_;
|
||||||
|
|
||||||
QPixmap aIconify_, aClose_, aLower_, aMax_, aUnmax_,
|
QPixmap
|
||||||
iIconify_, iClose_, iLower_, iMax_, iUnmax_,
|
aButtonUp_, iButtonUp_,
|
||||||
aResize_, iResize_,
|
aButtonDown_, iButtonDown_,
|
||||||
aIconifyDown_, aCloseDown_, aLowerDown_, aMaxDown_, aUnmaxDown_,
|
aResize_, iResize_,
|
||||||
iIconifyDown_, iCloseDown_, iLowerDown_, iMaxDown_, iUnmaxDown_,
|
aResizeDown_, iResizeDown_,
|
||||||
aResizeDown_, iResizeDown_,
|
aTitleTextLeft_, iTitleTextLeft_,
|
||||||
aTitleTextLeft_, aTitleTextRight_,
|
aTitleTextRight_, iTitleTextRight_,
|
||||||
aResizeMidLeft_, aResizeMidRight_,
|
aTitleTextMid_, iTitleTextMid_,
|
||||||
iTitleTextLeft_, iTitleTextRight_,
|
aResizeMidLeft_, iResizeMidLeft_,
|
||||||
iResizeMidLeft_, iResizeMidRight_,
|
aResizeMidRight_, iResizeMidRight_,
|
||||||
aTitleTextMid_, iTitleTextMid_,
|
aResizeMid_, iResizeMid_;
|
||||||
aResizeMid_, iResizeMid_;
|
|
||||||
|
|
||||||
QList<QPixmap> buttonPixmaps_;
|
|
||||||
|
|
||||||
QPainter painter_;
|
QPainter painter_;
|
||||||
bool down_;
|
bool down_;
|
||||||
|
|
|
@ -20,44 +20,59 @@
|
||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DBWidget.h"
|
#include "StickyButton.h"
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
DBWidget::DBWidget(QWidget * parent, const char * name)
|
/* XPM */
|
||||||
: QWidget(parent, name, WResizeNoErase | WRepaintNoErase | WPaintUnclipped)
|
static const char * const sticky_xpm[] = {
|
||||||
|
"12 12 3 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #FFFFFF",
|
||||||
|
" . ",
|
||||||
|
" . . ",
|
||||||
|
" . + . ",
|
||||||
|
" . + + .",
|
||||||
|
" .... + + . ",
|
||||||
|
" .+ + + . ",
|
||||||
|
" .+ + . ",
|
||||||
|
" .+ . ",
|
||||||
|
" . .+. ",
|
||||||
|
" . .+ ",
|
||||||
|
" . . ",
|
||||||
|
". "};
|
||||||
|
|
||||||
|
StickyButton::StickyButton(QWidget * parent)
|
||||||
|
: Button(parent),
|
||||||
|
on_(false)
|
||||||
{
|
{
|
||||||
buf_.resize(20, 20);
|
setPixmap(QPixmap((const char **)sticky_xpm));
|
||||||
setBackgroundMode(NoBackground);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DBWidget::updateDisplay()
|
StickyButton::setOn(bool on)
|
||||||
{
|
{
|
||||||
updatePixmap();
|
on_ = on;
|
||||||
repaint(false);
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DBWidget::paintEvent(QPaintEvent * e)
|
StickyButton::mouseReleaseEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
QRect r(e->rect());
|
Button::mouseReleaseEvent(e);
|
||||||
bitBlt(this, r.topLeft(), &buf_, r, Qt::CopyROP);
|
|
||||||
|
if (!rect().contains(e->pos()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (e->button())
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
} // End namespace
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
// vim:ts=2:sw=2:tw=78
|
||||||
|
#include "StickyButton.moc"
|
|
@ -20,30 +20,34 @@
|
||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RISC_OS_RESIZE_RIGHT_H
|
#ifndef RISC_OS_STICKY_BUTTON_H
|
||||||
#define RISC_OS_RESIZE_RIGHT_H
|
#define RISC_OS_STICKY_BUTTON_H
|
||||||
|
|
||||||
#include <qwidget.h>
|
#include "Button.h"
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
class Manager;
|
class StickyButton : public Button
|
||||||
|
|
||||||
class ResizeRight : public QWidget
|
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ResizeRight(QWidget * parent, Manager * client);
|
StickyButton(QWidget * parent);
|
||||||
void update();
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void setOn(bool);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void stickClient();
|
||||||
|
void unstickClient();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void mouseMoveEvent(QMouseEvent *);
|
void mouseReleaseEvent(QMouseEvent *);
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Manager * client_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
|
@ -1,145 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <qlayout.h>
|
|
||||||
|
|
||||||
#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(Manager * client)
|
|
||||||
: QWidget(client)
|
|
||||||
{
|
|
||||||
setBackgroundMode(NoBackground);
|
|
||||||
|
|
||||||
lower_ = new LowerButton (this);
|
|
||||||
close_ = new CloseButton (this);
|
|
||||||
text_ = new TitleText (this, client);
|
|
||||||
iconify_ = new IconifyButton (this);
|
|
||||||
maximise_ = new MaximiseButton (this);
|
|
||||||
|
|
||||||
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_);
|
|
||||||
|
|
||||||
connect(lower_, SIGNAL(lowerClient()), client, SLOT(lower()));
|
|
||||||
connect(close_, SIGNAL(closeClient()), client, SLOT(closeWindow()));
|
|
||||||
connect(iconify_, SIGNAL(iconifyClient()), client, SLOT(iconify()));
|
|
||||||
connect(maximise_, SIGNAL(maximiseClient()), client, SLOT(maximize()));
|
|
||||||
connect(maximise_, SIGNAL(vMaxClient()), client, SLOT(vMax()));
|
|
||||||
connect(maximise_, SIGNAL(raiseClient()), client, SLOT(raise()));
|
|
||||||
connect(client, SIGNAL(maximiseChanged(bool)), maximise_, SLOT(setOn(bool)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleBar::updateDisplay()
|
|
||||||
{
|
|
||||||
lower_ ->updateDisplay();
|
|
||||||
close_ ->updateDisplay();
|
|
||||||
text_ ->updateDisplay();
|
|
||||||
iconify_ ->updateDisplay();
|
|
||||||
maximise_ ->updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleBar::updateText()
|
|
||||||
{
|
|
||||||
text_->updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
TitleBar::~TitleBar()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleBar::resizeEvent(QResizeEvent *)
|
|
||||||
{
|
|
||||||
int sizeProblem = 0;
|
|
||||||
|
|
||||||
if (width() < 80) sizeProblem = 3;
|
|
||||||
else if (width() < 100) sizeProblem = 2;
|
|
||||||
else if (width() < 120) sizeProblem = 1;
|
|
||||||
|
|
||||||
switch (sizeProblem) {
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
lower_ ->hide();
|
|
||||||
iconify_ ->show();
|
|
||||||
maximise_ ->hide();
|
|
||||||
close_ ->show();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
lower_ ->hide();
|
|
||||||
iconify_ ->hide();
|
|
||||||
maximise_ ->hide();
|
|
||||||
close_ ->show();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
lower_ ->hide();
|
|
||||||
iconify_ ->hide();
|
|
||||||
maximise_ ->hide();
|
|
||||||
close_ ->hide();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0:
|
|
||||||
default:
|
|
||||||
lower_ ->show();
|
|
||||||
iconify_ ->show();
|
|
||||||
maximise_ ->show();
|
|
||||||
close_ ->show();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleBar::setActive(bool b)
|
|
||||||
{
|
|
||||||
lower_->setActive(b);
|
|
||||||
close_->setActive(b);
|
|
||||||
text_->setActive(b);
|
|
||||||
iconify_->setActive(b);
|
|
||||||
maximise_->setActive(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End namespace
|
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RISC_OS_TITLE_BAR_H
|
|
||||||
#define RISC_OS_TITLE_BAR_H
|
|
||||||
|
|
||||||
#include <qwidget.h>
|
|
||||||
|
|
||||||
namespace RiscOS
|
|
||||||
{
|
|
||||||
|
|
||||||
class Manager;
|
|
||||||
class LowerButton;
|
|
||||||
class CloseButton;
|
|
||||||
class TitleText;
|
|
||||||
class IconifyButton;
|
|
||||||
class MaximiseButton;
|
|
||||||
|
|
||||||
class TitleBar : public QWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
TitleBar(Manager * client);
|
|
||||||
virtual ~TitleBar();
|
|
||||||
|
|
||||||
void updateDisplay();
|
|
||||||
void updateText();
|
|
||||||
void updateMaximise(bool);
|
|
||||||
|
|
||||||
void setActive(bool);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
LowerButton * lower_;
|
|
||||||
CloseButton * close_;
|
|
||||||
|
|
||||||
TitleText * text_;
|
|
||||||
|
|
||||||
IconifyButton * iconify_;
|
|
||||||
MaximiseButton * maximise_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // End namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <qpainter.h>
|
|
||||||
|
|
||||||
#include "../../options.h"
|
|
||||||
|
|
||||||
#include "TitleText.h"
|
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.h"
|
|
||||||
|
|
||||||
namespace RiscOS
|
|
||||||
{
|
|
||||||
|
|
||||||
TitleText::TitleText(QWidget * parent, Manager * client)
|
|
||||||
: DBWidget(parent, "TitleText"),
|
|
||||||
client_(client),
|
|
||||||
active_(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
TitleText::~TitleText()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleText::setActive(bool b)
|
|
||||||
{
|
|
||||||
active_ = b;
|
|
||||||
updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleText::updatePixmap()
|
|
||||||
{
|
|
||||||
QPainter p(&buf());
|
|
||||||
|
|
||||||
Static * s = Static::instance();
|
|
||||||
|
|
||||||
p.drawPixmap(0, 0, s->titleTextLeft(active_));
|
|
||||||
p.drawPixmap(width() - 3, 0, s->titleTextRight(active_));
|
|
||||||
p.drawTiledPixmap(3, 0, width() - 6, 20, s->titleTextMid(active_));
|
|
||||||
p.setPen(options->color(Options::Font, active_));
|
|
||||||
p.setFont(options->font());
|
|
||||||
p.drawText(4, 0, width() - 8, 18, AlignCenter, client_->caption());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleText::mousePressEvent(QMouseEvent * e)
|
|
||||||
{
|
|
||||||
client_->fakeMouseEvent(e, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleText::mouseReleaseEvent(QMouseEvent * e)
|
|
||||||
{
|
|
||||||
client_->fakeMouseEvent(e, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleText::mouseMoveEvent(QMouseEvent * e)
|
|
||||||
{
|
|
||||||
client_->fakeMouseEvent(e, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TitleText::mouseDoubleClickEvent(QMouseEvent * e)
|
|
||||||
{
|
|
||||||
client_->fakeMouseEvent(e, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End namespace
|
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
/*
|
|
||||||
RISC OS KWin client
|
|
||||||
|
|
||||||
Copyright 2000
|
|
||||||
Rik Hemsley <rik@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RISC_OS_TITLE_TEXT_H
|
|
||||||
#define RISC_OS_TITLE_TEXT_H
|
|
||||||
|
|
||||||
#include <qwidget.h>
|
|
||||||
#include <qpoint.h>
|
|
||||||
|
|
||||||
#include "DBWidget.h"
|
|
||||||
|
|
||||||
namespace RiscOS
|
|
||||||
{
|
|
||||||
|
|
||||||
class Manager;
|
|
||||||
|
|
||||||
class TitleText : public DBWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
TitleText(QWidget * parent, Manager * client);
|
|
||||||
virtual ~TitleText();
|
|
||||||
|
|
||||||
void setActive(bool);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void updatePixmap();
|
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *);
|
|
||||||
void mouseReleaseEvent(QMouseEvent *);
|
|
||||||
void mouseMoveEvent(QMouseEvent *);
|
|
||||||
void mouseDoubleClickEvent(QMouseEvent *);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Manager * client_;
|
|
||||||
bool active_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // End namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
|
Loading…
Reference in New Issue