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

View file

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

View file

@ -24,6 +24,8 @@
#include <qpixmap.h> #include <qpixmap.h>
#include <qpainter.h> #include <qpainter.h>
#include <ksimpleconfig.h>
#include "../../options.h" #include "../../options.h"
#include "Static.h" #include "Static.h"
@ -413,6 +415,29 @@ Static::update()
painter_.drawPixmap(3, 3, iTexture, 0, 0, 24, 4); painter_.drawPixmap(3, 3, iTexture, 0, 0, 24, 4);
painter_.end(); 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 & const QPixmap &

View file

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