Many behavioural fixes and new glyphs for buttons.
Still need to do sticky and help buttons. svn path=/trunk/kdebase/kwin/; revision=65548
This commit is contained in:
parent
625d26a6ef
commit
3e5e774e10
29 changed files with 456 additions and 1653 deletions
|
@ -26,13 +26,13 @@
|
|||
namespace RiscOS
|
||||
{
|
||||
|
||||
Button::Button(QWidget * parent, SymbolType t)
|
||||
: QWidget (parent, "Button", WRepaintNoErase | WPaintUnclipped),
|
||||
type_ (t),
|
||||
align_ (Left),
|
||||
Button::Button(QWidget * parent)
|
||||
: QWidget (parent, "Button"),
|
||||
alignment_(Left),
|
||||
down_ (false),
|
||||
active_ (false)
|
||||
{
|
||||
setBackgroundColor(Qt::black);
|
||||
setFixedSize(19, 20);
|
||||
}
|
||||
|
||||
|
@ -42,29 +42,54 @@ Button::~Button()
|
|||
}
|
||||
|
||||
void
|
||||
Button::updateDisplay()
|
||||
Button::setAlignment(Alignment a)
|
||||
{
|
||||
setBackgroundPixmap(
|
||||
Static::instance()->button(type_, active_, down_)
|
||||
);
|
||||
|
||||
repaint(true);
|
||||
}
|
||||
|
||||
void
|
||||
Button::setType(SymbolType t)
|
||||
{
|
||||
type_ = t;
|
||||
updateDisplay();
|
||||
alignment_ = a;
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
Button::setActive(bool 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
|
||||
|
||||
// vim:ts=2:sw=2:tw=78
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef RISC_OS_BUTTON_H
|
||||
#define RISC_OS_BUTTON_H
|
||||
|
||||
#include "Static.h"
|
||||
#include <qpixmap.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
namespace RiscOS
|
||||
|
@ -37,29 +37,29 @@ class Button : public QWidget
|
|||
|
||||
enum Alignment { Left, Right };
|
||||
|
||||
Button(QWidget * parent, SymbolType);
|
||||
Button(QWidget * parent);
|
||||
virtual ~Button();
|
||||
|
||||
void updateDisplay();
|
||||
|
||||
void setAlign(Alignment a) { align_ = a; updateDisplay(); }
|
||||
void setType(SymbolType t);
|
||||
|
||||
void setAlignment(Alignment);
|
||||
void setActive(bool);
|
||||
|
||||
|
||||
Alignment alignment() const;
|
||||
|
||||
protected:
|
||||
|
||||
bool active() const { return active_; }
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
void mousePressEvent(QMouseEvent *) { down_ = true; updateDisplay(); }
|
||||
void mouseReleaseEvent(QMouseEvent *) { down_ = false; updateDisplay(); }
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
|
||||
void setPixmap(const QPixmap &);
|
||||
|
||||
private:
|
||||
|
||||
SymbolType type_;
|
||||
Alignment align_;
|
||||
Alignment alignment_;
|
||||
bool down_;
|
||||
bool active_;
|
||||
QPixmap pixmap_;
|
||||
};
|
||||
|
||||
} // End namespace
|
||||
|
|
|
@ -25,9 +25,29 @@
|
|||
namespace RiscOS
|
||||
{
|
||||
|
||||
/* XPM */
|
||||
static const char * const close_xpm[] = {
|
||||
"12 12 3 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #FFFFFF",
|
||||
" .. .. ",
|
||||
". +. .+ .",
|
||||
".+ +. .+ +.",
|
||||
" .+ +..+ +. ",
|
||||
" .+ + +. ",
|
||||
" .+ + . ",
|
||||
" . + +. ",
|
||||
" .+ + +. ",
|
||||
" .+ +..+ +. ",
|
||||
".+ +. .+ +.",
|
||||
". +. .+ .",
|
||||
" .. .. "};
|
||||
|
||||
CloseButton::CloseButton(QWidget * parent)
|
||||
: Button(parent, Close)
|
||||
: Button(parent)
|
||||
{
|
||||
setPixmap(QPixmap((const char **)close_xpm));
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
/* XPM */
|
||||
static const char * const iconify_xpm[] = {
|
||||
"12 12 3 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #FFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .......... ",
|
||||
".+ + + + + .",
|
||||
". + + + + +.",
|
||||
" .......... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
IconifyButton::IconifyButton(QWidget * parent)
|
||||
: Button(parent, Iconify)
|
||||
: Button(parent)
|
||||
{
|
||||
setPixmap(QPixmap((const char **)iconify_xpm));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -53,8 +73,6 @@ IconifyButton::mouseReleaseEvent(QMouseEvent * e)
|
|||
emit(iconifyClient());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // End namespace;
|
||||
|
|
|
@ -25,9 +25,29 @@
|
|||
namespace RiscOS
|
||||
{
|
||||
|
||||
/* XPM */
|
||||
static const char * const lower_xpm[] = {
|
||||
"12 12 3 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #FFFFFF",
|
||||
" ..... ",
|
||||
".+ + +. ",
|
||||
". + + . ",
|
||||
".+ + +. ",
|
||||
". + + ..... ",
|
||||
".+ + .+ + +.",
|
||||
". + +. + + .",
|
||||
" .....+ + +.",
|
||||
" . + + .",
|
||||
" .+ + +.",
|
||||
" . + + .",
|
||||
" ..... "};
|
||||
|
||||
LowerButton::LowerButton(QWidget * parent)
|
||||
: Button(parent, Lower)
|
||||
: Button(parent)
|
||||
{
|
||||
setPixmap(QPixmap((const char **)lower_xpm));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -46,7 +66,6 @@ LowerButton::mouseReleaseEvent(QMouseEvent * e)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
} // End namespace;
|
||||
|
||||
// vim:ts=2:sw=2:tw=78
|
||||
|
|
|
@ -5,16 +5,10 @@ lib_LTLIBRARIES = libkwinriscos.la
|
|||
libkwinriscos_la_SOURCES = \
|
||||
Button.cpp \
|
||||
CloseButton.cpp \
|
||||
DBWidget.cpp \
|
||||
IconifyButton.cpp \
|
||||
LowerButton.cpp \
|
||||
Manager.cpp \
|
||||
MaximiseButton.cpp \
|
||||
ResizeBar.cpp \
|
||||
ResizeMid.cpp \
|
||||
ResizeSide.cpp \
|
||||
TitleBar.cpp \
|
||||
TitleText.cpp \
|
||||
Static.cpp
|
||||
libkwinriscos_la_LIBADD = ../../kwin.la
|
||||
libkwinriscos_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
|
||||
|
@ -23,16 +17,11 @@ METASOURCES = AUTO
|
|||
noinst_HEADERS = \
|
||||
Button.h \
|
||||
CloseButton.h \
|
||||
DBWidget.h \
|
||||
IconifyButton.h \
|
||||
LowerButton.h \
|
||||
Manager.h \
|
||||
MaximiseButton.h \
|
||||
ResizeBar.h \
|
||||
ResizeMid.h \
|
||||
ResizeSide.h \
|
||||
TitleBar.h \
|
||||
TitleText.h \
|
||||
StickyButton.h \
|
||||
Manager.h \
|
||||
Static.h
|
||||
|
||||
lnkdir = $(kde_datadir)/kwin/
|
||||
|
|
|
@ -22,14 +22,15 @@
|
|||
|
||||
#include <qpainter.h>
|
||||
#include <qlayout.h>
|
||||
|
||||
#include "../../options.h"
|
||||
#include "../../workspace.h"
|
||||
|
||||
#include "Manager.h"
|
||||
#include "Static.h"
|
||||
#include "TitleBar.h"
|
||||
#include "ResizeBar.h"
|
||||
#include "LowerButton.h"
|
||||
#include "CloseButton.h"
|
||||
#include "IconifyButton.h"
|
||||
#include "MaximiseButton.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -54,10 +55,43 @@ Manager::Manager(
|
|||
|
||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||
|
||||
titleBar_ = new TitleBar(this);
|
||||
resizeBar_ = new ResizeBar(this, this);
|
||||
QVBoxLayout * l = new QVBoxLayout(this, 0, 0);
|
||||
|
||||
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()
|
||||
|
@ -68,26 +102,26 @@ Manager::~Manager()
|
|||
Manager::slotReset()
|
||||
{
|
||||
Static::instance()->update();
|
||||
_updateDisplay();
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
Manager::captionChange(const QString &)
|
||||
{
|
||||
titleBar_->updateText();
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
Manager::paletteChange(const QPalette &)
|
||||
{
|
||||
Static::instance()->update();
|
||||
_updateDisplay();
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
Manager::activeChange(bool b)
|
||||
Manager::activeChange(bool)
|
||||
{
|
||||
titleBar_->setActive(b);
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -96,22 +130,11 @@ Manager::maximizeChange(bool b)
|
|||
emit(maximiseChanged(b));
|
||||
}
|
||||
|
||||
void
|
||||
Manager::_updateDisplay()
|
||||
{
|
||||
titleBar_->updateDisplay();
|
||||
resizeBar_->updateDisplay();
|
||||
}
|
||||
|
||||
void
|
||||
Manager::setShade(bool)
|
||||
{
|
||||
// Wait for parent class version to work.
|
||||
}
|
||||
|
||||
void
|
||||
Manager::paintEvent(QPaintEvent * e)
|
||||
{
|
||||
QPainter p(this);
|
||||
|
||||
QRect r(e->rect());
|
||||
|
||||
bool intersectsLeft =
|
||||
|
@ -122,7 +145,6 @@ Manager::paintEvent(QPaintEvent * e)
|
|||
|
||||
if (intersectsLeft || intersectsRight) {
|
||||
|
||||
QPainter p(this);
|
||||
p.setPen(Qt::black);
|
||||
|
||||
if (intersectsLeft)
|
||||
|
@ -131,15 +153,35 @@ Manager::paintEvent(QPaintEvent * e)
|
|||
if (intersectsRight)
|
||||
p.drawLine(width() - 1, r.top(), width() - 1, r.bottom());
|
||||
}
|
||||
}
|
||||
|
||||
Client::MousePosition
|
||||
Manager::mousePosition(const QPoint & p) const
|
||||
{
|
||||
if (titleBar_->rect().contains(p))
|
||||
return Client::Center;
|
||||
else
|
||||
return Client::Nowhere;
|
||||
Static * s = Static::instance();
|
||||
|
||||
bool active = isActive();
|
||||
|
||||
QRect tr = titleSpacer_->geometry();
|
||||
|
||||
|
||||
// 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
|
||||
|
@ -161,43 +203,72 @@ Manager::vMax()
|
|||
}
|
||||
|
||||
void
|
||||
Manager::resizeEvent(QResizeEvent * e)
|
||||
Manager::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
Client::resizeEvent(e);
|
||||
_updateLayout();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
Manager::_updateLayout()
|
||||
Manager::mouseDoubleClickEvent(QMouseEvent * e)
|
||||
{
|
||||
titleBar_ -> setGeometry(0, 0, width(), 20);
|
||||
windowWrapper() -> setGeometry(1, 20, width() - 2, height() - 30);
|
||||
resizeBar_ -> setGeometry(0, height() - 10, width(), 10);
|
||||
|
||||
_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 );
|
||||
if (titleSpacer_->geometry().contains(e->pos()))
|
||||
workspace()
|
||||
->performWindowOperation(this, options->operationTitlebarDblClick());
|
||||
workspace()->requestFocus(this);
|
||||
}
|
||||
|
||||
} // End namespace
|
||||
|
|
|
@ -25,11 +25,15 @@
|
|||
|
||||
#include "../../client.h"
|
||||
|
||||
class QSpacerItem;
|
||||
|
||||
namespace RiscOS
|
||||
{
|
||||
|
||||
class TitleBar;
|
||||
class ResizeBar;
|
||||
class LowerButton;
|
||||
class CloseButton;
|
||||
class IconifyButton;
|
||||
class MaximiseButton;
|
||||
|
||||
class Manager : public Client
|
||||
{
|
||||
|
@ -40,10 +44,6 @@ class Manager : public Client
|
|||
Manager(Workspace *, WId, QWidget * parent = 0, const char * name = 0);
|
||||
~Manager();
|
||||
|
||||
void setShade(bool);
|
||||
|
||||
void fakeMouseEvent(QMouseEvent *, QWidget *);
|
||||
|
||||
signals:
|
||||
|
||||
void maximiseChanged(bool);
|
||||
|
@ -62,9 +62,8 @@ class Manager : public Client
|
|||
void maximizeChange(bool);
|
||||
void paintEvent(QPaintEvent *);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void activateLayout();
|
||||
void mouseDoubleClickEvent( QMouseEvent * );
|
||||
|
||||
void mouseDoubleClickEvent(QMouseEvent *);
|
||||
|
||||
protected slots:
|
||||
|
||||
void captionChange(const QString &);
|
||||
|
@ -72,12 +71,13 @@ class Manager : public Client
|
|||
|
||||
private:
|
||||
|
||||
void _updateDisplay();
|
||||
void _updateLayout();
|
||||
|
||||
TitleBar * titleBar_;
|
||||
ResizeBar * resizeBar_;
|
||||
LowerButton * lower_;
|
||||
CloseButton * close_;
|
||||
|
||||
IconifyButton * iconify_;
|
||||
MaximiseButton * maximise_;
|
||||
|
||||
QSpacerItem * titleSpacer_;
|
||||
};
|
||||
|
||||
} // End namespace
|
||||
|
|
|
@ -25,16 +25,56 @@
|
|||
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)
|
||||
: Button(parent, Max)
|
||||
: Button(parent),
|
||||
on_(false)
|
||||
{
|
||||
setPixmap(QPixmap((const char **)maximise_xpm));
|
||||
}
|
||||
|
||||
void
|
||||
MaximiseButton::setOn(bool on)
|
||||
{
|
||||
setType(on ? Unmax: Max);
|
||||
updateDisplay();
|
||||
on_ = on;
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -49,6 +49,10 @@ class MaximiseButton : public Button
|
|||
protected:
|
||||
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
|
||||
private:
|
||||
|
||||
bool on_;
|
||||
};
|
||||
|
||||
} // 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, 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();
|
||||
}
|
||||
|
||||
|
@ -250,65 +118,54 @@ setPalette(Palette & pal, QColor c)
|
|||
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;
|
||||
|
||||
void
|
||||
Static::_init()
|
||||
{
|
||||
buttonPixmaps_.append(&aIconify_);
|
||||
buttonPixmaps_.append(&aClose_);
|
||||
buttonPixmaps_.append(&aLower_);
|
||||
buttonPixmaps_.append(&aMax_);
|
||||
buttonPixmaps_.append(&aUnmax_);
|
||||
buttonPixmaps_.append(&iIconify_);
|
||||
buttonPixmaps_.append(&iClose_);
|
||||
buttonPixmaps_.append(&iLower_);
|
||||
buttonPixmaps_.append(&iMax_);
|
||||
buttonPixmaps_.append(&iUnmax_);
|
||||
buttonPixmaps_.append(&aIconifyDown_);
|
||||
buttonPixmaps_.append(&aCloseDown_);
|
||||
buttonPixmaps_.append(&aLowerDown_);
|
||||
buttonPixmaps_.append(&aMaxDown_);
|
||||
buttonPixmaps_.append(&aUnmaxDown_);
|
||||
buttonPixmaps_.append(&iIconifyDown_);
|
||||
buttonPixmaps_.append(&iCloseDown_);
|
||||
buttonPixmaps_.append(&iLowerDown_);
|
||||
buttonPixmaps_.append(&iMaxDown_);
|
||||
buttonPixmaps_.append(&iUnmaxDown_);
|
||||
aResize_ .resize(30, 10);
|
||||
iResize_ .resize(30, 10);
|
||||
aTitleTextLeft_ .resize(3, 20);
|
||||
aTitleTextRight_ .resize(3, 20);
|
||||
iTitleTextLeft_ .resize(3, 20);
|
||||
iTitleTextRight_ .resize(3, 20);
|
||||
aTitleTextMid_ .resize(128, 20);
|
||||
iTitleTextMid_ .resize(128, 20);
|
||||
aResizeMidLeft_ .resize(3, 12);
|
||||
aResizeMidRight_ .resize(3, 12);
|
||||
iResizeMidLeft_ .resize(3, 12);
|
||||
iResizeMidRight_ .resize(3, 12);
|
||||
aResizeMid_ .resize(128, 10);
|
||||
iResizeMid_ .resize(128, 10);
|
||||
aButtonUp_ .resize(19, 19);
|
||||
iButtonUp_ .resize(19, 19);
|
||||
aButtonDown_ .resize(19, 19);
|
||||
iButtonDown_ .resize(19, 19);
|
||||
|
||||
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);
|
||||
it.current()->resize(19, 20);
|
||||
it.current()->fill(Qt::black);
|
||||
}
|
||||
aButtonUp_ .setOptimization(QPixmap::MemoryOptim);
|
||||
aButtonDown_ .setOptimization(QPixmap::MemoryOptim);
|
||||
|
||||
aResize_.setOptimization(QPixmap::MemoryOptim);
|
||||
iResize_.setOptimization(QPixmap::MemoryOptim);
|
||||
aResize_.resize(30, 10);
|
||||
iResize_.resize(30, 10);
|
||||
aResize_.fill(Qt::black);
|
||||
iResize_.fill(Qt::black);
|
||||
iButtonUp_ .setOptimization(QPixmap::MemoryOptim);
|
||||
iButtonDown_ .setOptimization(QPixmap::MemoryOptim);
|
||||
|
||||
aTitleTextLeft_ .setOptimization(QPixmap::BestOptim);
|
||||
aTitleTextRight_ .setOptimization(QPixmap::BestOptim);
|
||||
|
@ -326,35 +183,8 @@ Static::_init()
|
|||
iResizeMidRight_ .setOptimization(QPixmap::BestOptim);
|
||||
iResizeMid_ .setOptimization(QPixmap::BestOptim);
|
||||
|
||||
aTitleTextLeft_ .resize(3, 20);
|
||||
aTitleTextRight_ .resize(3, 20);
|
||||
aTitleTextLeft_ .fill(Qt::black);
|
||||
aTitleTextRight_ .fill(Qt::black);
|
||||
|
||||
iTitleTextLeft_ .resize(3, 20);
|
||||
iTitleTextRight_ .resize(3, 20);
|
||||
iTitleTextLeft_ .fill(Qt::black);
|
||||
iTitleTextRight_ .fill(Qt::black);
|
||||
|
||||
aTitleTextMid_ .resize(128, 20);
|
||||
iTitleTextMid_ .resize(128, 20);
|
||||
aTitleTextMid_ .fill(Qt::black);
|
||||
iTitleTextMid_ .fill(Qt::black);
|
||||
|
||||
aResizeMidLeft_ .resize(3, 12);
|
||||
aResizeMidRight_ .resize(3, 12);
|
||||
aResizeMidLeft_ .fill(Qt::black);
|
||||
aResizeMidRight_ .fill(Qt::black);
|
||||
|
||||
iResizeMidLeft_ .resize(3, 12);
|
||||
iResizeMidRight_ .resize(3, 12);
|
||||
iResizeMidLeft_ .fill(Qt::black);
|
||||
iResizeMidRight_ .fill(Qt::black);
|
||||
|
||||
aResizeMid_ .resize(128, 10);
|
||||
iResizeMid_ .resize(128, 10);
|
||||
aResizeMid_ .fill(Qt::black);
|
||||
iResizeMid_ .fill(Qt::black);
|
||||
aResize_ .setOptimization(QPixmap::BestOptim);
|
||||
iResize_ .setOptimization(QPixmap::BestOptim);
|
||||
|
||||
update();
|
||||
}
|
||||
|
@ -367,25 +197,12 @@ Static::update()
|
|||
// -------------------------------------------------------------------------
|
||||
|
||||
Palette aBut, iBut;
|
||||
Palette aSym, iSym;
|
||||
|
||||
if (QPixmap::defaultDepth() > 8) {
|
||||
|
||||
setPalette(aBut, options->color(Options::ButtonBg, true));
|
||||
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(iTitlePal_, options->color(Options::TitleBar, false));
|
||||
|
||||
|
@ -493,85 +310,18 @@ Static::update()
|
|||
|
||||
down_ = false;
|
||||
|
||||
transx = 0.0;
|
||||
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;
|
||||
|
||||
palette_ = aBut;
|
||||
transx = transy = 1.0;
|
||||
_drawButtonBorder(aCloseDown_);
|
||||
_drawButtonBorder(aLowerDown_);
|
||||
transx = 0.0;
|
||||
_drawButtonBorder(aIconifyDown_);
|
||||
_drawButtonBorder(aMaxDown_);
|
||||
_drawButtonBorder(aUnmaxDown_);
|
||||
_drawButtonBorder(aButtonDown_);
|
||||
|
||||
palette_ = iBut;
|
||||
transx = transy = 1.0;
|
||||
_drawButtonBorder(iCloseDown_);
|
||||
_drawButtonBorder(iLowerDown_);
|
||||
transx = 0.0;
|
||||
_drawButtonBorder(iIconifyDown_);
|
||||
_drawButtonBorder(iMaxDown_);
|
||||
_drawButtonBorder(iUnmaxDown_);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Button symbols
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
transy = 4.0;
|
||||
|
||||
palette_ = aSym;
|
||||
|
||||
transx = 4.0;
|
||||
_drawCloseSymbol (aClose_);
|
||||
_drawLowerSymbol (aLower_);
|
||||
transx = 3.0;
|
||||
_drawIconifySymbol (aIconify_);
|
||||
_drawMaxSymbol (aMax_);
|
||||
_drawUnmaxSymbol (aUnmax_);
|
||||
|
||||
transx = 4.0;
|
||||
_drawCloseSymbol (aCloseDown_);
|
||||
_drawLowerSymbol (aLowerDown_);
|
||||
transx = 3.0;
|
||||
_drawIconifySymbol (aIconifyDown_);
|
||||
_drawMaxSymbol (aMaxDown_);
|
||||
_drawUnmaxSymbol (aUnmaxDown_);
|
||||
|
||||
palette_ = iSym;
|
||||
|
||||
transx = 4.0;
|
||||
_drawCloseSymbol (iClose_);
|
||||
_drawLowerSymbol (iLower_);
|
||||
transx = 3.0;
|
||||
_drawIconifySymbol (iIconify_);
|
||||
_drawMaxSymbol (iMax_);
|
||||
_drawUnmaxSymbol (iUnmax_);
|
||||
|
||||
transx = 4.0;
|
||||
_drawCloseSymbol (iCloseDown_);
|
||||
_drawLowerSymbol (iLowerDown_);
|
||||
transx = 3.0;
|
||||
_drawIconifySymbol (iIconifyDown_);
|
||||
_drawMaxSymbol (iMaxDown_);
|
||||
_drawUnmaxSymbol (iUnmaxDown_);
|
||||
_drawButtonBorder(iButtonDown_);
|
||||
down_ = false;
|
||||
_drawButtonBorder(iButtonUp_);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Resize handles
|
||||
|
@ -588,38 +338,19 @@ Static::update()
|
|||
_drawBorder(iResize_, 28, 7);
|
||||
}
|
||||
|
||||
QPixmap
|
||||
Static::button(SymbolType t, bool active, bool down)
|
||||
const QPixmap &
|
||||
Static::buttonBase(bool active, bool down) const
|
||||
{
|
||||
QPixmap p(19, 20);
|
||||
|
||||
if (down) {
|
||||
|
||||
switch (t) {
|
||||
|
||||
case Iconify: p = active ? aIconifyDown_ : iIconifyDown_; break;
|
||||
case Close: p = active ? aCloseDown_ : iCloseDown_; break;
|
||||
case Lower: p = active ? aLowerDown_ : iLowerDown_; break;
|
||||
case Max: p = active ? aMaxDown_ : iMaxDown_; break;
|
||||
case Unmax: p = active ? aUnmaxDown_ : iUnmaxDown_; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
switch (t) {
|
||||
|
||||
case Iconify: p = active ? aIconify_ : iIconify_; break;
|
||||
case Close: p = active ? aClose_ : iClose_; break;
|
||||
case Lower: p = active ? aLower_ : iLower_; break;
|
||||
case Max: p = active ? aMax_ : iMax_; break;
|
||||
case Unmax: p = active ? aUnmax_ : iUnmax_; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return p;
|
||||
if (active)
|
||||
if (down)
|
||||
return aButtonDown_;
|
||||
else
|
||||
return aButtonUp_;
|
||||
else
|
||||
if (down)
|
||||
return iButtonDown_;
|
||||
else
|
||||
return iButtonUp_;
|
||||
}
|
||||
|
||||
} // End namespace
|
||||
|
|
|
@ -61,41 +61,36 @@ class Static
|
|||
|
||||
void update();
|
||||
|
||||
QPixmap titleTextLeft(bool active)
|
||||
const QPixmap & titleTextLeft(bool active) const
|
||||
{ return active ? aTitleTextLeft_ : iTitleTextLeft_; }
|
||||
|
||||
QPixmap titleTextRight(bool active)
|
||||
const QPixmap & titleTextRight(bool active) const
|
||||
{ return active ? aTitleTextRight_ : iTitleTextRight_; }
|
||||
|
||||
QPixmap resizeMidLeft(bool active)
|
||||
const QPixmap & resizeMidLeft(bool active) const
|
||||
{ return active ? aResizeMidLeft_ : iResizeMidLeft_; }
|
||||
|
||||
QPixmap resizeMidRight(bool active)
|
||||
const QPixmap & resizeMidRight(bool active) const
|
||||
{ return active ? aResizeMidRight_ : iResizeMidRight_; }
|
||||
|
||||
QPixmap titleTextMid(bool active)
|
||||
const QPixmap & titleTextMid(bool active) const
|
||||
{ return active ? aTitleTextMid_ : iTitleTextMid_; }
|
||||
|
||||
QPixmap resizeMidMid(bool active)
|
||||
const QPixmap & resizeMidMid(bool active) const
|
||||
{ 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_; }
|
||||
|
||||
Palette & standardPalette()
|
||||
const Palette & standardPalette() const
|
||||
{ return standardPal_; }
|
||||
|
||||
private:
|
||||
|
||||
void _drawButtonBorder (QPixmap &);
|
||||
void _drawBorder (QPixmap &, int, int);
|
||||
void _drawCloseSymbol (QPixmap &);
|
||||
void _drawIconifySymbol(QPixmap &);
|
||||
void _drawLowerSymbol (QPixmap &);
|
||||
void _drawMaxSymbol (QPixmap &);
|
||||
void _drawUnmaxSymbol (QPixmap &);
|
||||
|
||||
void _init();
|
||||
|
||||
|
@ -103,20 +98,17 @@ class Static
|
|||
|
||||
Palette standardPal_, aTitlePal_, iTitlePal_, aResizePal_, iResizePal_;
|
||||
|
||||
QPixmap aIconify_, aClose_, aLower_, aMax_, aUnmax_,
|
||||
iIconify_, iClose_, iLower_, iMax_, iUnmax_,
|
||||
aResize_, iResize_,
|
||||
aIconifyDown_, aCloseDown_, aLowerDown_, aMaxDown_, aUnmaxDown_,
|
||||
iIconifyDown_, iCloseDown_, iLowerDown_, iMaxDown_, iUnmaxDown_,
|
||||
aResizeDown_, iResizeDown_,
|
||||
aTitleTextLeft_, aTitleTextRight_,
|
||||
aResizeMidLeft_, aResizeMidRight_,
|
||||
iTitleTextLeft_, iTitleTextRight_,
|
||||
iResizeMidLeft_, iResizeMidRight_,
|
||||
aTitleTextMid_, iTitleTextMid_,
|
||||
aResizeMid_, iResizeMid_;
|
||||
|
||||
QList<QPixmap> buttonPixmaps_;
|
||||
QPixmap
|
||||
aButtonUp_, iButtonUp_,
|
||||
aButtonDown_, iButtonDown_,
|
||||
aResize_, iResize_,
|
||||
aResizeDown_, iResizeDown_,
|
||||
aTitleTextLeft_, iTitleTextLeft_,
|
||||
aTitleTextRight_, iTitleTextRight_,
|
||||
aTitleTextMid_, iTitleTextMid_,
|
||||
aResizeMidLeft_, iResizeMidLeft_,
|
||||
aResizeMidRight_, iResizeMidRight_,
|
||||
aResizeMid_, iResizeMid_;
|
||||
|
||||
QPainter painter_;
|
||||
bool down_;
|
||||
|
|
|
@ -20,44 +20,59 @@
|
|||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "DBWidget.h"
|
||||
#include "StickyButton.h"
|
||||
|
||||
namespace RiscOS
|
||||
{
|
||||
|
||||
DBWidget::DBWidget(QWidget * parent, const char * name)
|
||||
: QWidget(parent, name, WResizeNoErase | WRepaintNoErase | WPaintUnclipped)
|
||||
/* XPM */
|
||||
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);
|
||||
setBackgroundMode(NoBackground);
|
||||
setPixmap(QPixmap((const char **)sticky_xpm));
|
||||
}
|
||||
|
||||
void
|
||||
DBWidget::updateDisplay()
|
||||
StickyButton::setOn(bool on)
|
||||
{
|
||||
updatePixmap();
|
||||
repaint(false);
|
||||
on_ = on;
|
||||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
DBWidget::paintEvent(QPaintEvent * e)
|
||||
StickyButton::mouseReleaseEvent(QMouseEvent * e)
|
||||
{
|
||||
QRect r(e->rect());
|
||||
bitBlt(this, r.topLeft(), &buf_, r, Qt::CopyROP);
|
||||
Button::mouseReleaseEvent(e);
|
||||
|
||||
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
|
||||
|
||||
// vim:ts=2:sw=2:tw=78
|
||||
#include "StickyButton.moc"
|
|
@ -20,30 +20,34 @@
|
|||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef RISC_OS_RESIZE_RIGHT_H
|
||||
#define RISC_OS_RESIZE_RIGHT_H
|
||||
#ifndef RISC_OS_STICKY_BUTTON_H
|
||||
#define RISC_OS_STICKY_BUTTON_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "Button.h"
|
||||
|
||||
namespace RiscOS
|
||||
{
|
||||
|
||||
class Manager;
|
||||
|
||||
class ResizeRight : public QWidget
|
||||
class StickyButton : public Button
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
ResizeRight(QWidget * parent, Manager * client);
|
||||
void update();
|
||||
StickyButton(QWidget * parent);
|
||||
|
||||
public slots:
|
||||
|
||||
void setOn(bool);
|
||||
|
||||
signals:
|
||||
|
||||
void stickClient();
|
||||
void unstickClient();
|
||||
|
||||
protected:
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *);
|
||||
|
||||
private:
|
||||
|
||||
Manager * client_;
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
};
|
||||
|
||||
} // 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 a new issue