* added new function panelSize() that returns the size of the panel (and

not of the svg)
* some valid pointers checks

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=803637
This commit is contained in:
Marco Martin 2008-05-03 16:03:44 +00:00
parent b675b000cb
commit c3925a3496
2 changed files with 21 additions and 2 deletions

View File

@ -129,7 +129,11 @@ void PanelSvg::setEnabledBorders(const EnabledBorders borders)
PanelSvg::EnabledBorders PanelSvg::enabledBorders() const
{
return d->panels[d->prefix]->enabledBorders;
if (d->panels.contains(d->prefix)) {
return d->panels[d->prefix]->enabledBorders;
} else {
return NoBorder;
}
}
void PanelSvg::setElementPrefix(Plasma::Location location)
@ -234,6 +238,15 @@ void PanelSvg::resizePanel(const QSizeF& size)
d->panels[d->prefix]->panelSize = size;
}
QSizeF PanelSvg::panelSize() const
{
if (d->panels.contains(d->prefix)) {
return d->panels[d->prefix]->panelSize;
} else {
return QSize(-1, -1);
}
}
qreal PanelSvg::marginSize(const Plasma::MarginEdge edge) const
{
if (d->panels[d->prefix]->noBorderPadding) {

View File

@ -48,7 +48,8 @@ class PLASMA_EXPORT PanelSvg : public Svg
/**
* These flags represents what borders should be drawn
*/
enum EnabledBorder { TopBorder = 1,
enum EnabledBorder { NoBorder = 0,
TopBorder = 1,
BottomBorder = 2,
LeftBorder = 4,
RightBorder = 8,
@ -93,6 +94,11 @@ class PLASMA_EXPORT PanelSvg : public Svg
*/
void resizePanel(const QSizeF& size);
/**
* @returns the size of the panel
*/
QSizeF panelSize() const;
/**
* Returns the margin size given the margin edge we want
* @arg edge the margin edge we want, top, bottom, left or right