Nicer glyphs for titlebar. Added sticky and context help buttons.
svn path=/trunk/kdebase/kwin/; revision=65557
This commit is contained in:
parent
3e5e774e10
commit
22a5becbc5
10 changed files with 268 additions and 35 deletions
72
clients/riscos/HelpButton.cpp
Normal file
72
clients/riscos/HelpButton.cpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
RISC OS KWin client
|
||||
|
||||
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 "HelpButton.h"
|
||||
|
||||
namespace RiscOS
|
||||
{
|
||||
|
||||
/* XPM */
|
||||
static const char * const help_xpm[] = {
|
||||
"12 12 3 1",
|
||||
" c None",
|
||||
". c #FFFFFF",
|
||||
"+ c #000000",
|
||||
" . ++++ . ",
|
||||
" .+. . +. ",
|
||||
" +. . . + ",
|
||||
"..+ . . .+..",
|
||||
" +. . . + ",
|
||||
" + . . .+ ",
|
||||
" .+ . .+. ",
|
||||
" . ++ + . ",
|
||||
" + ++ ",
|
||||
" ++ + ",
|
||||
" + ++ ",
|
||||
" ++ "};
|
||||
|
||||
HelpButton::HelpButton(QWidget * parent)
|
||||
: Button(parent)
|
||||
{
|
||||
setPixmap(QPixmap((const char **)help_xpm));
|
||||
}
|
||||
|
||||
void
|
||||
HelpButton::mouseReleaseEvent(QMouseEvent * e)
|
||||
{
|
||||
Button::mouseReleaseEvent(e);
|
||||
|
||||
if (!rect().contains(e->pos()))
|
||||
return;
|
||||
|
||||
switch (e->button())
|
||||
{
|
||||
default:
|
||||
emit(help());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} // End namespace;
|
||||
|
||||
// vim:ts=2:sw=2:tw=78
|
||||
#include "HelpButton.moc"
|
52
clients/riscos/HelpButton.h
Normal file
52
clients/riscos/HelpButton.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
RISC OS KWin client
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RISC_OS_HELP_BUTTON_H
|
||||
#define RISC_OS_HELP_BUTTON_H
|
||||
|
||||
#include "Button.h"
|
||||
|
||||
namespace RiscOS
|
||||
{
|
||||
|
||||
class HelpButton : public Button
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
HelpButton(QWidget * parent);
|
||||
|
||||
signals:
|
||||
|
||||
void help();
|
||||
|
||||
protected:
|
||||
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
};
|
||||
|
||||
} // End namespace;
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=2:sw=2:tw=78
|
|
@ -31,18 +31,18 @@ static const char * const lower_xpm[] = {
|
|||
" c None",
|
||||
". c #000000",
|
||||
"+ c #FFFFFF",
|
||||
" ",
|
||||
" ..... ",
|
||||
".+ + +. ",
|
||||
". + + . ",
|
||||
".+ + +. ",
|
||||
". + + ..... ",
|
||||
".+ + .+ + +.",
|
||||
". + +. + + .",
|
||||
".+ +++. ",
|
||||
".+++ +. ",
|
||||
".+ +++..... ",
|
||||
".+++ .+ + +.",
|
||||
".+ ++. + + .",
|
||||
" .....+ + +.",
|
||||
" . + + .",
|
||||
" .+ + +.",
|
||||
" . + + .",
|
||||
" ..... "};
|
||||
" ..... ",
|
||||
" "};
|
||||
|
||||
LowerButton::LowerButton(QWidget * parent)
|
||||
: Button(parent)
|
||||
|
|
|
@ -9,6 +9,8 @@ IconifyButton.cpp \
|
|||
LowerButton.cpp \
|
||||
Manager.cpp \
|
||||
MaximiseButton.cpp \
|
||||
StickyButton.cpp \
|
||||
HelpButton.cpp \
|
||||
Static.cpp
|
||||
libkwinriscos_la_LIBADD = ../../kwin.la
|
||||
libkwinriscos_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
|
||||
|
@ -21,6 +23,7 @@ IconifyButton.h \
|
|||
LowerButton.h \
|
||||
MaximiseButton.h \
|
||||
StickyButton.h \
|
||||
HelpButton.h \
|
||||
Manager.h \
|
||||
Static.h
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "CloseButton.h"
|
||||
#include "IconifyButton.h"
|
||||
#include "MaximiseButton.h"
|
||||
#include "StickyButton.h"
|
||||
#include "HelpButton.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -59,11 +61,18 @@ Manager::Manager(
|
|||
|
||||
lower_ = new LowerButton (this);
|
||||
close_ = new CloseButton (this);
|
||||
sticky_ = new StickyButton (this);
|
||||
iconify_ = new IconifyButton (this);
|
||||
maximise_ = new MaximiseButton (this);
|
||||
help_ = new HelpButton (this);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -73,8 +82,10 @@ Manager::Manager(
|
|||
|
||||
titleLayout->addWidget(lower_);
|
||||
titleLayout->addWidget(close_);
|
||||
titleLayout->addWidget(sticky_);
|
||||
titleSpacer_ = new QSpacerItem(0, 20);
|
||||
titleLayout->addItem(titleSpacer_);
|
||||
titleLayout->addWidget(help_);
|
||||
titleLayout->addWidget(iconify_);
|
||||
titleLayout->addWidget(maximise_);
|
||||
|
||||
|
@ -85,13 +96,23 @@ Manager::Manager(
|
|||
|
||||
l->addSpacing(10);
|
||||
|
||||
connect(lower_, SIGNAL(lowerClient()), this, SLOT(lower()));
|
||||
connect(close_, SIGNAL(closeClient()), this, SLOT(closeWindow()));
|
||||
connect(iconify_, SIGNAL(iconifyClient()), this, SLOT(iconify()));
|
||||
connect(maximise_, SIGNAL(maximiseClient()), this, SLOT(maximize()));
|
||||
connect(maximise_, SIGNAL(vMaxClient()), this, SLOT(vMax()));
|
||||
connect(maximise_, SIGNAL(raiseClient()), this, SLOT(raise()));
|
||||
connect(this, SIGNAL(maximiseChanged(bool)), maximise_,SLOT(setOn(bool)));
|
||||
connect(lower_, SIGNAL(lowerClient()), SLOT(lower()));
|
||||
connect(close_, SIGNAL(closeClient()), SLOT(closeWindow()));
|
||||
connect(iconify_, SIGNAL(iconifyClient()), SLOT(iconify()));
|
||||
connect(sticky_, SIGNAL(stickClient()), SLOT(stick()));
|
||||
connect(sticky_, SIGNAL(unstickClient()), SLOT(unstick()));
|
||||
connect(maximise_, SIGNAL(maximiseClient()), SLOT(maximize()));
|
||||
connect(maximise_, SIGNAL(vMaxClient()), SLOT(vMax()));
|
||||
connect(maximise_, SIGNAL(raiseClient()), SLOT(raise()));
|
||||
connect(help_, SIGNAL(help()), SLOT(help()));
|
||||
|
||||
connect(
|
||||
this, SIGNAL(maximiseChanged(bool)),
|
||||
maximise_, SLOT(setOn(bool)));
|
||||
|
||||
connect(
|
||||
this, SIGNAL(stickyChanged(bool)),
|
||||
sticky_, SLOT(setOn(bool)));
|
||||
}
|
||||
|
||||
Manager::~Manager()
|
||||
|
@ -119,8 +140,15 @@ Manager::paletteChange(const QPalette &)
|
|||
}
|
||||
|
||||
void
|
||||
Manager::activeChange(bool)
|
||||
Manager::activeChange(bool b)
|
||||
{
|
||||
lower_ ->setActive(b);
|
||||
close_ ->setActive(b);
|
||||
sticky_ ->setActive(b);
|
||||
iconify_ ->setActive(b);
|
||||
maximise_ ->setActive(b);
|
||||
help_ ->setActive(b);
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
@ -130,6 +158,12 @@ Manager::maximizeChange(bool b)
|
|||
emit(maximiseChanged(b));
|
||||
}
|
||||
|
||||
void
|
||||
Manager::stickyChange(bool b)
|
||||
{
|
||||
emit(stickyChanged(b));
|
||||
}
|
||||
|
||||
void
|
||||
Manager::paintEvent(QPaintEvent * e)
|
||||
{
|
||||
|
@ -202,6 +236,24 @@ Manager::vMax()
|
|||
maximize(MaximizeVertical);
|
||||
}
|
||||
|
||||
void
|
||||
Manager::stick()
|
||||
{
|
||||
setSticky(true);
|
||||
}
|
||||
|
||||
void
|
||||
Manager::unstick()
|
||||
{
|
||||
setSticky(false);
|
||||
}
|
||||
|
||||
void
|
||||
Manager::help()
|
||||
{
|
||||
contextHelp();
|
||||
}
|
||||
|
||||
void
|
||||
Manager::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
|
@ -215,6 +267,8 @@ Manager::resizeEvent(QResizeEvent *)
|
|||
|
||||
case 1:
|
||||
lower_ ->hide();
|
||||
sticky_ ->hide();
|
||||
help_ ->hide();
|
||||
iconify_ ->show();
|
||||
maximise_ ->hide();
|
||||
close_ ->show();
|
||||
|
@ -222,6 +276,8 @@ Manager::resizeEvent(QResizeEvent *)
|
|||
|
||||
case 2:
|
||||
lower_ ->hide();
|
||||
sticky_ ->hide();
|
||||
help_ ->hide();
|
||||
iconify_ ->hide();
|
||||
maximise_ ->hide();
|
||||
close_ ->show();
|
||||
|
@ -229,6 +285,8 @@ Manager::resizeEvent(QResizeEvent *)
|
|||
|
||||
case 3:
|
||||
lower_ ->hide();
|
||||
sticky_ ->hide();
|
||||
help_ ->hide();
|
||||
iconify_ ->hide();
|
||||
maximise_ ->hide();
|
||||
close_ ->hide();
|
||||
|
@ -237,6 +295,9 @@ Manager::resizeEvent(QResizeEvent *)
|
|||
case 0:
|
||||
default:
|
||||
lower_ ->show();
|
||||
sticky_ ->show();
|
||||
if (providesContextHelp())
|
||||
help_->show();
|
||||
iconify_ ->show();
|
||||
maximise_ ->show();
|
||||
close_ ->show();
|
||||
|
|
|
@ -34,6 +34,8 @@ class LowerButton;
|
|||
class CloseButton;
|
||||
class IconifyButton;
|
||||
class MaximiseButton;
|
||||
class StickyButton;
|
||||
class HelpButton;
|
||||
|
||||
class Manager : public Client
|
||||
{
|
||||
|
@ -47,12 +49,16 @@ class Manager : public Client
|
|||
signals:
|
||||
|
||||
void maximiseChanged(bool);
|
||||
void stickyChanged(bool);
|
||||
|
||||
public slots:
|
||||
|
||||
void help();
|
||||
void lower();
|
||||
void raise();
|
||||
void vMax();
|
||||
void stick();
|
||||
void unstick();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -60,6 +66,7 @@ class Manager : public Client
|
|||
void paletteChange(const QPalette &);
|
||||
void activeChange(bool);
|
||||
void maximizeChange(bool);
|
||||
void stickyChange(bool);
|
||||
void paintEvent(QPaintEvent *);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void mouseDoubleClickEvent(QMouseEvent *);
|
||||
|
@ -71,13 +78,14 @@ class Manager : public Client
|
|||
|
||||
private:
|
||||
|
||||
LowerButton * lower_;
|
||||
CloseButton * close_;
|
||||
LowerButton * lower_;
|
||||
CloseButton * close_;
|
||||
IconifyButton * iconify_;
|
||||
MaximiseButton * maximise_;
|
||||
StickyButton * sticky_;
|
||||
HelpButton * help_;
|
||||
|
||||
IconifyButton * iconify_;
|
||||
MaximiseButton * maximise_;
|
||||
|
||||
QSpacerItem * titleSpacer_;
|
||||
QSpacerItem * titleSpacer_;
|
||||
};
|
||||
|
||||
} // End namespace
|
||||
|
|
|
@ -31,18 +31,18 @@ static const char * const maximise_xpm[] = {
|
|||
" c None",
|
||||
". c #000000",
|
||||
"+ c #FFFFFF",
|
||||
" .......... ",
|
||||
".+ + + + + .",
|
||||
". + + + + +.",
|
||||
".+ + + + + .",
|
||||
". + + + + +.",
|
||||
".+ + + + + .",
|
||||
". + + + + +.",
|
||||
".+ + + + + .",
|
||||
". + + + + +.",
|
||||
".+ + + + + .",
|
||||
". + + + + +.",
|
||||
" .......... "};
|
||||
" ",
|
||||
" ........ ",
|
||||
" .+ + + + . ",
|
||||
" . + + + +. ",
|
||||
" .+ + + + . ",
|
||||
" . + + + +. ",
|
||||
" .+ + + + . ",
|
||||
" . + + + +. ",
|
||||
" .+ + + + . ",
|
||||
" . + + + +. ",
|
||||
" ........ ",
|
||||
" "};
|
||||
|
||||
/* XPM */
|
||||
static const char * const unmaximise_xpm[] = {
|
||||
|
@ -74,6 +74,11 @@ MaximiseButton::MaximiseButton(QWidget * parent)
|
|||
MaximiseButton::setOn(bool on)
|
||||
{
|
||||
on_ = on;
|
||||
setPixmap(
|
||||
on_ ?
|
||||
QPixmap((const char **)unmaximise_xpm) :
|
||||
QPixmap((const char **)maximise_xpm)
|
||||
);
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
|
|
@ -311,7 +311,6 @@ Static::update()
|
|||
down_ = false;
|
||||
|
||||
transx = 0.0;
|
||||
palette_ = aBut;
|
||||
|
||||
palette_ = aBut;
|
||||
_drawButtonBorder(aButtonUp_);
|
||||
|
|
|
@ -25,6 +25,25 @@
|
|||
namespace RiscOS
|
||||
{
|
||||
|
||||
/* XPM */
|
||||
static const char * const unsticky_xpm[] = {
|
||||
"12 12 3 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #FFFFFF",
|
||||
" ... ",
|
||||
" . + . ",
|
||||
" .+ +. ",
|
||||
" . + . ",
|
||||
" .+ +. ",
|
||||
" .+ + +. ",
|
||||
" .+ + + +. ",
|
||||
".+ + + + +. ",
|
||||
"........... ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . "};
|
||||
|
||||
/* XPM */
|
||||
static const char * const sticky_xpm[] = {
|
||||
"12 12 3 1",
|
||||
|
@ -44,6 +63,7 @@ static const char * const sticky_xpm[] = {
|
|||
" . . ",
|
||||
". "};
|
||||
|
||||
|
||||
StickyButton::StickyButton(QWidget * parent)
|
||||
: Button(parent),
|
||||
on_(false)
|
||||
|
@ -55,6 +75,11 @@ StickyButton::StickyButton(QWidget * parent)
|
|||
StickyButton::setOn(bool on)
|
||||
{
|
||||
on_ = on;
|
||||
setPixmap(
|
||||
on_ ?
|
||||
QPixmap((const char **)unsticky_xpm) :
|
||||
QPixmap((const char **)sticky_xpm)
|
||||
);
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
@ -69,6 +94,10 @@ StickyButton::mouseReleaseEvent(QMouseEvent * e)
|
|||
switch (e->button())
|
||||
{
|
||||
default:
|
||||
if (on_)
|
||||
emit(unstickClient());
|
||||
else
|
||||
emit(stickClient());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,10 @@ class StickyButton : public Button
|
|||
protected:
|
||||
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
|
||||
private:
|
||||
|
||||
bool on_;
|
||||
};
|
||||
|
||||
} // End namespace
|
||||
|
|
Loading…
Reference in a new issue