Added stretched paint mode for background painting

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=709407
This commit is contained in:
Ivan Čukić 2007-09-07 13:05:28 +00:00
parent f2cf7e782a
commit 45f7769d44

View File

@ -210,6 +210,13 @@ public:
background->paint(&p, QRect(leftOffset, bottomOffset, leftWidth, bottomHeight), "bottomleft"); background->paint(&p, QRect(leftOffset, bottomOffset, leftWidth, bottomHeight), "bottomleft");
background->paint(&p, QRect(rightOffset, bottomOffset, rightWidth, bottomHeight), "bottomright"); background->paint(&p, QRect(rightOffset, bottomOffset, rightWidth, bottomHeight), "bottomright");
if (stretchBackgroundBorders) {
background->paint(&p, QRect(leftOffset, contentTop, leftWidth, contentHeight), "left");
background->paint(&p, QRect(rightOffset, contentTop, rightWidth, contentHeight), "right");
background->paint(&p, QRect(contentLeft, topOffset, contentWidth, topHeight), "top");
background->paint(&p, QRect(contentLeft, bottomOffset, contentWidth, bottomHeight), "bottom");
} else {
QPixmap left(leftWidth, leftHeight); QPixmap left(leftWidth, leftHeight);
left.fill(Qt::transparent); left.fill(Qt::transparent);
{ {
@ -245,6 +252,7 @@ public:
background->paint(&sidePainter, QPoint(0, 0), "bottom"); background->paint(&sidePainter, QPoint(0, 0), "bottom");
} }
p.drawTiledPixmap(QRect(contentLeft, bottomOffset, contentWidth, bottomHeight), bottom); p.drawTiledPixmap(QRect(contentLeft, bottomOffset, contentWidth, bottomHeight), bottom);
}
background->paint(&p, QRect(contentLeft, contentTop, contentWidth + 1, contentHeight + 1), "center"); background->paint(&p, QRect(contentLeft, contentTop, contentWidth + 1, contentHeight + 1), "center");
p.end(); p.end();
@ -319,6 +327,7 @@ public:
QStringList loadedEngines; QStringList loadedEngines;
static uint s_maxAppletId; static uint s_maxAppletId;
Plasma::Svg *background; Plasma::Svg *background;
bool stretchBackgroundBorders;
Plasma::LineEdit *failureText; Plasma::LineEdit *failureText;
ScriptEngine* scriptEngine; ScriptEngine* scriptEngine;
ConfigXml* configXml; ConfigXml* configXml;
@ -526,6 +535,7 @@ void Applet::setDrawStandardBackground(bool drawBackground)
if (!d->background) { if (!d->background) {
prepareGeometryChange(); prepareGeometryChange();
d->background = new Plasma::Svg("widgets/background"); d->background = new Plasma::Svg("widgets/background");
d->stretchBackgroundBorders = d->background->elementExists("hint-stretch-borders");
} }
} else if (d->background) { } else if (d->background) {
prepareGeometryChange(); prepareGeometryChange();