This should answer those bug reports about not being able to configure the

button order on the titlebar, for the RISC OS theme at least.

I now have [Sticky][(Help)].....Title.......[Iconify][Maximise][Close].
Much more sensible than the stupid RISC OS layout.

svn path=/trunk/kdebase/kwin/; revision=67108
This commit is contained in:
Rik Hemsley 2000-10-10 22:03:50 +00:00
parent feb91c885e
commit 0a27e45f56
4 changed files with 66 additions and 15 deletions

View file

@ -23,6 +23,7 @@
#include <qpainter.h>
#include <qimage.h>
#include <qlayout.h>
#include "../../options.h"
#include "../../workspace.h"
@ -57,6 +58,9 @@ Manager::Manager(
{
setBackgroundMode(NoBackground);
QStringList leftButtons = Static::instance()->leftButtons();
QStringList rightButtons = Static::instance()->rightButtons();
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
QVBoxLayout * l = new QVBoxLayout(this, 0, 0);
@ -71,25 +75,35 @@ Manager::Manager(
if (!providesContextHelp())
help_->hide();
lower_ ->setAlignment(Button::Left);
close_ ->setAlignment(Button::Left);
sticky_ ->setAlignment(Button::Left);
help_ ->setAlignment(Button::Right);
iconify_ ->setAlignment(Button::Right);
maximise_ ->setAlignment(Button::Right);
buttonDict_.insert("Lower", lower_);
buttonDict_.insert("Close", close_);
buttonDict_.insert("Sticky", sticky_);
buttonDict_.insert("Iconify", iconify_);
buttonDict_.insert("Maximize", maximise_);
buttonDict_.insert("Help", help_);
// Lower | Close | Text | Iconify | Maximise
QStringList::ConstIterator it;
for (it = leftButtons.begin(); it != leftButtons.end(); ++it)
if (buttonDict_[*it])
buttonDict_[*it]->setAlignment(Button::Left);
for (it = rightButtons.begin(); it != rightButtons.end(); ++it)
if (buttonDict_[*it])
buttonDict_[*it]->setAlignment(Button::Left);
QHBoxLayout * titleLayout = new QHBoxLayout(l);
titleLayout->addWidget(lower_);
titleLayout->addWidget(close_);
titleLayout->addWidget(sticky_);
for (it = leftButtons.begin(); it != leftButtons.end(); ++it)
if (buttonDict_[*it])
titleLayout->addWidget(buttonDict_[*it]);
titleSpacer_ = new QSpacerItem(0, 20);
titleLayout->addItem(titleSpacer_);
titleLayout->addWidget(help_);
titleLayout->addWidget(iconify_);
titleLayout->addWidget(maximise_);
for (it = rightButtons.begin(); it != rightButtons.end(); ++it)
if (buttonDict_[*it])
titleLayout->addWidget(buttonDict_[*it]);
QHBoxLayout * midLayout = new QHBoxLayout(l);
midLayout->addSpacing(1);

View file

@ -23,6 +23,8 @@
#ifndef RISC_OS_MANAGER_H
#define RISC_OS_MANAGER_H
#include <qdict.h>
#include "../../client.h"
class QSpacerItem;
@ -36,6 +38,7 @@ class IconifyButton;
class MaximiseButton;
class StickyButton;
class HelpButton;
class Button;
class Manager : public Client
{
@ -86,6 +89,8 @@ class Manager : public Client
HelpButton * help_;
QSpacerItem * titleSpacer_;
QDict<Button> buttonDict_;
};
} // End namespace

View file

@ -24,6 +24,8 @@
#include <qpixmap.h>
#include <qpainter.h>
#include <ksimpleconfig.h>
#include "../../options.h"
#include "Static.h"
@ -413,6 +415,29 @@ Static::update()
painter_.drawPixmap(3, 3, iTexture, 0, 0, 24, 4);
painter_.end();
}
// ------------------------------------------------------------------------
// Button order
// ------------------------------------------------------------------------
KConfig * c = new KConfig("kwinriscosrc", true, true);
c->setGroup("WM");
leftButtons_.clear();
rightButtons_.clear();
if (c->hasKey("LeftButtons"))
leftButtons_ = c->readListEntry("LeftButtons");
else
leftButtons_ << "Lower" << "Close" << "Sticky";
if (c->hasKey("RightButtons"))
rightButtons_ = c->readListEntry("RightButtons");
else
rightButtons_ << "Help" << "Iconify" << "Maximize";
delete c;
c = 0;
}
const QPixmap &

View file

@ -26,7 +26,7 @@
#include <qimage.h>
#include <qpixmap.h>
#include <qpainter.h>
#include <qstringlist.h>
#include "Palette.h"
@ -37,7 +37,6 @@ enum SymbolType { Lower, Close, Iconify, Max, Unmax };
class Static
{
public:
Static()
@ -87,6 +86,12 @@ class Static
const Palette & standardPalette() const
{ return standardPal_; }
const QStringList & leftButtons() const
{ return leftButtons_; }
const QStringList & rightButtons() const
{ return rightButtons_; }
private:
void _drawButtonBorder (QPixmap &);
@ -114,6 +119,8 @@ class Static
bool down_;
Palette palette_;
double transx, transy;
QStringList leftButtons_, rightButtons_;
};
} // End namespace