diff --git a/clients/riscos/Button.cpp b/clients/riscos/Button.cpp index 3ab19c08d4..4e72b75015 100644 --- a/clients/riscos/Button.cpp +++ b/clients/riscos/Button.cpp @@ -34,8 +34,8 @@ Button::Button(QWidget * parent) active_ (false) { setBackgroundColor(Qt::black); - setFixedSize(19, 20); connect(parent, SIGNAL(activeChanged(bool)), this, SLOT(setActive(bool))); + update(); } Button::~Button() @@ -77,6 +77,15 @@ Button::mouseReleaseEvent(QMouseEvent *) repaint(); } + void +Button::update() +{ + setFixedSize( + Static::instance()->titleHeight() - 1, + Static::instance()->titleHeight() + ); +} + void Button::setPixmap(const QPixmap & p) { @@ -128,10 +137,12 @@ Button::paintEvent(QPaintEvent *) bitBlt(this, alignment_ == Left ? 1 : 0, 0, &Static::instance()->buttonBase(active_, down_)); + int i = width() / 2 - 6; + if (active_) - bitBlt(this, alignment_ == Left ? 4 : 3, 4, &aPixmap_); + bitBlt(this, alignment_ == Left ? i + 1 : i, i + 1, &aPixmap_); else - bitBlt(this, alignment_ == Left ? 4 : 3, 4, &iPixmap_); + bitBlt(this, alignment_ == Left ? i + 1 : i, i + 1, &iPixmap_); } } // End namespace diff --git a/clients/riscos/Button.h b/clients/riscos/Button.h index 01c9128939..f6f9966dc6 100644 --- a/clients/riscos/Button.h +++ b/clients/riscos/Button.h @@ -44,6 +44,8 @@ class Button : public QWidget Alignment alignment() const; + void update(); + protected slots: void setActive(bool); diff --git a/clients/riscos/Manager.cpp b/clients/riscos/Manager.cpp index 405c5c5e6e..5f1a9f1ca9 100644 --- a/clients/riscos/Manager.cpp +++ b/clients/riscos/Manager.cpp @@ -22,11 +22,13 @@ #include // for usleep #include // for usleep on non-linux platforms +#include // for sin and cos #include #include #include +#include #include #include "../../options.h" @@ -106,8 +108,14 @@ Manager::Manager( if (buttonDict_[*it]) titleLayout->addWidget(buttonDict_[*it]); - titleSpacer_ = new QSpacerItem(0, 20, QSizePolicy::Expanding, - QSizePolicy::Fixed); + titleSpacer_ = + new QSpacerItem( + 0, + Static::instance()->titleHeight(), + QSizePolicy::Expanding, + QSizePolicy::Fixed + ); + titleLayout->addItem(titleSpacer_); for (it = rightButtons.begin(); it != rightButtons.end(); ++it) @@ -120,7 +128,7 @@ Manager::Manager( midLayout->addWidget(windowWrapper()); midLayout->addSpacing(1); - l->addSpacing(10); + l->addSpacing(Static::instance()->resizeHeight()); connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); } @@ -157,36 +165,42 @@ Manager::paintEvent(QPaintEvent * e) 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(true)); // XXX false doesn't work right at the moment - p.drawText(tr.left() + 4, 0, tr.width() - 8, 18, AlignCenter, caption()); - - p.drawPixmap(tr.right() - 2, 0, s->titleTextRight(active)); + QRect tr = titleSpacer_->geometry(); + bitBlt(this, tr.topLeft(), &titleBuf_); // Resize bar. - int rbt = height() - 10; // Resize bar top. + int rbt = height() - Static::instance()->resizeHeight(); // Resize bar top. - p.drawPixmap(0, rbt, s->resize(active)); + bitBlt(this, 0, rbt, &(s->resize(active))); + bitBlt(this, 30, rbt, &(s->resizeMidLeft(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.drawTiledPixmap( + 32, + rbt, + width() - 34, + Static::instance()->resizeHeight(), + s->resizeMidMid(active) + ); - p.drawPixmap(width() - 30, rbt, s->resize(active)); + bitBlt(this, width() - 32, rbt, &(s->resizeMidRight(active))); + bitBlt(this, width() - 30, rbt, &(s->resize(active))); } void Manager::resizeEvent(QResizeEvent * e) { Client::resizeEvent(e); + updateButtonVisibility(); + updateTitleBuffer(); + repaint(); +} + void +Manager::updateButtonVisibility() +{ int sizeProblem = 0; if (width() < 80) sizeProblem = 3; @@ -233,8 +247,44 @@ Manager::resizeEvent(QResizeEvent * e) close_ ->show(); break; } +} - repaint(); + void +Manager::updateTitleBuffer() +{ + bool active = isActive(); + + Static * s = Static::instance(); + + QRect tr = titleSpacer_->geometry(); + + titleBuf_.resize(tr.size()); + + QPainter p(&titleBuf_); + + p.drawPixmap(0, 0, s->titleTextLeft(active)); + + p.drawTiledPixmap( + 3, + 0, + tr.width() - 6, + Static::instance()->titleHeight(), + s->titleTextMid(active) + ); + + p.setPen(options->color(Options::Font, active)); + + p.setFont(options->font(true)); // XXX false doesn't work right at the moment + + p.drawText( + 4, + 2, + tr.width() - 8, + Static::instance()->titleHeight() - 4, + AlignCenter, caption() + ); + + p.drawPixmap(tr.width() - 3, 0, s->titleTextRight(active)); } Client::MousePosition @@ -242,7 +292,7 @@ Manager::mousePosition(const QPoint & p) const { MousePosition m = Center; - if (p.y() > (height() - 10)) { + if (p.y() > (height() - Static::instance()->resizeHeight())) { // Keep order ! if (p.x() >= (width() - 30)) m = BottomRight; @@ -267,6 +317,8 @@ Manager::mouseDoubleClickEvent(QMouseEvent * e) void Manager::slotReset() { + for (QDictIterator