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:
parent
341c3700eb
commit
62b2605d0d
@ -29,7 +29,8 @@ class Layout::Private
|
|||||||
Private(LayoutItem* parent)
|
Private(LayoutItem* parent)
|
||||||
: margin(12.0),
|
: margin(12.0),
|
||||||
spacing(6.0),
|
spacing(6.0),
|
||||||
parent(parent)
|
parent(parent),
|
||||||
|
animator(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ class Layout::Private
|
|||||||
qreal spacing;
|
qreal spacing;
|
||||||
|
|
||||||
LayoutItem *parent;
|
LayoutItem *parent;
|
||||||
|
LayoutAnimator *animator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +58,22 @@ Layout::~Layout()
|
|||||||
delete d;
|
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
|
qreal Layout::margin() const
|
||||||
{
|
{
|
||||||
return d->margin;
|
return d->margin;
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class LayoutAnimator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for Plasma Layout managers
|
* Base class for Plasma Layout managers
|
||||||
*
|
*
|
||||||
@ -116,6 +118,21 @@ class PLASMA_EXPORT Layout : public LayoutItem
|
|||||||
*/
|
*/
|
||||||
virtual LayoutItem *takeAt(int i) = 0;
|
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:
|
private:
|
||||||
class Private;
|
class Private;
|
||||||
Private *const d;
|
Private *const d;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user