From 7e9d501dc4019cc6149ef45b3f2377062cf84635 Mon Sep 17 00:00:00 2001 From: Rik Hemsley Date: Tue, 18 Jul 2000 19:39:31 +0000 Subject: [PATCH] Quickhelp button. Yes, I know the glyph is backwards. I'm busy. Leave me alone. svn path=/trunk/kdebase/kwin/; revision=57823 --- default/Button.cpp | 2 +- default/Makefile.am | 2 ++ default/Static.cpp | 9 ++++++++- default/Static.h | 6 ++++-- default/TitleBar.cpp | 20 +++++++++++++++++--- default/TitleBar.h | 2 ++ 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/default/Button.cpp b/default/Button.cpp index ce7964877e..6a468adf15 100644 --- a/default/Button.cpp +++ b/default/Button.cpp @@ -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()); diff --git a/default/Makefile.am b/default/Makefile.am index 305352d719..81c5cf28ff 100644 --- a/default/Makefile.am +++ b/default/Makefile.am @@ -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 \ diff --git a/default/Static.cpp b/default/Static.cpp index 637b5f6a58..5d16daad17 100644 --- a/default/Static.cpp +++ b/default/Static.cpp @@ -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 diff --git a/default/Static.h b/default/Static.h index 3ea118b7de..f3a654b2b7 100644 --- a/default/Static.h +++ b/default/Static.h @@ -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_; diff --git a/default/TitleBar.cpp b/default/TitleBar.cpp index bd3f976f09..7125af5b19 100644 --- a/default/TitleBar.cpp +++ b/default/TitleBar.cpp @@ -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 diff --git a/default/TitleBar.h b/default/TitleBar.h index 4741a6fee8..e39724f5fd 100644 --- a/default/TitleBar.h +++ b/default/TitleBar.h @@ -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_;