1#ifndef __SANIMATION__H__
2#define __SANIMATION__H__
4#include <interface/SAnimation-i.h>
5#include <helper/obj-ref-impl.hpp>
6#include <animation/SInterpolatorImpl.h>
7#include <animation/STransformation.h>
8#include <sobject/Sobject.hpp>
10#define ATTR_VALUE_DESC(attribname, desc) \
11 if (0 == strAttribName.CompareNoCase(attribname)) \
13 desc = SNS::SValueDescription::parseValue(strValue); \
182 STDMETHOD_(IAnimation *,
clone)(THIS) SCONST OVERRIDE;
188 STDMETHOD_(
void,
copy)(THIS_
const IAnimation *src) OVERRIDE;
193 STDMETHOD_(
void,
reset)(THIS) OVERRIDE;
198 STDMETHOD_(
void,
cancel)(THIS) OVERRIDE;
210 STDMETHOD_(
void,
setDuration)(THIS_
long durationMillis) OVERRIDE;
228 STDMETHOD_(
void,
setFillAfter)(THIS_ BOOL bFill) OVERRIDE;
258 STDMETHOD_(
void,
setFillEnabled)(THIS_ BOOL fillEnabled) OVERRIDE;
264 STDMETHOD_(
void,
setStartTime)(THIS_ int64_t startTimeMillis) OVERRIDE;
269 STDMETHOD_(
void,
start)(THIS) OVERRIDE;
274 STDMETHOD_(
void,
startNow)(THIS) OVERRIDE;
280 STDMETHOD_(
void,
setRepeatMode)(THIS_ RepeatMode repeatMode) OVERRIDE;
292 STDMETHOD_(
void,
setZAdjustment)(THIS_ ZAdjustment zAdjustment) OVERRIDE;
304 STDMETHOD_(int64_t,
getStartTime)(THIS) SCONST OVERRIDE;
310 STDMETHOD_(
long,
getDuration)(THIS) SCONST OVERRIDE;
356 (THIS_ uint64_t currentTime, ITransformation *outTransformation,
float scale) OVERRIDE;
365 (THIS_ uint64_t currentTime, ITransformation *outTransformation) OVERRIDE;
371 STDMETHOD_(BOOL,
hasStarted)(THIS) SCONST OVERRIDE;
377 STDMETHOD_(BOOL,
hasEnded)(THIS) SCONST OVERRIDE;
385 (THIS_
float interpolatedTime, ITransformation *t) OVERRIDE;
391 STDMETHOD_(BOOL,
hasAlpha)(THIS) SCONST OVERRIDE;
402 (THIS_
int width,
int height,
int parentWidth,
int parentHeight,
int nScale) OVERRIDE;
408 STDMETHOD_(
void,
setUserData)(THIS_ ULONG_PTR data) OVERRIDE;
414 STDMETHOD_(ULONG_PTR,
getUserData)(THIS) SCONST OVERRIDE;
419 STDMETHOD_(
void,
pause)(THIS) OVERRIDE;
424 STDMETHOD_(
void,
resume)(THIS) OVERRIDE;
482 ATTR_ENUM_BEGIN(L
"zAdjustment", ZAdjustment, FALSE)
483 ATTR_ENUM_VALUE(L
"normal", ZORDER_NORMAL)
484 ATTR_ENUM_VALUE(L
"top", ZORDER_TOP)
485 ATTR_ENUM_VALUE(L
"bottom", ZORDER_BOTTOM)
487 ATTR_ENUM_BEGIN(L
"repeatMode", RepeatMode, FALSE)
488 ATTR_ENUM_VALUE(L
"restart", RESTART)
489 ATTR_ENUM_VALUE(L
"reverse", REVERSE)
BOOL getTransformation(uint64_t currentTime, ITransformation *outTransformation) OVERRIDE
Gets the transformation at a specific time.
int resolveSize(const SValueDescription &value, int size, int parentSize, int nScale)
Converts the information in the description of a size to an actual dimension.
bool mStarted
Set by getTransformation(long, STransformation) when the animation starts.
int64_t getStartTime() SCONST OVERRIDE
Gets the start time of the animation.
BOOL mFillEnabled
Indicates whether fillBefore should be taken into account.
int mRepeated
Indicates how many times the animation was repeated.
BOOL mFillAfter
Indicates whether the animation transformation should be applied after the animation ends.
void pause() OVERRIDE
Pauses the animation.
void scaleCurrentDuration(float scale) OVERRIDE
Scales the current duration of the animation.
void setFillBefore(BOOL bFill) OVERRIDE
Sets whether the animation transformation should be applied before the animation starts.
BOOL getFillAfter() SCONST OVERRIDE
Gets whether the animation transformation should be applied after the animation ends.
void reset() OVERRIDE
Resets the animation to its initial state.
void ensureInterpolator()
Ensures that this animation has an interpolator. Will use an AccelerateDecelerateInterpolator if noth...
float mScaleFactor
Scale factor to apply to pivot points, etc. during animation. Subclasses retrieve the value via getSc...
void initialize(int width, int height, int parentWidth, int parentHeight, int nScale) OVERRIDE
Initializes the animation with the dimensions of the object and its parent.
void copy(const IAnimation *src) OVERRIDE
Copies the properties of another animation to this animation.
BOOL hasStarted() SCONST OVERRIDE
Checks whether the animation has started.
void cancel() OVERRIDE
Cancels the animation.
bool mPaused
Indicates whether the animation is paused.
void setUserData(ULONG_PTR data) OVERRIDE
Sets user data associated with the animation.
uint64_t mPauseTime
The time at which the animation was paused.
void fireAnimationStart()
Notifies the animation listener that the animation has started.
void setFillAfter(BOOL bFill) OVERRIDE
Sets whether the animation transformation should be applied after the animation ends.
IAnimation * clone() SCONST OVERRIDE
Creates a new animation with a duration of 0ms, the default interpolator, with fillBefore set to true...
void applyTransformation(float interpolatedTime, ITransformation *t) OVERRIDE
Applies the transformation at a specific interpolated time.
ULONG_PTR getUserData() SCONST OVERRIDE
Gets user data associated with the animation.
IAnimationListener * mListener
The animation listener to be notified when the animation starts, ends, or repeats.
ZAdjustment mZAdjustment
Desired Z order mode during animation.
BOOL hasAlpha() SCONST OVERRIDE
Checks whether the animation affects the alpha property.
BOOL isFillEnabled() SCONST OVERRIDE
Checks whether fillBefore should be taken into account.
BOOL mFillBefore
Indicates whether the animation transformation should be applied before the animation starts....
long getStartOffset() SCONST OVERRIDE
Gets the delay in milliseconds after which the animation must start.
SAnimation()
Default constructor for SAnimation.
long computeDurationHint() SCONST OVERRIDE
Computes the duration hint for the animation.
void setStartOffset(long offset) OVERRIDE
Sets the delay in milliseconds after which the animation must start.
BOOL getTransformation2(uint64_t currentTime, ITransformation *outTransformation, float scale) OVERRIDE
Gets the transformation at a specific time.
void setAnimationListener(IAnimationListener *listener) OVERRIDE
Sets the animation listener to be notified when the animation starts, ends, or repeats.
void startNow() OVERRIDE
Starts the animation immediately.
ZAdjustment getZAdjustment() SCONST OVERRIDE
Gets the desired Z order mode during animation.
long mDuration
The duration of one animation cycle in milliseconds.
int getRepeatCount() SCONST OVERRIDE
Gets the number of times the animation must repeat.
BOOL hasEnded() SCONST OVERRIDE
Checks whether the animation has ended.
void setDuration(long durationMillis) OVERRIDE
Sets the duration of one animation cycle in milliseconds.
void setStartTime(int64_t startTimeMillis) OVERRIDE
Sets the start time of the animation.
float getScaleFactor()
Gets the scale factor that should be applied to pre-scaled values in an Animation....
void setInterpolator(IInterpolator *i) OVERRIDE
Sets the interpolator used by the animation to smooth the movement.
void start() OVERRIDE
Starts the animation.
void setFillEnabled(BOOL fillEnabled) OVERRIDE
Sets whether fillBefore should be taken into account.
void setZAdjustment(ZAdjustment zAdjustment) OVERRIDE
Sets the desired Z order mode during animation.
void fireAnimationEnd()
Notifies the animation listener that the animation has ended.
int mRepeatCount
The number of times the animation must repeat. By default, an animation repeats indefinitely.
ULONG_PTR mUserData
User data associated with the animation.
bool mCycleFlip
Set by getTransformation(long, STransformation) when the animation repeats in REVERSE mode.
SAutoRefPtr< IInterpolator > mInterpolator
The interpolator used by the animation to smooth the movement.
void resume() OVERRIDE
Resumes the animation.
void setRepeatCount(int repeatCount) OVERRIDE
Sets the number of times the animation must repeat.
void setRepeatMode(RepeatMode repeatMode) OVERRIDE
Sets the repeat mode of the animation.
void fireAnimationRepeat()
Notifies the animation listener that the animation has repeated.
bool mEnded
Set by getTransformation(long, STransformation) when the animation ends.
IInterpolator * getInterpolator() SCONST OVERRIDE
Gets the interpolator used by the animation.
uint64_t mStartTime
The time in milliseconds at which the animation must start.
RepeatMode mRepeatMode
The behavior of the animation when it repeats. The repeat mode is either RESTART or REVERSE.
BOOL getFillBefore() SCONST OVERRIDE
Gets whether the animation transformation should be applied before the animation starts.
RepeatMode getRepeatMode() SCONST OVERRIDE
Gets the repeat mode of the animation.
long mStartOffset
The delay in milliseconds after which the animation must start. When the start offset is > 0,...
long getDuration() SCONST OVERRIDE
Gets the duration of one animation cycle.
bool isCanceled()
Checks whether the animation is canceled.
Smart pointer class for managing COM-style reference-counted objects.
A class representing an ASCII string.
Utility class to parse a string description of a size.
static SValueDescription parseValue(const SStringW &value)
Parses a string description of a size. Size descriptions can appear in three forms:
SLayoutSize value
The absolute or relative dimension for this Description.
AniValueType type
One of Animation.ABSOLUTE_VALUE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
SValueDescription(AniValueType _type=ABSOLUTE_VALUE, float _value=0.0f)
Constructor for SValueDescription.