2000-04-10 17:18:21 +00:00
|
|
|
/*
|
2000-07-15 11:27:55 +00:00
|
|
|
RISC OS KWin client
|
2000-04-10 17:18:21 +00:00
|
|
|
|
|
|
|
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 <qlayout.h>
|
|
|
|
|
|
|
|
#include "../../options.h"
|
|
|
|
#include "../../workspace.h"
|
|
|
|
|
|
|
|
#include "Manager.h"
|
|
|
|
#include "Static.h"
|
|
|
|
#include "TitleBar.h"
|
|
|
|
#include "ResizeBar.h"
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
Client * allocate(Workspace * workSpace, WId winId)
|
|
|
|
{
|
2000-07-15 11:27:55 +00:00
|
|
|
return new RiscOS::Manager(workSpace, winId);
|
2000-04-10 17:18:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-07-15 11:27:55 +00:00
|
|
|
namespace RiscOS
|
2000-04-10 17:18:21 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
Manager::Manager(
|
|
|
|
Workspace * workSpace,
|
|
|
|
WId id,
|
|
|
|
QWidget * parent,
|
|
|
|
const char * name
|
|
|
|
)
|
2000-04-12 00:13:14 +00:00
|
|
|
: Client(workSpace, id, parent, name)
|
2000-04-10 17:18:21 +00:00
|
|
|
{
|
|
|
|
setBackgroundMode(NoBackground);
|
|
|
|
|
|
|
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
|
|
|
|
2000-05-11 03:52:24 +00:00
|
|
|
titleBar_ = new TitleBar(this);
|
2000-04-10 17:18:21 +00:00
|
|
|
resizeBar_ = new ResizeBar(this, this);
|
|
|
|
|
2000-05-11 03:52:24 +00:00
|
|
|
activateLayout();
|
2000-04-10 17:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Manager::~Manager()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Manager::slotReset()
|
|
|
|
{
|
|
|
|
Static::instance()->update();
|
2000-05-11 03:52:24 +00:00
|
|
|
_updateDisplay();
|
2000-04-10 17:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Manager::captionChange(const QString &)
|
|
|
|
{
|
|
|
|
titleBar_->updateText();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Manager::paletteChange(const QPalette &)
|
|
|
|
{
|
|
|
|
Static::instance()->update();
|
2000-05-11 03:52:24 +00:00
|
|
|
_updateDisplay();
|
2000-04-10 17:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-05-11 03:52:24 +00:00
|
|
|
Manager::activeChange(bool b)
|
2000-04-10 17:18:21 +00:00
|
|
|
{
|
2000-05-11 03:52:24 +00:00
|
|
|
titleBar_->setActive(b);
|
2000-04-10 17:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Manager::maximizeChange(bool b)
|
|
|
|
{
|
2000-05-11 03:52:24 +00:00
|
|
|
emit(maximiseChanged(b));
|
2000-04-10 17:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-05-11 03:52:24 +00:00
|
|
|
Manager::_updateDisplay()
|
2000-04-10 17:18:21 +00:00
|
|
|
{
|
|
|
|
titleBar_->updateDisplay();
|
|
|
|
resizeBar_->updateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Manager::setShade(bool)
|
|
|
|
{
|
2000-05-04 23:12:29 +00:00
|
|
|
// Wait for parent class version to work.
|
2000-04-10 17:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Manager::paintEvent(QPaintEvent * e)
|
|
|
|
{
|
|
|
|
QRect r(e->rect());
|
|
|
|
|
|
|
|
bool intersectsLeft =
|
|
|
|
r.intersects(QRect(0, 0, 1, height()));
|
|
|
|
|
|
|
|
bool intersectsRight =
|
|
|
|
r.intersects(QRect(width() - 1, 0, width(), height()));
|
|
|
|
|
|
|
|
if (intersectsLeft || intersectsRight) {
|
|
|
|
|
|
|
|
QPainter p(this);
|
|
|
|
p.setPen(Qt::black);
|
|
|
|
|
|
|
|
if (intersectsLeft)
|
|
|
|
p.drawLine(0, r.top(), 0, r.bottom());
|
|
|
|
|
|
|
|
if (intersectsRight)
|
|
|
|
p.drawLine(width() - 1, r.top(), width() - 1, r.bottom());
|
|
|
|
}
|
|
|
|
}
|
2000-05-10 19:55:13 +00:00
|
|
|
|
2000-05-11 03:52:24 +00:00
|
|
|
Client::MousePosition
|
|
|
|
Manager::mousePosition(const QPoint & p) const
|
|
|
|
{
|
|
|
|
if (titleBar_->rect().contains(p))
|
|
|
|
return Client::Center;
|
|
|
|
else
|
|
|
|
return Client::Nowhere;
|
|
|
|
}
|
|
|
|
|
2000-05-10 19:55:13 +00:00
|
|
|
void
|
2000-07-15 11:27:55 +00:00
|
|
|
Manager::lower()
|
2000-05-10 19:55:13 +00:00
|
|
|
{
|
2000-07-15 11:27:55 +00:00
|
|
|
workspace()->lowerClient(this);
|
2000-05-11 03:52:24 +00:00
|
|
|
}
|
2000-05-10 19:55:13 +00:00
|
|
|
|
2000-05-11 03:52:24 +00:00
|
|
|
void
|
|
|
|
Manager::raise()
|
|
|
|
{
|
|
|
|
workspace()->raiseClient(this);
|
2000-05-10 19:55:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-05-11 03:52:24 +00:00
|
|
|
Manager::vMax()
|
2000-05-10 19:55:13 +00:00
|
|
|
{
|
2000-05-11 03:52:24 +00:00
|
|
|
maximize(MaximizeVertical);
|
|
|
|
}
|
2000-05-10 19:55:13 +00:00
|
|
|
|
2000-05-11 03:52:24 +00:00
|
|
|
void
|
|
|
|
Manager::resizeEvent(QResizeEvent * e)
|
|
|
|
{
|
|
|
|
Client::resizeEvent(e);
|
|
|
|
_updateLayout();
|
2000-05-10 19:55:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-05-11 03:52:24 +00:00
|
|
|
Manager::_updateLayout()
|
2000-05-10 19:55:13 +00:00
|
|
|
{
|
2000-07-15 11:27:55 +00:00
|
|
|
titleBar_ -> setGeometry(0, 0, width(), 20);
|
|
|
|
windowWrapper() -> setGeometry(1, 20, width() - 2, height() - 30);
|
|
|
|
resizeBar_ -> setGeometry(0, height() - 10, width(), 10);
|
|
|
|
|
2000-05-11 03:52:24 +00:00
|
|
|
_updateDisplay();
|
|
|
|
}
|
2000-05-10 19:55:13 +00:00
|
|
|
|
2000-05-11 03:52:24 +00:00
|
|
|
void
|
|
|
|
Manager::activateLayout()
|
|
|
|
{
|
|
|
|
_updateLayout();
|
2000-05-10 19:55:13 +00:00
|
|
|
}
|
2000-04-10 17:18:21 +00:00
|
|
|
|
2000-05-11 04:17:35 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2000-04-10 17:18:21 +00:00
|
|
|
} // End namespace
|
|
|
|
|
|
|
|
// vim:ts=2:sw=2:tw=78
|
2000-06-29 21:36:40 +00:00
|
|
|
#include "Manager.moc"
|