Add methods to set/get a layout's animator. The various layout implementations need small changes to make use of an animator if set. Add an update() method to Layout to trigger re-layouting.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=701059
This commit is contained in:
Robert Knight 2007-08-17 07:02:24 +00:00
parent 341c3700eb
commit 62b2605d0d
2 changed files with 36 additions and 1 deletions

View File

@ -29,7 +29,8 @@ class Layout::Private
Private(LayoutItem* parent)
: margin(12.0),
spacing(6.0),
parent(parent)
parent(parent),
animator(0)
{
}
@ -39,6 +40,7 @@ class Layout::Private
qreal spacing;
LayoutItem *parent;
LayoutAnimator *animator;
};
@ -56,6 +58,22 @@ Layout::~Layout()
delete d;
}
void Layout::update()
{
// this will force an update
setGeometry( parent()->geometry() );
}
LayoutAnimator* Layout::animator() const
{
return d->animator;
}
void Layout::setAnimator(LayoutAnimator* animator)
{
d->animator = animator;
}
qreal Layout::margin() const
{
return d->margin;

View File

@ -28,6 +28,8 @@
namespace Plasma
{
class LayoutAnimator;
/**
* Base class for Plasma Layout managers
*
@ -116,6 +118,21 @@ class PLASMA_EXPORT Layout : public LayoutItem
*/
virtual LayoutItem *takeAt(int i) = 0;
/**
* Returns the object controlling animation of changes
* in this layout or 0 if no animator has been set.
*/
virtual LayoutAnimator* animator() const;
/**
* Sets the object controlling animation of changes in this
* layout.
*/
virtual void setAnimator( LayoutAnimator* animator );
/** Triggers an update of the layout. */
void update();
private:
class Private;
Private *const d;