Added overlay support. To use it add to your theme overlay.svg.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=796088
This commit is contained in:
parent
382caec1f7
commit
8e45bf56db
21
applet.cpp
21
applet.cpp
@ -103,6 +103,7 @@ public:
|
|||||||
package(0),
|
package(0),
|
||||||
needsConfigOverlay(0),
|
needsConfigOverlay(0),
|
||||||
background(0),
|
background(0),
|
||||||
|
overlay(0),
|
||||||
failureText(0),
|
failureText(0),
|
||||||
script(0),
|
script(0),
|
||||||
configXml(0),
|
configXml(0),
|
||||||
@ -132,6 +133,7 @@ public:
|
|||||||
DataEngineManager::self()->unload( engine );
|
DataEngineManager::self()->unload( engine );
|
||||||
}
|
}
|
||||||
delete background;
|
delete background;
|
||||||
|
delete overlay;
|
||||||
delete package;
|
delete package;
|
||||||
delete configXml;
|
delete configXml;
|
||||||
delete shadow;
|
delete shadow;
|
||||||
@ -318,6 +320,7 @@ public:
|
|||||||
QList<QGraphicsItem*> watchedForMouseMove;
|
QList<QGraphicsItem*> watchedForMouseMove;
|
||||||
QStringList loadedEngines;
|
QStringList loadedEngines;
|
||||||
Plasma::SvgPanel *background;
|
Plasma::SvgPanel *background;
|
||||||
|
Plasma::SvgPanel *overlay;
|
||||||
Plasma::LineEdit *failureText;
|
Plasma::LineEdit *failureText;
|
||||||
AppletScript *script;
|
AppletScript *script;
|
||||||
ConfigXml* configXml;
|
ConfigXml* configXml;
|
||||||
@ -641,6 +644,10 @@ void Applet::setDrawStandardBackground(bool drawBackground)
|
|||||||
if (!d->background) {
|
if (!d->background) {
|
||||||
d->background = new Plasma::SvgPanel("widgets/background");
|
d->background = new Plasma::SvgPanel("widgets/background");
|
||||||
|
|
||||||
|
if (!Plasma::Theme::self()->image("widgets/overlay").isEmpty()) {
|
||||||
|
d->overlay = new Plasma::SvgPanel("widgets/overlay");
|
||||||
|
}
|
||||||
|
|
||||||
int left, top, right, bottom;
|
int left, top, right, bottom;
|
||||||
d->getBorderSize(left, top, right, bottom);
|
d->getBorderSize(left, top, right, bottom);
|
||||||
setMargins(0, 0, right, bottom);
|
setMargins(0, 0, right, bottom);
|
||||||
@ -649,7 +656,9 @@ void Applet::setDrawStandardBackground(bool drawBackground)
|
|||||||
}
|
}
|
||||||
} else if (d->background) {
|
} else if (d->background) {
|
||||||
delete d->background;
|
delete d->background;
|
||||||
|
delete d->overlay;
|
||||||
d->background = 0;
|
d->background = 0;
|
||||||
|
d->overlay = 0;
|
||||||
setMargins(0, 0, 0, 0);
|
setMargins(0, 0, 0, 0);
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
update();
|
update();
|
||||||
@ -977,6 +986,13 @@ void Applet::paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
paintInterface(painter, option, QRect(QPoint(0,0), d->contentSize(this).toSize()));
|
paintInterface(painter, option, QRect(QPoint(0,0), d->contentSize(this).toSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d->overlay &&
|
||||||
|
formFactor() != Plasma::Vertical &&
|
||||||
|
formFactor() != Plasma::Horizontal) {
|
||||||
|
//kDebug() << "option rect is" << option->rect;
|
||||||
|
d->overlay->paint(painter, option->rect);
|
||||||
|
}
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1578,6 +1594,11 @@ void Applet::setGeometry(const QRectF& geometry)
|
|||||||
d->background->resize(size());
|
d->background->resize(size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d->overlay) {
|
||||||
|
//kDebug() << "setting overlay to" << size();
|
||||||
|
d->overlay->resize(size());
|
||||||
|
}
|
||||||
|
|
||||||
updateConstraints(Plasma::SizeConstraint);
|
updateConstraints(Plasma::SizeConstraint);
|
||||||
emit geometryChanged();
|
emit geometryChanged();
|
||||||
} else if (p != pos()) {
|
} else if (p != pos()) {
|
||||||
|
3
theme.h
3
theme.h
@ -93,7 +93,8 @@ class PLASMA_EXPORT Theme : public QObject
|
|||||||
*
|
*
|
||||||
* @arg name the name of the file in the theme directory (without the
|
* @arg name the name of the file in the theme directory (without the
|
||||||
* ".svg" part or a leading slash)
|
* ".svg" part or a leading slash)
|
||||||
* @return the full path to the requested file for the current theme
|
* @return the full path to the requested file for the current theme,
|
||||||
|
* or an empty string if the image is not available
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE QString image( const QString& name ) const;
|
Q_INVOKABLE QString image( const QString& name ) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user