* introduce a type() to containments so we can tell the difference between panels, desktops, etc more reliably

* translate panels to negative coordinates. this will allowus to make hiding panels that actually ... work =)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=723423
This commit is contained in:
Aaron J. Seigo 2007-10-09 16:33:52 +00:00
parent 3e90dfe02b
commit e642050a1c
2 changed files with 25 additions and 3 deletions

View File

@ -55,7 +55,7 @@ public:
layout(0),
background(0),
bitmapBackground(0),
screen(-1),
screen(0),
immutable(false)
{
}
@ -112,13 +112,21 @@ void Containment::init()
//kDebug() << "SVG wallpaper!";
d->background = new Plasma::Svg("widgets/wallpaper", this);
}
setAcceptDrops(true);
if (type() == PanelContainment) {
kDebug() << "we are a panel, let's move ourselves to a negative coordinate system";
QDesktopWidget desktop;
QRect r = desktop.screenGeometry(screen());
translate(0, -r.height());
}
}
void Containment::initConstraints(KConfigGroup* group)
{
//kDebug() << "initConstraints" << group->group();
setScreen(group->readEntry("screen", -1));
kDebug() << "initConstraints" << group->name() << type();
setScreen(group->readEntry("screen", 0));
setFormFactor((Plasma::FormFactor)group->readEntry("formfactor", (int)Plasma::Planar));
setLocation((Plasma::Location)group->readEntry("location", (int)Plasma::Desktop));
}
@ -130,6 +138,11 @@ void Containment::saveConstraints(KConfigGroup* group) const
group->writeEntry("location", (int)d->location);
}
Containment::Type Containment::type()
{
return DesktopContainment;
}
void Containment::paintInterface(QPainter *painter,
const QStyleOptionGraphicsItem *option,
const QRect& contentsRect)

View File

@ -61,6 +61,10 @@ class PLASMA_EXPORT Containment : public Applet
typedef QList<Applet*> List;
typedef QHash<QString, Applet*> Dict;
enum Type { DesktopContainment = 0 /**< A desktop containment */,
PanelContainment /**< A desktop panel */
};
/**
* @arg parent the QGraphicsItem this applet is parented to
* @arg servideId the name of the .desktop file containing the
@ -91,6 +95,11 @@ class PLASMA_EXPORT Containment : public Applet
*/
void init();
/**
* Returns the type of containment
*/
virtual Type type();
/**
* Paints a default background image. Nothing fancy, but that's what plugins
* are for. Reimplemented from Applet;