Very strange... I don't understand what is missing
[kdeartwork.git] / kwin-styles / system / systemclient.cpp
bloba4e0df8a9f9c74488fa41b0bdf90bab89604e091
1 #include "systemclient.h"
3 #include <qlayout.h>
4 #include <qdrawutil.h>
5 #include <qbitmap.h>
6 #include <qtooltip.h>
7 #include <qlabel.h>
8 #include <qcursor.h>
9 //Added by qt3to4:
10 #include <QPixmap>
11 #include <QPaintEvent>
12 #include <QGridLayout>
13 #include <QEvent>
14 #include <QBoxLayout>
15 #include <Q3ValueList>
16 #include <QShowEvent>
17 #include <QResizeEvent>
18 #include <QMouseEvent>
20 #include <kpixmapeffect.h>
21 #include <kdrawutil.h>
22 #include <klocale.h>
23 #include <kapplication.h>
24 #include <kdebug.h>
26 // Default button layout
27 const char default_left[] = "X";
28 const char default_right[] = "HSIA";
30 namespace System {
32 static unsigned char iconify_bits[] = {
33 0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00};
35 static unsigned char maximize_bits[] = {
36 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00};
38 static unsigned char r_minmax_bits[] = {
39 0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f};
41 static unsigned char l_minmax_bits[] = {
42 0x30, 0x18, 0xcc, 0xe6, 0xf3, 0xf9, 0xfc, 0xfc};
44 static unsigned char unsticky_bits[] = {
45 0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x00};
47 static unsigned char sticky_bits[] = {
48 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00};
50 static unsigned char question_bits[] = {
51 0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18};
53 static KPixmap *aUpperGradient=0;
54 static KPixmap *iUpperGradient=0;
56 static KPixmap *btnPix=0;
57 static KPixmap *btnPixDown=0;
58 static KPixmap *iBtnPix=0;
59 static KPixmap *iBtnPixDown=0;
60 static QColor *btnForeground;
62 static bool pixmaps_created = false;
64 static void drawButtonFrame(KPixmap *pix, const QColorGroup &g)
66 QPainter p;
67 p.begin(pix);
68 p.setPen(g.mid());
69 p.drawLine(0, 0, 13, 0);
70 p.drawLine(0, 0, 0, 13);
71 p.setPen(g.light());
72 p.drawLine(13, 0, 13, 13);
73 p.drawLine(0, 13, 13, 13);
74 p.setPen(g.dark());
75 p.drawRect(1, 1, 12, 12);
76 p.end();
79 static void create_pixmaps()
81 if(pixmaps_created)
82 return;
83 pixmaps_created = true;
85 if(QPixmap::defaultDepth() > 8){
86 // titlebar
87 aUpperGradient = new KPixmap;
88 aUpperGradient->resize(32, 18);
89 iUpperGradient = new KPixmap;
90 iUpperGradient->resize(32, 18);
91 QColor bgColor = kapp->palette().active().background();
92 KPixmapEffect::gradient(*aUpperGradient,
93 KDecoration::options()->color(KDecorationOptions::ColorFrame, true).light(130),
94 bgColor,
95 KPixmapEffect::VerticalGradient);
96 KPixmapEffect::gradient(*iUpperGradient,
97 KDecoration::options()->color(KDecorationOptions::ColorFrame, false).light(130),
98 bgColor,
99 KPixmapEffect::VerticalGradient);
101 // buttons
102 KPixmap aPix;
103 aPix.resize(12, 12);
104 KPixmap iPix;
105 iPix.resize(12, 12);
106 KPixmap aInternal;
107 aInternal.resize(8, 8);
108 KPixmap iInternal;
109 iInternal.resize(8, 8);
111 QColor hColor(KDecoration::options()->color(KDecorationOptions::ColorButtonBg, false));
112 KPixmapEffect::gradient(iInternal,
113 hColor.dark(120),
114 hColor.light(120),
115 KPixmapEffect::DiagonalGradient);
116 KPixmapEffect::gradient(iPix,
117 hColor.light(150),
118 hColor.dark(150),
119 KPixmapEffect::DiagonalGradient);
121 hColor =KDecoration::options()->color(KDecorationOptions::ColorButtonBg, true);
122 KPixmapEffect::gradient(aInternal,
123 hColor.dark(120),
124 hColor.light(120),
125 KPixmapEffect::DiagonalGradient);
126 KPixmapEffect::gradient(aPix,
127 hColor.light(150),
128 hColor.dark(150),
129 KPixmapEffect::DiagonalGradient);
130 bitBlt(&aPix, 1, 1, &aInternal, 0, 0, 8, 8, Qt::CopyROP, true);
131 bitBlt(&iPix, 1, 1, &iInternal, 0, 0, 8, 8, Qt::CopyROP, true);
133 // normal buttons
134 btnPix = new KPixmap;
135 btnPix->resize(14, 14);
136 bitBlt(btnPix, 2, 2, &aPix, 0, 0, 10, 10, Qt::CopyROP, true);
137 drawButtonFrame(btnPix, KDecoration::options()->colorGroup(KDecorationOptions::ColorFrame, true));
139 iBtnPix = new KPixmap;
140 iBtnPix->resize(14, 14);
141 bitBlt(iBtnPix, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true);
142 drawButtonFrame(iBtnPix, KDecoration::options()->colorGroup(KDecorationOptions::ColorFrame, false));
145 // pressed buttons
146 hColor = KDecoration::options()->color(KDecorationOptions::ColorButtonBg, false);
147 KPixmapEffect::gradient(iInternal,
148 hColor.light(130),
149 hColor.dark(130),
150 KPixmapEffect::DiagonalGradient);
151 KPixmapEffect::gradient(iPix,
152 hColor.light(150),
153 hColor.dark(150),
154 KPixmapEffect::DiagonalGradient);
156 hColor =KDecoration::options()->color(KDecorationOptions::ColorButtonBg, true);
157 KPixmapEffect::gradient(aInternal,
158 hColor.light(130),
159 hColor.dark(130),
160 KPixmapEffect::DiagonalGradient);
161 KPixmapEffect::gradient(aPix,
162 hColor.light(150),
163 hColor.dark(150),
164 KPixmapEffect::DiagonalGradient);
165 bitBlt(&aPix, 1, 1, &aInternal, 0, 0, 8, 8, Qt::CopyROP, true);
166 bitBlt(&iPix, 1, 1, &iInternal, 0, 0, 8, 8, Qt::CopyROP, true);
168 btnPixDown = new KPixmap;
169 btnPixDown->resize(14, 14);
170 bitBlt(btnPixDown, 2, 2, &aPix, 0, 0, 10, 10, Qt::CopyROP, true);
171 drawButtonFrame(btnPixDown, KDecoration::options()->colorGroup(KDecorationOptions::ColorFrame,
172 true));
174 iBtnPixDown = new KPixmap;
175 iBtnPixDown->resize(14, 14);
176 bitBlt(iBtnPixDown, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true);
177 drawButtonFrame(iBtnPixDown, options()->colorGroup(KDecorationOptions::ColorFrame,
178 false));
180 if(qGray(KDecoration::options()->color(KDecorationOptions::ColorButtonBg, true).rgb()) > 128)
181 btnForeground = new QColor(Qt::black);
182 else
183 btnForeground = new QColor(Qt::white);
186 static void delete_pixmaps()
188 if(aUpperGradient){
189 delete aUpperGradient;
190 delete iUpperGradient;
191 delete btnPix;
192 delete btnPixDown;
193 delete iBtnPix;
194 delete iBtnPixDown;
195 aUpperGradient = 0;
197 delete btnForeground;
198 pixmaps_created = false;
201 SystemButton::SystemButton(SystemClient *parent, const char *name,
202 const unsigned char *bitmap, const QString& tip)
203 : Q3Button(parent->widget(), name)
205 setTipText(tip);
206 setBackgroundMode( Qt::NoBackground );
207 setCursor(Qt::ArrowCursor);
208 resize(14, 14);
209 if(bitmap)
210 setBitmap(bitmap);
211 client = parent;
214 void SystemButton::setTipText(const QString &tip)
216 if (KDecoration::options()->showTooltips())
218 QToolTip::remove(this );
219 this->setToolTip( tip );
224 QSize SystemButton::sizeHint() const
226 return(QSize(14, 14));
229 void SystemButton::reset()
231 repaint(false);
234 void SystemButton::setBitmap(const unsigned char *bitmap)
236 deco = QBitmap(8, 8, bitmap, true);
237 deco.setMask(deco);
238 repaint();
241 void SystemButton::drawButton(QPainter *p)
243 if(btnPixDown){
244 if(client->isActive())
245 p->drawPixmap(0, 0, isDown() ? *btnPixDown : *btnPix);
246 else
247 p->drawPixmap(0, 0, isDown() ? *iBtnPixDown : *iBtnPix);
249 else{
250 QColorGroup g = KDecoration::options()->color(KDecorationOptions::ColorFrame,
251 client->isActive());
252 int x2 = width()-1;
253 int y2 = height()-1;
254 // outer frame
255 p->setPen(g.mid());
256 p->drawLine(0, 0, x2, 0);
257 p->drawLine(0, 0, 0, y2);
258 p->setPen(g.light());
259 p->drawLine(x2, 0, x2, y2);
260 p->drawLine(0, x2, y2, x2);
261 p->setPen(g.dark());
262 p->drawRect(1, 1, width()-2, height()-2);
263 // inner frame
264 g = KDecoration::options()->colorGroup(KDecorationOptions::ColorButtonBg, client->isActive());
265 p->fillRect(3, 3, width()-6, height()-6, g.background());
266 p->setPen(isDown() ? g.mid() : g.light());
267 p->drawLine(2, 2, x2-2, 2);
268 p->drawLine(2, 2, 2, y2-2);
269 p->setPen(isDown() ? g.light() : g.mid());
270 p->drawLine(x2-2, 2, x2-2, y2-2);
271 p->drawLine(2, x2-2, y2-2, x2-2);
275 if(!deco.isNull()){
276 p->setPen(*btnForeground);
277 p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco);
281 void SystemButton::mousePressEvent( QMouseEvent* e )
283 last_button = e->button();
284 QMouseEvent me ( e->type(), e->pos(), e->globalPos(), Qt::LeftButton, e->state() );
285 Q3Button::mousePressEvent( &me );
288 void SystemButton::mouseReleaseEvent( QMouseEvent* e )
290 last_button = e->button();
291 QMouseEvent me ( e->type(), e->pos(), e->globalPos(), Qt::LeftButton, e->state() );
292 Q3Button::mouseReleaseEvent( &me );
297 SystemClient::SystemClient(KDecorationBridge* bridge, KDecorationFactory* factory)
298 : KDecoration(bridge, factory)
301 SystemClient::~SystemClient()
303 for (int n=0; n<ButtonTypeCount; n++) {
304 if (button[n]) delete button[n];
308 void SystemClient::init()
310 createMainWidget(0);
311 widget()->installEventFilter( this );
313 QGridLayout* g = new QGridLayout(widget(), 0, 0, 2);
315 if (isPreview())
317 g->addWidget(new QLabel(i18n("<center><b>System++ preview</b></center>"), widget()), 1, 1);
319 else
321 g->addItem(new QSpacerItem( 0, 0 ), 1, 1); // no widget in the middle
323 // g->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ) );
324 g->setRowStretch(1, 10);
326 g->addColSpacing(0, 2);
327 g->addColSpacing(2, 2);
328 g->addRowSpacing(2, 6);
330 QBoxLayout* hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
331 hb->setResizeMode(QLayout::FreeResize);
332 g->addLayout( hb, 0, 1 );
333 hb->addSpacing(3);
335 titlebar = new QSpacerItem(10, 14, QSizePolicy::Expanding,
336 QSizePolicy::Minimum);
338 // setup titlebar buttons
339 for (int n=0; n<ButtonTypeCount; n++) button[n] = 0;
340 addButtons(hb, KDecoration::options()->customButtonPositions() ?
341 KDecoration::options()->titleButtonsLeft() : QString(default_left));
342 hb->addSpacing(2);
343 hb->addItem(titlebar);
344 hb->addSpacing(3);
345 addButtons(hb, KDecoration::options()->customButtonPositions() ?
346 KDecoration::options()->titleButtonsRight() : QString(default_right));
347 hb->addSpacing(2);
349 widget()->setBackgroundMode(Qt::NoBackground);
350 recalcTitleBuffer();
353 void SystemClient::addButtons(QBoxLayout *hb, const QString& s)
355 unsigned char *minmax_bits;
356 int l_max = KDecoration::options()->titleButtonsLeft().count('A');
357 if (s.length() > 0) {
358 for (unsigned n=0; n < s.length(); n++) {
359 switch (s[n]) {
360 case 'X': // Close button
361 if ((!button[ButtonClose]) && isCloseable()) {
362 button[ButtonClose] = new SystemButton(this, "close", NULL, i18n("Close"));
363 connect( button[ButtonClose], SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) );
364 hb->addWidget(button[ButtonClose]);
365 hb->addSpacing(1);
367 break;
369 case 'S': // Sticky button
370 if (!button[ButtonSticky]) {
371 button[ButtonSticky] = new SystemButton(this, "sticky", NULL, i18n("On all desktops"));
372 if(isOnAllDesktops())
373 button[ButtonSticky]->setBitmap(unsticky_bits);
374 else
375 button[ButtonSticky]->setBitmap(sticky_bits);
376 connect( button[ButtonSticky], SIGNAL( clicked() ), this, ( SLOT( toggleOnAllDesktops() ) ) );
377 hb->addWidget(button[ButtonSticky]);
378 hb->addSpacing(1);
380 break;
382 case 'I': // Minimize button
383 if ((!button[ButtonMinimize]) && isMinimizable()) {
384 button[ButtonMinimize] = new SystemButton(this, "iconify", iconify_bits, i18n("Minimize"));
385 connect( button[ButtonMinimize], SIGNAL( clicked() ), this, ( SLOT( minimize() ) ) );
386 hb->addWidget(button[ButtonMinimize]);
387 hb->addSpacing(1);
389 break;
391 case 'A': // Maximize button
392 if ((!button[ButtonMaximize]) && isMaximizable()) {
393 if (maximizeMode()==MaximizeFull) {
394 if (KDecoration::options()->customButtonPositions() && (l_max>-1))
395 minmax_bits = l_minmax_bits;
396 else
397 minmax_bits = r_minmax_bits;
398 button[ButtonMaximize] = new SystemButton(this, "maximize", minmax_bits, i18n("Restore"));
400 else
401 button[ButtonMaximize] = new SystemButton(this, "maximize", maximize_bits, i18n("Maximize"));
402 connect( button[ButtonMaximize], SIGNAL( clicked() ), this, ( SLOT( maxButtonClicked() ) ) );
403 hb->addWidget(button[ButtonMaximize]);
404 hb->addSpacing(1);
406 break;
408 case 'H': // Help button
409 if ((!button[ButtonHelp]) && providesContextHelp()) {
410 button[ButtonHelp] = new SystemButton(this, "help", question_bits, i18n("Help"));
411 connect( button[ButtonHelp], SIGNAL( clicked() ), this, ( SLOT( showContextHelp() ) ) );
412 hb->addWidget(button[ButtonHelp]);
413 hb->addSpacing(1);
415 break;
422 bool SystemClient::eventFilter( QObject* o, QEvent* e )
424 if( o != widget())
425 return false;
426 switch( e->type())
428 case QEvent::Resize:
429 resizeEvent(static_cast< QResizeEvent* >( e ) );
430 return true;
431 case QEvent::Paint:
432 paintEvent(static_cast< QPaintEvent* >( e ) );
433 return true;
434 case QEvent::MouseButtonDblClick:
435 mouseDoubleClickEvent(static_cast< QMouseEvent* >( e ) );
436 return true;
437 case QEvent::MouseButtonPress:
438 processMousePressEvent(static_cast< QMouseEvent* >( e ) );
439 return true;
440 default:
441 break;
443 return false;
446 void SystemClient::reset(unsigned long)
448 titleBuffer.resize(0, 0);
449 recalcTitleBuffer();
450 widget()->repaint();
451 if (button[ButtonClose])
452 button[ButtonClose]->reset();
453 if (button[ButtonSticky])
454 button[ButtonSticky]->reset();
455 if (button[ButtonMinimize])
456 button[ButtonMinimize]->reset();
457 if (button[ButtonMaximize])
458 button[ButtonMaximize]->reset();
459 if (button[ButtonHelp])
460 button[ButtonHelp]->reset();
463 void SystemClient::maxButtonClicked()
465 maximize( button[ButtonMaximize]->last_button );
468 void SystemClient::resizeEvent( QResizeEvent* )
470 //Client::resizeEvent( e );
471 recalcTitleBuffer();
472 doShape();
474 if ( isVisibleToTLW() && !testWFlags( WStaticContents )) {
475 QPainter p( this );
476 QRect t = titlebar->geometry();
477 t.setTop( 0 );
478 QRegion r = rect();
479 r = r.subtract( t );
480 p.setClipRegion( r );
481 p.eraseRect( rect() );
485 void SystemClient::resize( const QSize& s )
487 widget()->resize( s );
491 QSize SystemClient::minimumSize() const
493 return widget()->minimumSize();
497 void SystemClient::recalcTitleBuffer()
499 if(oldTitle == caption() && width() == titleBuffer.width())
500 return;
501 QFontMetrics fm(options()->font(true));
502 titleBuffer.resize(width(), 18);
503 QPainter p;
504 p.begin(&titleBuffer);
505 if(aUpperGradient)
506 p.drawTiledPixmap(0, 0, width(), 18, *aUpperGradient);
507 else
508 p.fillRect(0, 0, width(), 18,
509 options()->colorGroup(KDecorationOptions::ColorFrame, true).
510 brush(QColorGroup::Button));
512 QRect t = titlebar->geometry();
513 t.setTop( 2 );
514 t.setLeft( t.left() + 4 );
515 t.setRight( t.right() - 2 );
517 QRegion r(t.x(), 0, t.width(), 18);
518 r -= QRect(t.x()+((t.width()-fm.width(caption()))/2)-4,
519 0, fm.width(caption())+8, 18);
520 p.setClipRegion(r);
521 int i, ly;
522 for(i=0, ly=4; i < 4; ++i, ly+=3){
523 p.setPen(options()->color(KDecorationOptions::ColorTitleBar, true).light(150));
524 p.drawLine(0, ly, width()-1, ly);
525 p.setPen(options()->color(KDecorationOptions::ColorTitleBar, true).dark(120));
526 p.drawLine(0, ly+1, width()-1, ly+1);
528 p.setClipRect(t);
529 p.setPen(options()->color(KDecorationOptions::ColorFont, true));
530 p.setFont(options()->font(true));
532 p.drawText(t.x()+((t.width()-fm.width(caption()))/2)-4,
533 0, fm.width(caption())+8, 18, Qt::AlignCenter, caption());
534 p.setClipping(false);
535 p.end();
536 oldTitle = caption();
539 void SystemClient::captionChange()
541 recalcTitleBuffer();
542 widget()->repaint(titlebar->geometry(), false);
545 void SystemClient::drawRoundFrame(QPainter &p, int x, int y, int w, int h)
547 kDrawRoundButton(&p, x, y, w, h,
548 options()->colorGroup(KDecorationOptions::ColorFrame, isActive()), false);
552 void SystemClient::paintEvent( QPaintEvent* )
554 QPainter p(widget());
555 QRect t = titlebar->geometry();
557 QBrush fillBrush(widget()->palette().brush(QColorGroup::Background).pixmap() ?
558 widget()->palette().brush(QColorGroup::Background) :
559 options()->color(KDecorationOptions::ColorFrame, isActive()).
560 brush(QColorGroup::Button));
562 p.fillRect(1, 18, width()-2, height()-19, fillBrush);
564 t.setTop( 2 );
565 t.setLeft( t.left() + 4 );
566 t.setRight( t.right() - 2 );
568 if(isActive())
569 p.drawPixmap(0, 0, titleBuffer);
570 else{
571 if(iUpperGradient)
572 p.drawTiledPixmap(0, 0, width(), 18, *iUpperGradient);
573 else
574 p.fillRect(0, 0, width(), 18, fillBrush);
575 p.setPen(options()->color(KDecorationOptions::ColorFont, isActive()));
576 p.setFont(options()->font(isActive()));
577 p.drawText(t, Qt::AlignCenter, caption() );
580 p.setPen(options()->color(KDecorationOptions::ColorFrame, isActive()).light());
581 p.drawLine(width()-20, height()-7, width()-10, height()-7);
582 p.drawLine(width()-20, height()-5, width()-10, height()-5);
583 p.setPen(options()->color(KDecorationOptions::ColorFrame, isActive()).dark());
584 p.drawLine(width()-20, height()-6, width()-10, height()-6);
585 p.drawLine(width()-20, height()-4, width()-10, height()-4);
587 drawRoundFrame(p, 0, 0, width(), height());
590 #define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
592 void SystemClient::doShape()
594 // using a bunch of QRect lines seems much more efficent than bitmaps or
595 // point arrays
597 QRegion mask;
598 kRoundMaskRegion(mask, 0, 0, width(), height());
599 setMask(mask);
602 void SystemClient::showEvent(QShowEvent *)
604 // Client::showEvent(ev);
605 doShape();
606 widget()->show();
607 // widget()->repaint();
610 /*void SystemClient::windowWrapperShowEvent( QShowEvent* )
612 doShape();
615 void SystemClient::mouseDoubleClickEvent( QMouseEvent * e )
617 if ( e->button() == Qt::LeftButton && titlebar->geometry().contains( e->pos() ) )
618 titlebarDblClickOperation();
621 void SystemClient::maximizeChange()
623 unsigned char *minmax_bits;
624 int l_max = KDecoration::options()->titleButtonsLeft().count('A');
625 if (KDecoration::options()->customButtonPositions() && (l_max>-1))
626 minmax_bits = l_minmax_bits;
627 else
628 minmax_bits = r_minmax_bits;
629 if (button[ButtonMaximize]) {
630 button[ButtonMaximize]->setBitmap((maximizeMode()==MaximizeFull) ? minmax_bits : maximize_bits);
631 button[ButtonMaximize]->setTipText((maximizeMode()==MaximizeFull) ? i18n("Restore") : i18n("Maximize"));
635 void SystemClient::activeChange()
637 widget()->repaint(false);
638 if (button[ButtonClose])
639 button[ButtonClose]->reset();
640 if (button[ButtonSticky])
641 button[ButtonSticky]->reset();
642 if (button[ButtonMinimize])
643 button[ButtonMinimize]->reset();
644 if (button[ButtonMaximize])
645 button[ButtonMaximize]->reset();
646 if (button[ButtonHelp])
647 button[ButtonHelp]->reset();
650 void SystemClient::iconChange()
652 // if (button[BtnMenu] && button[BtnMenu]->isVisible())
653 // button[BtnMenu]->repaint(false);
656 void SystemClient::desktopChange()
658 if (button[ButtonSticky]) {
659 button[ButtonSticky]->setBitmap(isOnAllDesktops() ? unsticky_bits : sticky_bits);
660 button[ButtonSticky]->setTipText(isOnAllDesktops() ? i18n("Not on all desktops") : i18n("On all desktops"));
664 /*void SystemClient::stickyChange(bool on)
668 KDecoration::Position SystemClient::mousePosition(const QPoint &p) const
670 return KDecoration::mousePosition(p);
673 void SystemClient::borders(int& left, int& right, int& top, int& bottom) const
675 left = 4;
676 right = 4;
677 top = 18;
678 bottom = 8;
680 /* if ((maximizeMode()==MaximizeFull) && !options()->moveResizeMaximizedWindows()) {
681 left = right = bottom = 0;
682 top = 1 + titleHeight + (borderSize-1);
686 SystemDecoFactory::SystemDecoFactory()
688 create_pixmaps();
691 SystemDecoFactory::~SystemDecoFactory()
693 delete_pixmaps();
696 KDecoration *SystemDecoFactory::createDecoration( KDecorationBridge *b )
698 return new SystemClient(b, this);
701 bool SystemDecoFactory::reset( unsigned long changed )
703 System::delete_pixmaps();
704 System::create_pixmaps();
705 // Ensure changes in tooltip state get applied
706 resetDecorations(changed);
707 return true;
710 bool SystemDecoFactory::supports( Ability ability )
712 switch( ability )
714 case AbilityAnnounceButtons:
715 case AbilityButtonOnAllDesktops:
716 case AbilityButtonHelp:
717 case AbilityButtonMinimize:
718 case AbilityButtonMaximize:
719 case AbilityButtonClose:
720 return true;
721 default:
722 return false;
726 QList<KDecorationFactory::BorderSize> SystemDecoFactory::borderSizes() const
727 { // the list must be sorted
728 return Q3ValueList< BorderSize >() << BorderNormal;
733 extern "C" KDE_EXPORT KDecorationFactory *create_factory()
735 return new System::SystemDecoFactory();
738 #include "systemclient.moc"