diff options
Diffstat (limited to 'malloryclient/malloryclient.cpp')
-rw-r--r-- | malloryclient/malloryclient.cpp | 695 |
1 files changed, 695 insertions, 0 deletions
diff --git a/malloryclient/malloryclient.cpp b/malloryclient/malloryclient.cpp new file mode 100644 index 0000000..cd6028c --- /dev/null +++ b/malloryclient/malloryclient.cpp @@ -0,0 +1,695 @@ +// +// C++ Implementation: malloryclient +// +// Description: +// +// +// Author: Remi Villatel <maxilys@tele2.fr>, (C) 2005 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <klocale.h> +#include <kpixmap.h> +#include <kpixmapeffect.h> + +#include <qcursor.h> +#include <qfontmetrics.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qpainter.h> +#include <qpixmap.h> +#include <qimage.h> +#include <qtooltip.h> + +#include "malloryclient.h" +#include "malloryhandler.h" +#include "mallorybutton.h" +#include "pixmaps.h" +#include "enums.h" + +MalloryClient::MalloryClient(KDecorationBridge *bridge, KDecorationFactory *factory) + : KDecoration(bridge, factory), m_titleBar(0) +{ +} + +MalloryClient::~MalloryClient() +{ + // Delete buttons from memory. + for (int n=0; n<ButtonTypeCount; n++) + { + if (m_button[n]) delete m_button[n]; + } +} + +void MalloryClient::init() +{ + createMainWidget(WResizeNoErase | WRepaintNoErase); + widget()->installEventFilter(this); + widget()->setBackgroundMode(NoBackground); // to avoid flicker + + // Set up layout + QGridLayout *mainLayout = new QGridLayout(widget(), 4, 3); // 4 x 3 grid + QHBoxLayout *titleLayout = new QHBoxLayout(); + QVBoxLayout *leftButtonLayout = new QVBoxLayout(); + QHBoxLayout *leftButtonLayout2 = new QHBoxLayout(); + leftButtonLayout->setSpacing(2); + QVBoxLayout *rightButtonLayout = new QVBoxLayout(); + QHBoxLayout *rightButtonLayout2 = new QHBoxLayout(); + rightButtonLayout->setSpacing(2); + + mainLayout->setResizeMode(QLayout::FreeResize); + + m_titleBar = new QSpacerItem(1, MalloryHandler::titleSize(), QSizePolicy::Expanding, QSizePolicy::Fixed); + m_leftSpacer = new QSpacerItem(1, 1); + m_rightSpacer = new QSpacerItem(1, 1); + m_topSpacer = new QSpacerItem(1, 1); // 2nd argument is the top margin. + m_bottomSpacer = new QSpacerItem(1, MalloryHandler::borderSize()); + m_leftButtonSpacer = new QSpacerItem(MalloryHandler::buttonSpacing(), MalloryHandler::titleSize()); + m_rightButtonSpacer = new QSpacerItem(MalloryHandler::buttonSpacing(), MalloryHandler::titleSize()); + m_leftButtonSpacer2 = new QSpacerItem(1, (MalloryHandler::titleSize()-MalloryHandler::buttonSize())/2, QSizePolicy::Minimum, QSizePolicy::Fixed); + m_rightButtonSpacer2 = new QSpacerItem(1, (MalloryHandler::titleSize()-MalloryHandler::buttonSize())/2, QSizePolicy::Minimum, QSizePolicy::Fixed); + + mainLayout->addItem(m_topSpacer, 0, 1); + mainLayout->addItem(m_bottomSpacer, 3, 1); + mainLayout->addItem(m_leftSpacer, 1, 0); + mainLayout->addItem(m_rightSpacer, 1, 2); + + mainLayout->addLayout(titleLayout, 1, 1); + if (isPreview()) + { + mainLayout->addWidget(new QLabel(i18n("<center><b>Mallory</b></center>"), widget()), 2, 1); + } + else + { + mainLayout->addItem(new QSpacerItem(0, 0), 2, 1); + } + + // Make the window stretch + mainLayout->setRowStretch(2, 10); + mainLayout->setColStretch(1, 10); + + titleLayout->addLayout(leftButtonLayout); // Contains the left buttons + titleLayout->addItem(m_leftButtonSpacer); // Left button margin + titleLayout->addItem(m_titleBar); // The text + titleLayout->addItem(m_rightButtonSpacer); // Right button margin + titleLayout->addLayout(rightButtonLayout); // Contains the right buttons + + for (int n=0; n<ButtonTypeCount; n++) m_button[n] = 0; // reset buttons + + // Add the left buttons + leftButtonLayout->addItem(m_leftButtonSpacer2); + leftButtonLayout->addLayout(leftButtonLayout2); + addButtons(leftButtonLayout2, options()->customButtonPositions() ? options()->titleButtonsLeft() : QString(default_left)); + + // Add the right buttons + rightButtonLayout->addItem(m_rightButtonSpacer2); + rightButtonLayout->addLayout(rightButtonLayout2); + addButtons(rightButtonLayout2, options()->customButtonPositions() ? options()->titleButtonsRight() : QString(default_right)); +} + +bool MalloryClient::eventFilter(QObject *o, QEvent *e) +{ + if (o != widget()) + return false; + + switch (e->type()) + { + case QEvent::Resize: + resizeEvent(static_cast<QResizeEvent*>(e)); + return true; + case QEvent::Paint: + paintEvent(static_cast<QPaintEvent*>(e)); + return true; + case QEvent::MouseButtonDblClick: + mouseDoubleClickEvent(static_cast<QMouseEvent*>(e)); + return true; + case QEvent::MouseButtonPress: + processMousePressEvent(static_cast<QMouseEvent*>(e)); + return true; + case QEvent::Show: + showEvent(static_cast<QShowEvent*>(e)); + return true; + + default: + return false; + } +} + +void MalloryClient::addButtons(QBoxLayout *layout, const QString &s) +{ + if (s.length() > 0) + { + for (unsigned n=0; n<s.length(); n++) + { + switch (s[n]) + { + case 'M': // Menu + if (!m_button[ButtonMenu]) + { + m_button[ButtonMenu] = new MalloryButton(this, "menu", i18n("Menu"), ButtonMenu); + connect(m_button[ButtonMenu], SIGNAL(pressed()), this, SLOT(menuButtonPressed())); + layout->addWidget(m_button[ButtonMenu], 0, Qt::AlignHCenter | Qt::AlignTop); + } + break; + case 'H': // Help + if (!m_button[ButtonHelp] && providesContextHelp()) + { + m_button[ButtonHelp] = new MalloryButton(this, "help", i18n("Help"), ButtonHelp); + connect(m_button[ButtonHelp], SIGNAL(clicked()), this, SLOT(showContextHelp())); + layout->addWidget(m_button[ButtonHelp], 0, Qt::AlignHCenter | Qt::AlignTop); + } + break; + case 'I': // Minimize + if ((!m_button[ButtonMin]) && isMinimizable()) + { + m_button[ButtonMin] = new MalloryButton(this, "minimize", i18n("Minimize"), ButtonMin); + connect(m_button[ButtonMin], SIGNAL(clicked()), this, SLOT(minimize())); + layout->addWidget(m_button[ButtonMin], 0, Qt::AlignHCenter | Qt::AlignTop); + } + break; + case 'A': // Maximize + if ((!m_button[ButtonMax]) && isMaximizable()) + { + m_button[ButtonMax] = new MalloryButton(this, "maximize", (maximizeMode()!=MaximizeRestore)?i18n("Minimize"):i18n("Maximize"), ButtonMax); + connect(m_button[ButtonMax], SIGNAL(clicked()), this, SLOT(maxButtonPressed())); + layout->addWidget(m_button[ButtonMax], 0, Qt::AlignHCenter | Qt::AlignTop); + } + break; + case 'X': // Close + if ((!m_button[ButtonClose]) && isCloseable()) + { + m_button[ButtonClose] = new MalloryButton(this, "close", i18n("Close"), ButtonClose); + connect(m_button[ButtonClose], SIGNAL(clicked()), this, SLOT(closeWindow())); + layout->addWidget(m_button[ButtonClose], 0, Qt::AlignHCenter | Qt::AlignTop); + } + break; + case 'S': // OnAllDesktops + if (!m_button[ButtonOnAllDesktops]) + { + m_button[ButtonOnAllDesktops] = new MalloryButton(this, "onAllDesktops", isOnAllDesktops() ? i18n("Not On All Desktops") : i18n("On All Desktops"), ButtonOnAllDesktops); + m_button[ButtonOnAllDesktops]->setOnAllDesktops(isOnAllDesktops()); + connect(m_button[ButtonOnAllDesktops], SIGNAL(clicked()), this, SLOT(toggleOnAllDesktops())); + layout->addWidget(m_button[ButtonOnAllDesktops], 0, Qt::AlignHCenter | Qt::AlignTop); + } + break; + case 'F': // Above all others + if (!m_button[ButtonAbove]) + { + m_button[ButtonAbove] = new MalloryButton(this, "above", i18n("Keep Above Others"), ButtonAbove); + connect(m_button[ButtonAbove], SIGNAL(clicked()), this, SLOT(slotKeepAbove())); + layout->addWidget(m_button[ButtonAbove], 0, Qt::AlignHCenter | Qt::AlignTop); + } + break; + case 'B': // Below all others + if (!m_button[ButtonBelow]) + { + m_button[ButtonBelow] = new MalloryButton(this, "below", i18n("Keep Below Others"), ButtonBelow); + connect(m_button[ButtonBelow], SIGNAL(clicked()), this, SLOT(slotKeepBelow())); + layout->addWidget(m_button[ButtonBelow], 0, Qt::AlignHCenter | Qt::AlignTop); + } + break; + case '_': // Spacer + layout->addSpacing(MalloryHandler::buttonSpacing()); + } + } + } +} + +void MalloryClient::paintEvent(QPaintEvent*) +{ + if (!MalloryHandler::initialized()) return; + + bool active = isActive(); + + QPainter painter(widget()); + + QColor cottl = options()->color(ColorTitleBar, active); + QColor coblnd = options()->color(ColorTitleBlend, active); + QColor cofrm = options()->color(ColorFrame, active); + QColor cobttn = options()->color(ColorButtonBg, active); + + QColorGroup widgetGroup; + widgetGroup = widget()->colorGroup(); + QColor coground = widgetGroup.background(); + + int cfr, cfg, cfb, alr, alg, alb; + cofrm.getRgb(&cfr, &cfg, &cfb); + coground.getRgb(&alr, &alg, &alb); + + QColor aliasing = qRgb((cfr+alr)/2, (cfg+alg)/2, (cfb+alb)/2); + + QRect titleRect(m_titleBar->geometry()); + QRect topRect(m_topSpacer->geometry()); + QRect leftRect(m_leftSpacer->geometry()); + QRect rightRect(m_rightSpacer->geometry()); + QRect bottomRect(m_bottomSpacer->geometry()); + + QFontMetrics fm(options()->font(active, false)); + + int rr = rightRect.right(); + int bb = bottomRect.bottom(); + + QRegion mask; + + if(maximizeMode() != MaximizeFull) + { + mask = QRegion(0, 0, rr+1, bb+1); + + if (MalloryHandler::lessRounded()) + { + // Remove top left corner + mask -= QRegion(0, 0, 2, 1); + mask -= QRegion(0, 1, 1, 1); + // Remove top right corner + mask -= QRegion(rr-1, 0, 2, 1); + mask -= QRegion(rr, 1, 1, 1); + // Remove bottom left corner + mask -= QRegion(0, bb, 2, 1); + mask -= QRegion(0, bb-1, 1, 1); + // Remove bottom right corner + mask -= QRegion(rr-1, bb, 2, 1); + mask -= QRegion(rr, bb-1, 1, 1); + } + else + { + // Remove top left corner + mask -= QRegion(0, 0, 5, 1); + mask -= QRegion(0, 1, 3, 1); + mask -= QRegion(0, 2, 2, 1); + mask -= QRegion(0, 3, 1, 2); + // Remove top right corner + mask -= QRegion(rr-4, 0, 5, 1); + mask -= QRegion(rr-2, 1, 3, 1); + mask -= QRegion(rr-1, 2, 2, 1); + mask -= QRegion(rr, 3, 1, 2); + // Remove bottom left corner + mask -= QRegion(0, bb, 5, 1); + mask -= QRegion(0, bb-1, 3, 1); + mask -= QRegion(0, bb-2, 2, 1); + mask -= QRegion(0, bb-4, 1, 2); + // Remove bottom right corner + mask -= QRegion(rr-4, bb, 5, 1); + mask -= QRegion(rr-2, bb-1, 3, 1); + mask -= QRegion(rr-1, bb-2, 2, 1); + mask -= QRegion(rr, bb-4, 1, 2); + } + } + else + { + mask = QRegion(0, 0, rightRect.right()+1, bottomRect.bottom()+1); + } + setMask(mask); + + painter.drawTiledPixmap(1, titleRect.top(), topRect.width()+leftRect.width()+rightRect.width()-2, titleRect.bottom()-titleRect.top(), active ? *Pixmaps::active_titlebar : *Pixmaps::inactive_titlebar); + + if (titleRect.width() > 0) // Do we even have to paint the title? + { + QPixmap pufferPixmap; + pufferPixmap.resize(titleRect.width(), titleRect.height()-1); + + int flags = AlignAuto | AlignVCenter; + + QPainter pufferPainter(&pufferPixmap); + pufferPainter.drawTiledPixmap(pufferPixmap.rect(), active ? *Pixmaps::active_titlebar : *Pixmaps::inactive_titlebar); + pufferPainter.setFont(options()->font(active, false)); + + // Shift the text 2 px to the right. + pufferPainter.translate(2, 0); + + // Draw title shadow when required... + if (MalloryHandler::titleShadow()) + { + pufferPainter.translate(MalloryHandler::titleShadowSize(), MalloryHandler::titleShadowSize()); + pufferPainter.setPen(cobttn); // Use button color for the shadow + pufferPainter.drawText(pufferPixmap.rect(), flags, caption()); + pufferPainter.translate(-(MalloryHandler::titleShadowSize()), -(MalloryHandler::titleShadowSize())); + } + + // Draw title text + pufferPainter.setPen(options()->color(ColorFont, active)); + pufferPainter.drawText(pufferPixmap.rect(), flags, caption()); + + pufferPainter.end(); + painter.drawPixmap(titleRect.left(), titleRect.top(), pufferPixmap); + } + + // Now we're going to draw the frame... + + // Fill the borders with the background colour + painter.setPen(coground); + painter.drawLine(leftRect.left()+1, titleRect.bottom(), rightRect.right()-1, titleRect.bottom()); + + QRect frame; + // Left + frame.setCoords(leftRect.left()+1, titleRect.bottom(), leftRect.right(), bottomRect.bottom()-1); + painter.fillRect(frame, coground); + // Right + frame.setCoords(rightRect.left(), titleRect.bottom(), rightRect.right()-1, bottomRect.bottom()-1); + painter.fillRect(frame, coground); + // Bottom + frame.setCoords(leftRect.right(), bottomRect.top(), rightRect.left(), bottomRect.bottom()-1); + painter.fillRect(frame, coground); + + // External borders + painter.setPen(cofrm); + // + if(maximizeMode() != MaximizeFull) + { + if (MalloryHandler::lessRounded()) + { + painter.drawLine(2, 0, rr-2, 0); + painter.drawPoint(1, 1); + painter.drawPoint(rr-1, 1); + // + painter.drawLine(0, 2, 0, bb-2); + painter.drawLine(rr, 2, rr, bb-2); + // + painter.drawPoint(1, bb-1); + painter.drawPoint(rr-1, bb-1); + painter.drawLine(2, bb, rr-2, bb); + // + painter.setPen(aliasing); + // + painter.drawLine(2, 1, rr-2, 1); + painter.drawPoint(2, 2); + painter.drawPoint(rr-2, 2); + // + painter.drawLine(1, 2, 1, bb-2); + painter.drawLine(rr-1, 2, rr-1, bb-2); + // + painter.drawPoint(2, bb-2); + painter.drawPoint(rr-2, bb-2); + painter.drawLine(2, bb-1, rr-2, bb-1); + + } + else + { + painter.drawLine(5, 0, rr-5, 0); + painter.drawLine(3, 1, 4, 1); + painter.drawLine(rr-3, 1, rr-4, 1); + painter.drawPoint(2, 2); + painter.drawPoint(rr-2, 2); + painter.drawLine(1, 3, 1, 4); + painter.drawLine(rr-1, 3, rr-1, 4); + // + painter.drawLine(0, 5, 0, bb-5); + painter.drawLine(rr, 5, rr, bb-5); + // + painter.drawLine(5, bb, rr-5, bb); + painter.drawLine(3, bb-1, 4, bb-1); + painter.drawLine(rr-3, bb-1, rr-4, bb-1); + painter.drawPoint(2, bb-2); + painter.drawPoint(rr-2, bb-2); + painter.drawLine(1, bb-3, 1, bb-4); + painter.drawLine(rr-1, bb-3, rr-1, bb-4); + // + painter.setPen(aliasing); + // + painter.drawLine(5, 1, rr-5, 1); + painter.drawLine(3, 2, 5, 2); + painter.drawLine(rr-3, 2, rr-5, 2); + painter.drawPoint(3, 3); + painter.drawPoint(rr-3, 3); + painter.drawLine(2, 3, 2, 5); + painter.drawLine(rr-2, 3, rr-2, 5); + // + painter.drawLine(1, 5, 1, bb-5); + painter.drawLine(rr-1, 5, rr-1, bb-5); + // + painter.drawLine(5, bb-1, rr-5, bb-1); + painter.drawLine(3, bb-2, 5, bb-2); + painter.drawLine(rr-3, bb-2, rr-5, bb-2); + painter.drawPoint(3, bb-3); + painter.drawPoint(rr-3, bb-3); + painter.drawLine(2, bb-3, 2, bb-5); + painter.drawLine(rr-2, bb-3, rr-2, bb-5); + } + } + else + { + // Square/Maximized external borders + painter.drawRect(0, 0, rightRect.right()+1, bottomRect.bottom()+1); + painter.setPen(aliasing); + painter.drawRect(1, 1, rightRect.right()-1, bottomRect.bottom()-1); + } + + // The resize handles when required... + if (MalloryHandler::resizeHandle()) + { + if (isResizable()) + { + painter.setPen(options()->color(ColorHandle, active)); + + if (MalloryHandler::lessRounded()) + { + // Corners + painter.drawRect(2, bb-3, 2, 2); + painter.drawRect(rr-3, bb-3, 2, 2); + + if(MalloryHandler::superSize()) + { + // Above corners + painter.drawRect(2, bb-6, 2, 2); + painter.drawRect(rr-3, bb-6, 2, 2); + // Within bottom + painter.drawRect(5, bb-3, 2, 2); + painter.drawRect(rr-6, bb-3, 2, 2); + } + } + else + { + // Above corners + painter.drawRect(2, bb-6, 2, 2); + painter.drawRect(rr-3, bb-6, 2, 2); + // Within bottom + painter.drawRect(5, bb-3, 2, 2); + painter.drawRect(rr-6, bb-3, 2, 2); + + if(MalloryHandler::superSize()) + { + // Above above + painter.drawRect(2, bb-8, 2, 2); + painter.drawRect(rr-3, bb-8, 2, 2); + // Corners + painter.drawRect(3, bb-4, 2, 2); + painter.drawRect(rr-4, bb-4, 2, 2); + // Within within + painter.drawRect(7, bb-3, 2, 2); + painter.drawRect(rr-8, bb-3, 2, 2); + } + } + } + } +} + +void MalloryClient::showEvent(QShowEvent*) +{ + widget()->update(); +} + +void MalloryClient::resizeEvent(QResizeEvent*) +{ + if ((widget()->isVisibleToTLW()) && (!widget()->testWFlags(WStaticContents))) + { + QRegion region = widget()->rect(); + region.subtract(m_titleBar->geometry()); + widget()->erase(region); + } +} + +void MalloryClient::captionChange() +{ + widget()->repaint(m_titleBar->geometry(), false); +} + +void MalloryClient::mouseDoubleClickEvent(QMouseEvent *e) +{ + if (m_titleBar->geometry().contains(e->pos())) + { + titlebarDblClickOperation(); + } +} + +MalloryClient::Position MalloryClient::mousePosition(const QPoint &point) const +{ + const int corner = 24; + MalloryClient::Position pos = PositionCenter; + + // Often needed coordinates... + QRect titleRect(m_titleBar->geometry()); + QRect topRect(m_topSpacer->geometry()); + QRect leftRect(m_leftSpacer->geometry()); + QRect rightRect(m_rightSpacer->geometry()); + QRect bottomRect(m_bottomSpacer->geometry()); + + + if ((m_leftButtonSpacer2->geometry().height() > 0) ? (point.y() <= (m_leftButtonSpacer2->geometry().bottom())) : (point.y() <= topRect.bottom())) + { + // We're inside the top frame. + if (point.x() <= corner) + pos = PositionTopLeft; + else if (point.x() >= (width()-corner)) + pos = PositionTopRight; + else + pos = PositionTop; + } + else if (topRect.height() <= 0 && point.y() <= 2) + { + // We're inside the top frame, probably maximized. + if ((point.x() >= titleRect.left()) && (point.x() <= titleRect.left()+corner)) + pos = PositionLeft; + else if ((point.x() >= titleRect.right()-corner) && (point.x() <= titleRect.right())) + pos = PositionTopRight; + else if ((point.x() > titleRect.left()) && (point.x() < titleRect.right())) + pos = PositionTop; + } + else if (point.y() >= bottomRect.top()) + { + // Inside handle + if (point.x() <= corner) + pos = PositionBottomLeft; + else if (point.x() >= (width()-corner)) + pos = PositionBottomRight; + else + pos = PositionBottom; + } + else if (point.x() <= leftRect.right()) + { + // Inside the left frame. + if (point.y() <= corner) + pos = PositionTopLeft; + else if (point.y() >= (height()-corner)) + pos = PositionBottomLeft; + else + pos = PositionLeft; + } + else if (point.x() >= rightRect.left()) + { + // Inside the right frame. + if (point.y() <= corner) + pos = PositionTopRight; + else if (point.y() >= (height()-corner)) + pos = PositionBottomRight; + else + pos = PositionRight; + } + else + { + // Inside the frame somewhere... + pos = PositionCenter; + } + + return pos; +} + +void MalloryClient::iconChange() +{ + if (m_button[ButtonMenu]) + { + m_button[ButtonMenu]->repaint(false); + } +} + +void MalloryClient::activeChange() +{ + // Repaint the buttons when state changes + for (int n=0; n<ButtonTypeCount; n++) + if (m_button[n]) m_button[n]->repaint(false); + widget()->repaint(false); +} + +void MalloryClient::maximizeChange() +{ + const bool m = (maximizeMode() != MaximizeRestore); + if (m_button[ButtonMax]) + { + m_button[ButtonMax]->setMaximized(m); + m_button[ButtonMax]->setTipText(m ? i18n("Restore") : i18n("Maximize")); + } +} + +void MalloryClient::desktopChange() +{ + if (m_button[ButtonOnAllDesktops]) + { + m_button[ButtonOnAllDesktops]->setOnAllDesktops(isOnAllDesktops()); + m_button[ButtonOnAllDesktops]->setTipText(isOnAllDesktops() ? i18n("Not On All Desktops") : i18n("On All Desktops")); + } +} + +void MalloryClient::maxButtonPressed() +{ + if (m_button[ButtonMax]) + { + switch (m_button[ButtonMax]->lastMousePress()) + { + case MidButton: + maximize(maximizeMode() ^ MaximizeVertical); + break; + case RightButton: + maximize(maximizeMode() ^ MaximizeHorizontal); + break; + default: + maximize(maximizeMode() == MaximizeFull ? MaximizeRestore : MaximizeFull); + } + } +} + +void MalloryClient::menuButtonPressed() +{ + if (m_button[ButtonMenu]) + { + QPoint pt(m_button[ButtonMenu]->rect().bottomLeft().x(), m_button[ButtonMenu]->rect().bottomLeft().y()); + showWindowMenu(m_button[ButtonMenu]->mapToGlobal(pt)); + m_button[ButtonMenu]->setDown(false); + } +} + +QSize MalloryClient::minimumSize() const +{ + return QSize(112, 40); +} + +void MalloryClient::borders(int& left, int& right, int& top, int& bottom) const +{ + m_leftSpacer->changeSize(MalloryHandler::borderSize(), 1, QSizePolicy::Expanding, QSizePolicy::Minimum ); + m_rightSpacer->changeSize(MalloryHandler::borderSize(), 1, QSizePolicy::Expanding, QSizePolicy::Minimum ); + m_topSpacer->changeSize(1, 1); + m_bottomSpacer->changeSize(1, MalloryHandler::borderSize()); + m_leftButtonSpacer->changeSize( 3, 1); + m_rightButtonSpacer->changeSize( 3, 1); + m_titleBar->changeSize(1, MalloryHandler::titleSize(), QSizePolicy::Expanding, QSizePolicy::Fixed); + m_leftButtonSpacer2->changeSize(1, (MalloryHandler::titleSize()-MalloryHandler::buttonSize())/2, QSizePolicy::Minimum, QSizePolicy::Fixed); + m_rightButtonSpacer2->changeSize(1, (MalloryHandler::titleSize()-MalloryHandler::buttonSize())/2, QSizePolicy::Minimum, QSizePolicy::Fixed); + + left = right = bottom = MalloryHandler::borderSize(); + top = 1 + MalloryHandler::titleSize(); + + // activate updated layout + widget()->layout()->activate(); +} + +void MalloryClient::reset(unsigned long) // unsigned long changed +{ + // TODO: Implementation +} + +void MalloryClient::resize(const QSize& s) +{ + widget()->resize(s); +} + + +//////////////// Plugin Stuff + +extern "C" +{ + KDecorationFactory *create_factory() + { + return new MalloryHandler(); + } +} + +#include "malloryclient.moc" |