Many fixes to RISC OS client. Still needs major work to be perfect.
Changed spaces to tab for ettrich in client.cpp ;) Changed something that looked like it was trying to do manhattanLength() so it actually does. svn path=/trunk/kdebase/kwin/; revision=49144icc-effect-5.14.5
parent
3ac4896a57
commit
baa151afb3
|
@ -946,7 +946,7 @@ void Client::mouseMoveEvent( QMouseEvent * e)
|
||||||
if ( !moveResizeMode )
|
if ( !moveResizeMode )
|
||||||
{
|
{
|
||||||
QPoint p( e->pos() - moveOffset );
|
QPoint p( e->pos() - moveOffset );
|
||||||
if ( (QABS( p.x()) >= 4) || (QABS( p.y() ) >= 4 )) {
|
if (p.manhattanLength() >= 6) {
|
||||||
moveResizeMode = TRUE;
|
moveResizeMode = TRUE;
|
||||||
Events::raise( isResize() ? Events::ResizeStart : Events::MoveStart );
|
Events::raise( isResize() ? Events::ResizeStart : Events::MoveStart );
|
||||||
grabMouse( cursor() ); // to keep the right cursor
|
grabMouse( cursor() ); // to keep the right cursor
|
||||||
|
@ -1501,7 +1501,7 @@ void Client::setShade( bool s )
|
||||||
clearWFlags( WNorthWestGravity );
|
clearWFlags( WNorthWestGravity );
|
||||||
resize ( s );
|
resize ( s );
|
||||||
windowWrapper()->show();
|
windowWrapper()->show();
|
||||||
activateLayout();
|
activateLayout();
|
||||||
repaint();
|
repaint();
|
||||||
if ( isActive() )
|
if ( isActive() )
|
||||||
workspace()->requestFocus( this );
|
workspace()->requestFocus( this );
|
||||||
|
|
|
@ -20,24 +20,18 @@
|
||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qpixmap.h>
|
|
||||||
#include <qpainter.h>
|
|
||||||
|
|
||||||
#include "../../options.h"
|
|
||||||
|
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.h"
|
#include "Static.h"
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
Button::Button(QWidget * parent, Manager * client, SymbolType t)
|
Button::Button(QWidget * parent, SymbolType t)
|
||||||
: QWidget (parent, "Button", WRepaintNoErase | WPaintUnclipped),
|
: QWidget (parent, "Button", WRepaintNoErase | WPaintUnclipped),
|
||||||
client_ (client),
|
|
||||||
type_ (t),
|
type_ (t),
|
||||||
align_ (Left),
|
align_ (Left),
|
||||||
down_ (false)
|
down_ (false),
|
||||||
|
active_ (false)
|
||||||
{
|
{
|
||||||
setFixedSize(19, 20);
|
setFixedSize(19, 20);
|
||||||
}
|
}
|
||||||
|
@ -50,9 +44,26 @@ Button::~Button()
|
||||||
void
|
void
|
||||||
Button::updateDisplay()
|
Button::updateDisplay()
|
||||||
{
|
{
|
||||||
setBackgroundPixmap(Static::instance()->button(type_, client_->isActive(), down_));
|
setBackgroundPixmap(
|
||||||
|
Static::instance()->button(type_, active_, down_)
|
||||||
|
);
|
||||||
|
|
||||||
repaint(true);
|
repaint(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Button::setType(SymbolType t)
|
||||||
|
{
|
||||||
|
type_ = t;
|
||||||
|
updateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Button::setActive(bool b)
|
||||||
|
{
|
||||||
|
active_ = b;
|
||||||
|
updateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
||||||
|
|
|
@ -23,42 +23,45 @@
|
||||||
#ifndef RISC_OS_BUTTON_H
|
#ifndef RISC_OS_BUTTON_H
|
||||||
#define RISC_OS_BUTTON_H
|
#define RISC_OS_BUTTON_H
|
||||||
|
|
||||||
#include <qwidget.h>
|
|
||||||
|
|
||||||
#include "Static.h"
|
#include "Static.h"
|
||||||
|
#include <qwidget.h>
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
class Manager;
|
|
||||||
|
|
||||||
class Button : public QWidget
|
class Button : public QWidget
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum Alignment { Left, Right };
|
enum Alignment { Left, Right };
|
||||||
|
|
||||||
Button(QWidget * parent, Manager * client, SymbolType);
|
enum SymbolType;
|
||||||
|
|
||||||
|
Button(QWidget * parent, SymbolType);
|
||||||
virtual ~Button();
|
virtual ~Button();
|
||||||
|
|
||||||
void updateDisplay();
|
void updateDisplay();
|
||||||
|
|
||||||
void setAlign(Alignment a) { align_ = a; updateDisplay(); }
|
void setAlign(Alignment a) { align_ = a; updateDisplay(); }
|
||||||
void setType(SymbolType t) { type_ = t; updateDisplay(); }
|
void setType(SymbolType t);
|
||||||
|
|
||||||
|
void setActive(bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Manager * client() { return client_; }
|
bool active() const { return active_; }
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *) { down_ = true; updateDisplay(); }
|
void mousePressEvent(QMouseEvent *) { down_ = true; updateDisplay(); }
|
||||||
void mouseReleaseEvent(QMouseEvent *) { down_ = false; updateDisplay(); }
|
void mouseReleaseEvent(QMouseEvent *) { down_ = false; updateDisplay(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Manager * client_;
|
|
||||||
SymbolType type_;
|
SymbolType type_;
|
||||||
Alignment align_;
|
Alignment align_;
|
||||||
bool down_;
|
bool down_;
|
||||||
|
bool active_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -21,14 +21,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CloseButton.h"
|
#include "CloseButton.h"
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.h"
|
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
CloseButton::CloseButton(QWidget * parent, Manager * client)
|
CloseButton::CloseButton(QWidget * parent)
|
||||||
: Button(parent, client, Close)
|
: Button(parent, Close)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,16 +41,16 @@ CloseButton::mouseReleaseEvent(QMouseEvent * e)
|
||||||
switch (e->button())
|
switch (e->button())
|
||||||
{
|
{
|
||||||
case RightButton:
|
case RightButton:
|
||||||
client()->closeWindow();
|
emit(closeClient());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MidButton:
|
case MidButton:
|
||||||
client()->closeWindow();
|
emit(closeClient());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LeftButton:
|
case LeftButton:
|
||||||
default:
|
default:
|
||||||
client()->closeWindow();
|
emit(closeClient());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,17 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
class Manager;
|
|
||||||
|
|
||||||
class CloseButton : public Button
|
class CloseButton : public Button
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CloseButton(QWidget * parent, Manager * client);
|
CloseButton(QWidget * parent);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void closeClient();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "IconifyButton.h"
|
#include "IconifyButton.h"
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.h"
|
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
IconifyButton::IconifyButton(QWidget * parent, Manager * client)
|
IconifyButton::IconifyButton(QWidget * parent)
|
||||||
: Button(parent, client, Iconify)
|
: Button(parent, Iconify)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,16 +41,16 @@ IconifyButton::mouseReleaseEvent(QMouseEvent * e)
|
||||||
switch (e->button())
|
switch (e->button())
|
||||||
{
|
{
|
||||||
case RightButton:
|
case RightButton:
|
||||||
client()->iconify();
|
emit(iconifyClient());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MidButton:
|
case MidButton:
|
||||||
client()->iconify();
|
emit(iconifyClient());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LeftButton:
|
case LeftButton:
|
||||||
default:
|
default:
|
||||||
client()->iconify();
|
emit(iconifyClient());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,17 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
class Manager;
|
|
||||||
|
|
||||||
|
|
||||||
class IconifyButton : public Button
|
class IconifyButton : public Button
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
IconifyButton(QWidget * parent, Manager * client);
|
IconifyButton(QWidget * parent);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void iconifyClient();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -20,17 +20,13 @@
|
||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../workspace.h"
|
|
||||||
|
|
||||||
#include "LowerButton.h"
|
#include "LowerButton.h"
|
||||||
#include "Manager.h"
|
|
||||||
#include "Static.h"
|
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
LowerButton::LowerButton(QWidget * parent, Manager * client)
|
LowerButton::LowerButton(QWidget * parent)
|
||||||
: Button(parent, client, Lower)
|
: Button(parent, Lower)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,13 +41,12 @@ LowerButton::mouseReleaseEvent(QMouseEvent * e)
|
||||||
switch (e->button())
|
switch (e->button())
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
client()->workspace()->lowerClient(client());
|
emit(lowerClient());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // End namespace;
|
} // End namespace;
|
||||||
|
|
||||||
// vim:ts=2:sw=2:tw=78
|
// vim:ts=2:sw=2:tw=78
|
||||||
|
|
|
@ -28,13 +28,17 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
class Manager;
|
|
||||||
|
|
||||||
class LowerButton : public Button
|
class LowerButton : public Button
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LowerButton(QWidget * parent, Manager * client);
|
LowerButton(QWidget * parent);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void lowerClient();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -38,5 +38,6 @@ lnk_DATA = riscos.desktop
|
||||||
|
|
||||||
EXTRA_DIST = $(lnk_DATA)
|
EXTRA_DIST = $(lnk_DATA)
|
||||||
|
|
||||||
libkwinriscos_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -rdynamic
|
libkwinriscos_la_LIBADD = $(LIB_QT) ../../kwin.la
|
||||||
|
libkwinriscos_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -rdynamic -no-undefined
|
||||||
|
|
||||||
|
|
|
@ -50,30 +50,14 @@ Manager::Manager(
|
||||||
)
|
)
|
||||||
: Client(workSpace, id, parent, name)
|
: Client(workSpace, id, parent, name)
|
||||||
{
|
{
|
||||||
Static::instance();
|
|
||||||
|
|
||||||
setBackgroundMode(NoBackground);
|
setBackgroundMode(NoBackground);
|
||||||
|
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
|
|
||||||
titleBar_ = new TitleBar(this, this);
|
titleBar_ = new TitleBar(this);
|
||||||
resizeBar_ = new ResizeBar(this, this);
|
resizeBar_ = new ResizeBar(this, this);
|
||||||
|
|
||||||
// Border Window Border
|
activateLayout();
|
||||||
QHBoxLayout * windowLayout = new QHBoxLayout(0, "windowLayout");
|
|
||||||
windowLayout->addSpacing(1);
|
|
||||||
windowLayout->addWidget(windowWrapper(), 1);
|
|
||||||
windowLayout->addSpacing(1);
|
|
||||||
|
|
||||||
// Titlebar (has own single pixel border)
|
|
||||||
// Window
|
|
||||||
// Resize bar (has own single pixel border)
|
|
||||||
QVBoxLayout * mainLayout = new QVBoxLayout(this, 0, 0, "mainLayout");
|
|
||||||
mainLayout->addWidget(titleBar_);
|
|
||||||
mainLayout->addLayout(windowLayout, 1);
|
|
||||||
mainLayout->addWidget(resizeBar_);
|
|
||||||
|
|
||||||
updateDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager::~Manager()
|
Manager::~Manager()
|
||||||
|
@ -84,8 +68,7 @@ Manager::~Manager()
|
||||||
Manager::slotReset()
|
Manager::slotReset()
|
||||||
{
|
{
|
||||||
Static::instance()->update();
|
Static::instance()->update();
|
||||||
titleBar_->updateDisplay();
|
_updateDisplay();
|
||||||
resizeBar_->updateDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -98,46 +81,23 @@ Manager::captionChange(const QString &)
|
||||||
Manager::paletteChange(const QPalette &)
|
Manager::paletteChange(const QPalette &)
|
||||||
{
|
{
|
||||||
Static::instance()->update();
|
Static::instance()->update();
|
||||||
titleBar_->updateDisplay();
|
_updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::activeChange(bool)
|
Manager::activeChange(bool b)
|
||||||
{
|
{
|
||||||
titleBar_->updateDisplay();
|
titleBar_->setActive(b);
|
||||||
resizeBar_->updateDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::maximizeChange(bool b)
|
Manager::maximizeChange(bool b)
|
||||||
{
|
{
|
||||||
titleBar_->updateMaximise(b);
|
emit(maximiseChanged(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::maximizeAndRaise()
|
Manager::_updateDisplay()
|
||||||
{
|
|
||||||
maximize(MaximizeFull);
|
|
||||||
workspace()->raiseClient(this);
|
|
||||||
workspace()->requestFocus(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Manager::maximizeVertically()
|
|
||||||
{
|
|
||||||
maximize(MaximizeVertical);
|
|
||||||
workspace()->raiseClient(this);
|
|
||||||
workspace()->requestFocus(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Manager::maximizeNoRaise()
|
|
||||||
{
|
|
||||||
maximize(MaximizeFull);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Manager::updateDisplay()
|
|
||||||
{
|
{
|
||||||
titleBar_->updateDisplay();
|
titleBar_->updateDisplay();
|
||||||
resizeBar_->updateDisplay();
|
resizeBar_->updateDisplay();
|
||||||
|
@ -173,31 +133,54 @@ Manager::paintEvent(QPaintEvent * e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
Client::MousePosition
|
||||||
Manager::mouseMoveEvent(QMouseEvent * e)
|
Manager::mousePosition(const QPoint & p) const
|
||||||
{
|
{
|
||||||
if ((e->pos().x() == 0) || (e->pos().y() == 0))
|
if (titleBar_->rect().contains(p))
|
||||||
return;
|
return Client::Center;
|
||||||
|
else
|
||||||
Client::mouseMoveEvent(e);
|
return Client::Nowhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::mousePressEvent(QMouseEvent * e)
|
Manager::lower()
|
||||||
{
|
{
|
||||||
if ((e->pos().x() == 0) || (e->pos().y() == 0))
|
workspace()->lowerClient(this);
|
||||||
return;
|
|
||||||
|
|
||||||
Client::mousePressEvent(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::mouseReleaseEvent(QMouseEvent * e)
|
Manager::raise()
|
||||||
{
|
{
|
||||||
if ((e->pos().x() == 0) || (e->pos().y() == 0))
|
workspace()->raiseClient(this);
|
||||||
return;
|
}
|
||||||
|
|
||||||
Client::mouseReleaseEvent(e);
|
void
|
||||||
|
Manager::vMax()
|
||||||
|
{
|
||||||
|
maximize(MaximizeVertical);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Manager::resizeEvent(QResizeEvent * e)
|
||||||
|
{
|
||||||
|
Client::resizeEvent(e);
|
||||||
|
_updateLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Manager::_updateLayout()
|
||||||
|
{
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -35,35 +35,44 @@ class Manager : public Client
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
friend class TitleText;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Manager(Workspace *, WId, QWidget * parent = 0, const char * name = 0);
|
Manager(Workspace *, WId, QWidget * parent = 0, const char * name = 0);
|
||||||
~Manager();
|
~Manager();
|
||||||
|
|
||||||
void maximizeVertically();
|
|
||||||
void maximizeAndRaise();
|
|
||||||
void maximizeNoRaise();
|
|
||||||
|
|
||||||
void setShade(bool);
|
void setShade(bool);
|
||||||
|
|
||||||
void updateDisplay();
|
signals:
|
||||||
|
|
||||||
|
void maximiseChanged(bool);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void lower();
|
||||||
|
void raise();
|
||||||
|
void vMax();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
Client::MousePosition mousePosition(const QPoint &) const;
|
||||||
void paletteChange(const QPalette &);
|
void paletteChange(const QPalette &);
|
||||||
void activeChange(bool);
|
void activeChange(bool);
|
||||||
void maximizeChange(bool);
|
void maximizeChange(bool);
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
void mouseMoveEvent(QMouseEvent *);
|
void resizeEvent(QResizeEvent *);
|
||||||
void mousePressEvent(QMouseEvent *);
|
void activateLayout();
|
||||||
void mouseReleaseEvent(QMouseEvent *);
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void captionChange(const QString &);
|
void captionChange(const QString &);
|
||||||
void slotReset();
|
void slotReset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void _updateDisplay();
|
||||||
|
void _updateLayout();
|
||||||
|
|
||||||
TitleBar * titleBar_;
|
TitleBar * titleBar_;
|
||||||
ResizeBar * resizeBar_;
|
ResizeBar * resizeBar_;
|
||||||
|
|
|
@ -21,14 +21,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MaximiseButton.h"
|
#include "MaximiseButton.h"
|
||||||
#include "Static.h"
|
|
||||||
#include "Manager.h"
|
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
MaximiseButton::MaximiseButton(QWidget * parent, Manager * client)
|
MaximiseButton::MaximiseButton(QWidget * parent)
|
||||||
: Button(parent, client, Max)
|
: Button(parent, Max)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,16 +48,17 @@ MaximiseButton::mouseReleaseEvent(QMouseEvent * e)
|
||||||
switch (e->button())
|
switch (e->button())
|
||||||
{
|
{
|
||||||
case RightButton:
|
case RightButton:
|
||||||
client()->maximizeNoRaise();
|
emit(maximiseClient());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MidButton:
|
case MidButton:
|
||||||
client()->maximizeVertically();
|
emit(vMaxClient());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LeftButton:
|
case LeftButton:
|
||||||
default:
|
default:
|
||||||
client()->maximizeAndRaise();
|
emit(raiseClient());
|
||||||
|
emit(maximiseClient());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,23 +23,29 @@
|
||||||
#ifndef RISC_OS_MAXIMISE_BUTTON_H
|
#ifndef RISC_OS_MAXIMISE_BUTTON_H
|
||||||
#define RISC_OS_MAXIMISE_BUTTON_H
|
#define RISC_OS_MAXIMISE_BUTTON_H
|
||||||
|
|
||||||
#include <qwidget.h>
|
|
||||||
|
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
|
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
class Manager;
|
|
||||||
|
|
||||||
class MaximiseButton : public Button
|
class MaximiseButton : public Button
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MaximiseButton(QWidget * parent, Manager * client);
|
MaximiseButton(QWidget * parent);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
void setOn(bool);
|
void setOn(bool);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void maximiseClient();
|
||||||
|
void raiseClient();
|
||||||
|
void vMaxClient();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void mouseReleaseEvent(QMouseEvent *);
|
void mouseReleaseEvent(QMouseEvent *);
|
||||||
|
|
|
@ -84,4 +84,7 @@ in the lower right corner of the window (actually inside the window).
|
||||||
To emulate this would mean covering part of the window with the decorations,
|
To emulate this would mean covering part of the window with the decorations,
|
||||||
which is not acceptable. RISC OS gets away with it by making sure that
|
which is not acceptable. RISC OS gets away with it by making sure that
|
||||||
there is a vertical scrollbar visible at all times, which is just stupid.
|
there is a vertical scrollbar visible at all times, which is just stupid.
|
||||||
|
It's also an impossibility with X11, as the window manager does not know
|
||||||
|
anything about scrollbars - they belong to the application, so don't ask
|
||||||
|
me to implement it.
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ ResizeBar::ResizeBar(QWidget * parent, Manager * client)
|
||||||
client_ (client)
|
client_ (client)
|
||||||
{
|
{
|
||||||
setBackgroundMode(NoBackground);
|
setBackgroundMode(NoBackground);
|
||||||
setFixedHeight(10);
|
|
||||||
|
|
||||||
left_ = new ResizeSide(this, client_, ResizeSide::Left);
|
left_ = new ResizeSide(this, client_, ResizeSide::Left);
|
||||||
mid_ = new ResizeMid(this, client_);
|
mid_ = new ResizeMid(this, client_);
|
||||||
|
|
|
@ -33,18 +33,16 @@
|
||||||
namespace RiscOS
|
namespace RiscOS
|
||||||
{
|
{
|
||||||
|
|
||||||
TitleBar::TitleBar(QWidget * parent, Manager * client)
|
TitleBar::TitleBar(Manager * client)
|
||||||
: QWidget(parent),
|
: QWidget(client)
|
||||||
client_(client)
|
|
||||||
{
|
{
|
||||||
setBackgroundMode(NoBackground);
|
setBackgroundMode(NoBackground);
|
||||||
setFixedHeight(20);
|
|
||||||
|
|
||||||
lower_ = new LowerButton (this, client_);
|
lower_ = new LowerButton (this);
|
||||||
close_ = new CloseButton (this, client_);
|
close_ = new CloseButton (this);
|
||||||
text_ = new TitleText (this, client_);
|
text_ = new TitleText (this, client);
|
||||||
iconify_ = new IconifyButton (this, client_);
|
iconify_ = new IconifyButton (this);
|
||||||
maximise_ = new MaximiseButton (this, client_);
|
maximise_ = new MaximiseButton (this);
|
||||||
|
|
||||||
lower_ ->setAlign(Button::Left);
|
lower_ ->setAlign(Button::Left);
|
||||||
close_ ->setAlign(Button::Left);
|
close_ ->setAlign(Button::Left);
|
||||||
|
@ -60,6 +58,14 @@ TitleBar::TitleBar(QWidget * parent, Manager * client)
|
||||||
layout->addWidget(text_, 1);
|
layout->addWidget(text_, 1);
|
||||||
layout->addWidget(iconify_);
|
layout->addWidget(iconify_);
|
||||||
layout->addWidget(maximise_);
|
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
|
void
|
||||||
|
@ -72,12 +78,6 @@ TitleBar::updateDisplay()
|
||||||
maximise_ ->updateDisplay();
|
maximise_ ->updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
TitleBar::updateMaximise(bool b)
|
|
||||||
{
|
|
||||||
maximise_->setOn(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TitleBar::updateText()
|
TitleBar::updateText()
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ TitleBar::~TitleBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TitleBar::resizeEvent(QResizeEvent * e)
|
TitleBar::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
int sizeProblem = 0;
|
int sizeProblem = 0;
|
||||||
|
|
||||||
|
@ -128,8 +128,16 @@ TitleBar::resizeEvent(QResizeEvent * e)
|
||||||
close_ ->show();
|
close_ ->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QWidget::resizeEvent(e);
|
void
|
||||||
|
TitleBar::setActive(bool b)
|
||||||
|
{
|
||||||
|
lower_->setActive(b);
|
||||||
|
close_->setActive(b);
|
||||||
|
text_->setActive(b);
|
||||||
|
iconify_->setActive(b);
|
||||||
|
maximise_->setActive(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -39,13 +39,15 @@ class TitleBar : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TitleBar(QWidget * parent, Manager * client);
|
TitleBar(Manager * client);
|
||||||
virtual ~TitleBar();
|
virtual ~TitleBar();
|
||||||
|
|
||||||
void updateDisplay();
|
void updateDisplay();
|
||||||
void updateText();
|
void updateText();
|
||||||
void updateMaximise(bool);
|
void updateMaximise(bool);
|
||||||
|
|
||||||
|
void setActive(bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *);
|
void resizeEvent(QResizeEvent *);
|
||||||
|
@ -59,8 +61,6 @@ class TitleBar : public QWidget
|
||||||
|
|
||||||
IconifyButton * iconify_;
|
IconifyButton * iconify_;
|
||||||
MaximiseButton * maximise_;
|
MaximiseButton * maximise_;
|
||||||
|
|
||||||
Manager * client_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -34,25 +34,33 @@ namespace RiscOS
|
||||||
|
|
||||||
TitleText::TitleText(QWidget * parent, Manager * client)
|
TitleText::TitleText(QWidget * parent, Manager * client)
|
||||||
: DBWidget(parent, "TitleText"),
|
: DBWidget(parent, "TitleText"),
|
||||||
client_(client)
|
client_(client),
|
||||||
|
active_(false)
|
||||||
{
|
{
|
||||||
setFixedHeight(20);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TitleText::~TitleText()
|
TitleText::~TitleText()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TitleText::setActive(bool b)
|
||||||
|
{
|
||||||
|
active_ = b;
|
||||||
|
updateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TitleText::updatePixmap()
|
TitleText::updatePixmap()
|
||||||
{
|
{
|
||||||
QPainter p(&buf());
|
QPainter p(&buf());
|
||||||
|
|
||||||
p.drawPixmap(0, 0, Static::instance()->titleTextLeft(client_->isActive()));
|
Static * s = Static::instance();
|
||||||
p.drawPixmap(width() - 3, 0, Static::instance()->titleTextRight(client_->isActive()));
|
|
||||||
p.drawTiledPixmap(3, 0, width() - 6, 20, Static::instance()->titleTextMid(client_->isActive()));
|
|
||||||
|
|
||||||
p.setPen(options->color(Options::Font, client_->isActive()));
|
p.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.setFont(options->font());
|
||||||
p.drawText(4, 0, width() - 8, 18, AlignCenter, client_->caption());
|
p.drawText(4, 0, width() - 8, 18, AlignCenter, client_->caption());
|
||||||
}
|
}
|
||||||
|
@ -60,50 +68,25 @@ TitleText::updatePixmap()
|
||||||
void
|
void
|
||||||
TitleText::mousePressEvent(QMouseEvent * e)
|
TitleText::mousePressEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
switch (e->button()) {
|
client_->mousePressEvent(e);
|
||||||
|
|
||||||
case MidButton:
|
|
||||||
clientPosToMousePos_ = e->globalPos() - client_->pos();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LeftButton:
|
|
||||||
clientPosToMousePos_ = e->globalPos() - client_->pos();
|
|
||||||
client_->workspace()->raiseClient(client_);
|
|
||||||
client_->workspace()->requestFocus(client_);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RightButton:
|
|
||||||
client_->workspace()->clientPopup(client_)->popup(e->globalPos());
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TitleText::mouseReleaseEvent(QMouseEvent *)
|
TitleText::mouseReleaseEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
// Anything to do ?
|
client_->mouseReleaseEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TitleText::mouseMoveEvent(QMouseEvent * e)
|
TitleText::mouseMoveEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
// Need to be a little clever here.
|
client_->mouseMoveEvent(e);
|
||||||
|
|
||||||
QPoint adjustedForCursor = e->globalPos() - clientPosToMousePos_;
|
|
||||||
|
|
||||||
QPoint adjustedForSnap =
|
|
||||||
client_->workspace()->adjustClientPosition(client_, adjustedForCursor);
|
|
||||||
|
|
||||||
client_->move(adjustedForSnap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TitleText::mouseDoubleClickEvent(QMouseEvent *)
|
TitleText::mouseDoubleClickEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
client_->setShade(!client_->isShade());
|
client_->mouseDoubleClickEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
|
@ -40,6 +40,8 @@ class TitleText : public DBWidget
|
||||||
TitleText(QWidget * parent, Manager * client);
|
TitleText(QWidget * parent, Manager * client);
|
||||||
virtual ~TitleText();
|
virtual ~TitleText();
|
||||||
|
|
||||||
|
void setActive(bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void updatePixmap();
|
void updatePixmap();
|
||||||
|
@ -52,8 +54,7 @@ class TitleText : public DBWidget
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Manager * client_;
|
Manager * client_;
|
||||||
|
bool active_;
|
||||||
QPoint clientPosToMousePos_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
Loading…
Reference in New Issue