Added the overloaded function
bool hasElementPrefix(Plasma::Location location) const; svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=803268
This commit is contained in:
parent
b4ee14d44f
commit
9c588df3bb
35
panelsvg.cpp
35
panelsvg.cpp
@ -154,13 +154,6 @@ void PanelSvg::setElementPrefix(Plasma::Location location)
|
||||
d->location = location;
|
||||
}
|
||||
|
||||
bool PanelSvg::hasElementPrefix(const QString & prefix) const
|
||||
{
|
||||
//for now it simply checks if a center element exists,
|
||||
//because it could make sense for certain themes to not have all the elements
|
||||
return hasElement(prefix + "-center");
|
||||
}
|
||||
|
||||
void PanelSvg::setElementPrefix(const QString & prefix)
|
||||
{
|
||||
const QString oldPrefix(d->prefix);
|
||||
@ -191,6 +184,34 @@ void PanelSvg::setElementPrefix(const QString & prefix)
|
||||
d->location = Floating;
|
||||
}
|
||||
|
||||
bool PanelSvg::hasElementPrefix(const QString & prefix) const
|
||||
{
|
||||
//for now it simply checks if a center element exists,
|
||||
//because it could make sense for certain themes to not have all the elements
|
||||
return hasElement(prefix + "-center");
|
||||
}
|
||||
|
||||
bool PanelSvg::hasElementPrefix(Plasma::Location location) const
|
||||
{
|
||||
switch (location) {
|
||||
case TopEdge:
|
||||
return hasElementPrefix("north");
|
||||
break;
|
||||
case BottomEdge:
|
||||
return hasElementPrefix("south");
|
||||
break;
|
||||
case LeftEdge:
|
||||
return hasElementPrefix("west");
|
||||
break;
|
||||
case RightEdge:
|
||||
return hasElementPrefix("east");
|
||||
break;
|
||||
default:
|
||||
return hasElementPrefix(QString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QString PanelSvg::prefix()
|
||||
{
|
||||
if (d->prefix.isEmpty()) {
|
||||
|
10
panelsvg.h
10
panelsvg.h
@ -140,6 +140,16 @@ class PLASMA_EXPORT PanelSvg : public Svg
|
||||
*/
|
||||
bool hasElementPrefix(const QString & prefix) const;
|
||||
|
||||
/**
|
||||
* This is an overloaded method provided for convenience equivalent to
|
||||
* hasElementPrefix("north"), hasElementPrefix("south")
|
||||
* hasElementPrefix("west") and hasElementPrefix("east")
|
||||
* @return true if the svg has the necessary elements with the given prefix
|
||||
* to draw a panel.
|
||||
* @arg location the given prefix we want to check if drawable
|
||||
*/
|
||||
bool hasElementPrefix(Plasma::Location location) const;
|
||||
|
||||
/**
|
||||
* Returns the prefix for SVG elements of the PanelSvg
|
||||
* @return the prefix
|
||||
|
Loading…
Reference in New Issue
Block a user