diff --git a/widgets/layout.cpp b/widgets/layout.cpp index dc2bd63f3..32a0713bd 100644 --- a/widgets/layout.cpp +++ b/widgets/layout.cpp @@ -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; diff --git a/widgets/layout.h b/widgets/layout.h index 6d6f120cf..9350e0e34 100644 --- a/widgets/layout.h +++ b/widgets/layout.h @@ -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;