move MarginEdge to the Plasma namespace to avoid coupling to the layout stuff in innapropriate places

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=771704
This commit is contained in:
Aaron J. Seigo 2008-02-06 19:12:21 +00:00
parent 070781d480
commit 7f3aea19ff
6 changed files with 22 additions and 17 deletions

View File

@ -214,10 +214,10 @@ public:
void getBorderSize(int& left , int& top, int &right, int& bottom)
{
if (background) {
top = background->marginSize(Plasma::Layout::TopMargin);
left = background->marginSize(Plasma::Layout::LeftMargin);
right = background->marginSize(Plasma::Layout::RightMargin);
bottom = background->marginSize(Plasma::Layout::BottomMargin);
top = background->marginSize(Plasma::TopMargin);
left = background->marginSize(Plasma::LeftMargin);
right = background->marginSize(Plasma::RightMargin);
bottom = background->marginSize(Plasma::BottomMargin);
} else {
top = left = right = bottom = 0;
}

View File

@ -152,7 +152,7 @@ void Layout::setAnimator(LayoutAnimator *animator)
d->animator = animator;
}
qreal Layout::margin(MarginEdge edge) const
qreal Layout::margin(Plasma::MarginEdge edge) const
{
switch (edge) {
case LeftMargin:
@ -172,7 +172,7 @@ qreal Layout::margin(MarginEdge edge) const
return 0;
}
void Layout::setMargin(MarginEdge edge, qreal m)
void Layout::setMargin(Plasma::MarginEdge edge, qreal m)
{
switch (edge) {
case LeftMargin:

View File

@ -26,6 +26,7 @@
#include <plasma/layouts/layoutitem.h>
#include <plasma/plasma_export.h>
#include <plasma/plasma.h>
namespace Plasma
{
@ -44,8 +45,6 @@ class LayoutAnimator;
class PLASMA_EXPORT Layout : public LayoutItem
{
public:
enum MarginEdge { TopMargin, BottomMargin, LeftMargin, RightMargin };
/**
* Constructor.
*/
@ -59,12 +58,12 @@ class PLASMA_EXPORT Layout : public LayoutItem
/**
* Returns the margin of this Layout.
*/
qreal margin(MarginEdge edge) const;
qreal margin(Plasma::MarginEdge edge) const;
/**
* Sets the margin of this Layout.
*/
void setMargin(MarginEdge edge, qreal m);
void setMargin(Plasma::MarginEdge edge, qreal m);
/**
* Sets all the margins of this Layout.

View File

@ -147,6 +147,12 @@ enum ComponentType { AppletComponent = 1 /**< Plasma::Applet based plugins **/,
};
Q_DECLARE_FLAGS(ComponentTypes, ComponentType)
enum MarginEdge { TopMargin = 0,
BottomMargin,
LeftMargin,
RightMargin
};
/**
* @return the scaling factor (0..1) for a ZoomLevel
**/

View File

@ -121,26 +121,26 @@ void SvgPanel::resize(const QSizeF& size)
updateSizes();
}
qreal SvgPanel::marginSize(const Plasma::Layout::MarginEdge edge) const
qreal SvgPanel::marginSize(const Plasma::MarginEdge edge) const
{
if (d->noBorderPadding) {
return .0;
}
switch (edge) {
case Plasma::Layout::TopMargin:
case Plasma::TopMargin:
return d->topHeight;
break;
case Plasma::Layout::LeftMargin:
case Plasma::LeftMargin:
return d->leftWidth;
break;
case Plasma::Layout::RightMargin:
case Plasma::RightMargin:
return d->rightWidth;
break;
//Plasma::Layout::BottomMargin
//Plasma::BottomMargin
default:
return d->bottomHeight;
break;

View File

@ -26,8 +26,8 @@
#include <plasma/plasma_export.h>
#include <plasma/plasma.h>
#include <plasma/svg.h>
#include <plasma/layouts/layout.h>
class QPainter;
class QPoint;
@ -106,7 +106,7 @@ class PLASMA_EXPORT SvgPanel : public QObject
* @arg edge the margin edge we want, top, bottom, left or right
* @return the margin size
*/
qreal marginSize(const Plasma::Layout::MarginEdge edge) const;
qreal marginSize(const Plasma::MarginEdge edge) const;
/**
* Paints the loaded SVG with the elements that represents the border