Quickhelp button.

Yes, I know the glyph is backwards. I'm busy. Leave me alone.

svn path=/trunk/kdebase/kwin/; revision=57823
This commit is contained in:
Rik Hemsley 2000-07-18 19:39:31 +00:00
parent 5573307cfb
commit 7e9d501dc4
6 changed files with 34 additions and 7 deletions

View file

@ -33,7 +33,7 @@ Button::Button(QWidget * parent, SymbolType t)
down_ (false),
active_ (false)
{
if (type_ == Sticky)
if (type_ == Sticky || type_ == Question)
setFixedWidth(Static::instance()->buttonWidth2());
else
setFixedWidth(Static::instance()->buttonWidth1());

View file

@ -7,6 +7,7 @@ Button.cpp \
CloseButton.cpp \
DBWidget.cpp \
IconifyButton.cpp \
QuestionButton.cpp \
StickyButton.cpp \
Manager.cpp \
MaximiseButton.cpp \
@ -26,6 +27,7 @@ Button.h \
CloseButton.h \
DBWidget.h \
IconifyButton.h \
QuestionButton.h \
StickyButton.h \
Manager.h \
MaximiseButton.h \

View file

@ -272,7 +272,7 @@ Static::update()
QPixmap
Static::button(SymbolType t, bool active, bool down)
{
bool buttonSize2 = (t == Sticky || t == Unsticky);
bool buttonSize2 = (t == Sticky || t == Unsticky || t == Question);
QPixmap px = buttonPixmap(!buttonSize2, active, down);
QBitmap b = glyph(t);
@ -285,6 +285,12 @@ Static::button(SymbolType t, bool active, bool down)
return px;
}
//static unsigned char unsticky_bits[] = {
// 0x38, 0x38, 0x38, 0x38, 0x7c, 0x10, 0x10, 0x10};
//
//static unsigned char sticky_bits[] = {
// 0x20, 0x70, 0xfa, 0x7c, 0x38, 0x14, 0x22, 0x01};
static unsigned char iconify_bits[] = {
0xff, 0xff, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18};
@ -315,6 +321,7 @@ Static::_loadGlyphs()
glyphSticky_ = QBitmap(8, 8, sticky_bits);
glyphUnsticky_ = QBitmap(8, 8, unsticky_bits);
glyphIconify_ = QBitmap(8, 8, iconify_bits);
glyphQuestion_ = QBitmap(8, 8, question_bits);
}
} // End namespace

View file

@ -35,7 +35,7 @@
namespace Default
{
enum SymbolType { Sticky, Unsticky, Close, Iconify, Max, Unmax };
enum SymbolType { Sticky, Unsticky, Close, Iconify, Max, Unmax, Question };
class Static
{
@ -98,6 +98,7 @@ class Static
case Iconify: return glyphIconify_;
case Max: return glyphMaximise_;
case Unmax: return glyphUnmaximise_;
case Question: return glyphQuestion_;
default: return glyphClose_;
}
}
@ -154,7 +155,8 @@ class Static
glyphUnsticky_,
glyphIconify_,
glyphMaximise_,
glyphUnmaximise_;
glyphUnmaximise_,
glyphQuestion_;
KPixmap aTitle_, iTitle_;
KPixmap aTitleLeft_, iTitleLeft_;

View file

@ -27,6 +27,7 @@
#include "TitleText.h"
#include "CloseButton.h"
#include "IconifyButton.h"
#include "QuestionButton.h"
#include "StickyButton.h"
#include "MaximiseButton.h"
@ -41,8 +42,9 @@ TitleBar::TitleBar(Manager * client)
iconify_ = new IconifyButton (this);
maximise_ = new MaximiseButton (this);
sticky_ = new StickyButton (this);
question_ = new QuestionButton (this);
// Close | Text | Sticky | Iconify | Maximise
// Close | Text | Question | Sticky | Iconify | Maximise
QHBoxLayout * layout = new QHBoxLayout(this);
layout->setMargin(3);
@ -51,6 +53,7 @@ TitleBar::TitleBar(Manager * client)
layout->addSpacing(2);
layout->addWidget(text_, 1);
layout->addSpacing(2);
layout->addWidget(question_);
layout->addWidget(sticky_);
layout->addWidget(iconify_);
layout->addWidget(maximise_);
@ -94,6 +97,11 @@ TitleBar::TitleBar(Manager * client)
client, SIGNAL(maximiseChanged(bool)),
maximise_, SLOT(setOn(bool))
);
connect(
question_, SIGNAL(contextHelp()),
client, SLOT(contextHelp())
);
}
void
@ -101,11 +109,12 @@ TitleBar::updateDisplay()
{
close_ ->updateDisplay();
sticky_ ->updateDisplay();
question_ ->updateDisplay();
text_ ->updateDisplay();
iconify_ ->updateDisplay();
maximise_ ->updateDisplay();
}
void
TitleBar::updateText()
{
@ -131,11 +140,13 @@ TitleBar::resizeEvent(QResizeEvent *)
close_ ->show();
sticky_ ->hide();
iconify_ ->show();
question_ ->hide();
maximise_ ->hide();
break;
case 2:
close_ ->show();
question_ ->hide();
sticky_ ->hide();
iconify_ ->hide();
maximise_ ->hide();
@ -143,6 +154,7 @@ TitleBar::resizeEvent(QResizeEvent *)
case 3:
close_ ->hide();
question_ ->hide();
sticky_ ->hide();
iconify_ ->hide();
maximise_ ->hide();
@ -151,7 +163,8 @@ TitleBar::resizeEvent(QResizeEvent *)
case 0:
default:
close_ ->show();
sticky_ ->show();
question_ ->show();
sticky_ ->show();
iconify_ ->show();
maximise_ ->show();
break;
@ -166,6 +179,7 @@ TitleBar::setActive(bool b)
text_->setActive(b);
iconify_->setActive(b);
maximise_->setActive(b);
question_->setActive(b);
}
void

View file

@ -29,6 +29,7 @@ namespace Default
{
class Manager;
class QuestionButton;
class StickyButton;
class CloseButton;
class TitleText;
@ -59,6 +60,7 @@ class TitleBar : public QWidget
TitleText * text_;
QuestionButton * question_;
StickyButton * sticky_;
IconifyButton * iconify_;
MaximiseButton * maximise_;