1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * animation.h: Animation engine
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
14 #ifndef MOON_ANIMATION_H
15 #define MOON_ANIMATION_H
20 #include "collection.h"
25 #include "propertypath.h"
26 #include "moon-curves.h"
31 /* @Namespace=System.Windows.Media.Animation */
32 class KeySpline
: public DependencyObject
{
34 /* @GenerateCBinding,GeneratePInvoke */
37 KeySpline (Point controlPoint1
, Point controlPoint2
);
38 KeySpline (double x1
, double y1
, double x2
, double y2
);
40 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
42 void RegenerateQuadratics ();
44 double GetSplineProgress (double linearProgress
);
45 /* @PropertyType=Point,ManagedPropertyType=Point,DefaultValue=Point (0\,0),ManagedFieldAccess=Internal,GenerateAccessors */
46 const static int ControlPoint1Property
;
47 /* @PropertyType=Point,ManagedPropertyType=Point,DefaultValue=Point (1.0\, 1.0),ManagedFieldAccess=Internal,GenerateAccessors */
48 const static int ControlPoint2Property
;
50 Point
*GetControlPoint1 ();
51 void SetControlPoint1 (Point
*controlPoint1
);
53 Point
*GetControlPoint2 ();
54 void SetControlPoint2 (Point
*controlPoint2
);
57 virtual ~KeySpline ();
61 moon_quadratic
*quadraticsArray
;
64 /* @Namespace=System.Windows.Media.Animation */
74 KeyTime (const KeyTime
&keytime
)
77 percent
= keytime
.percent
;
78 timespan
= keytime
.timespan
;
81 KeyTime (double percent
)
86 KeyTime (TimeSpan timeSpan
)
88 timespan (timeSpan
) { }
91 KeyTime (KeyTimeType kind
) : k(kind
) { }
93 static KeyTime
FromPercent (double percent
) { return KeyTime (percent
); }
94 static KeyTime
FromTimeSpan (TimeSpan timeSpan
) { return KeyTime (timeSpan
); }
97 static KeyTime Uniform
;
99 bool operator!= (const KeyTime
&v
) const
101 return !(*this == v
);
104 bool operator== (const KeyTime
&v
) const
110 case PERCENT
: return percent
== v
.percent
;
111 case TIMESPAN
: return timespan
== v
.timespan
;
112 default: return true;
116 bool HasPercent () { return k
== PERCENT
; }
117 double GetPercent () { return percent
; }
119 bool HasTimeSpan () { return k
== TIMESPAN
; }
120 TimeSpan
GetTimeSpan () { return timespan
; }
131 // Animations (more specialized clocks and timelines) and their subclasses
133 class AnimationClock
;
136 /* @Namespace=None */
137 class Animation
: public Timeline
{
142 virtual Clock
*AllocateClock ();
144 virtual Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
,
145 AnimationClock
* animationClock
);
146 virtual Value
*GetTargetValue (Value
*defaultOriginValue
);
148 virtual Duration
GetNaturalDurationCore (Clock
* clock
);
151 virtual bool Resolve (DependencyObject
*target
, DependencyProperty
*property
) { return true; };
153 /* The kind of values this animation generates */
154 virtual Type::Kind
GetValueKind () { return Type::INVALID
; };
157 virtual ~Animation () {}
160 /* @Namespace=System.Windows.Media.Animation */
161 class DoubleAnimation
: public Animation
{
163 /* @PropertyType=double,Nullable,GenerateAccessors */
164 const static int ByProperty
;
165 /* @PropertyType=double,Nullable,GenerateAccessors */
166 const static int FromProperty
;
167 /* @PropertyType=double,Nullable,GenerateAccessors */
168 const static int ToProperty
;
169 /* @PropertyType=EasingFunctionBase,ManagedPropertyType=IEasingFunction,GenerateAccessors */
170 const static int EasingFunctionProperty
;
172 /* @GenerateCBinding,GeneratePInvoke */
175 virtual Type::Kind
GetValueKind () { return Type::DOUBLE
; };
177 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
179 virtual Value
*GetTargetValue (Value
*defaultOriginValue
);
180 virtual Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
,
181 AnimationClock
*animationClock
);
184 // Property Accessors
187 void SetBy (double *pv
);
188 void SetBy (double v
);
191 void SetFrom (double *pv
);
192 void SetFrom (double v
);
195 void SetTo (double *pv
);
196 void SetTo (double v
);
198 EasingFunctionBase
* GetEasingFunction ();
199 void SetEasingFunction (EasingFunctionBase
* value
);
202 virtual ~DoubleAnimation () {}
205 double *doubleToCached
;
206 double *doubleFromCached
;
207 double *doubleByCached
;
210 void EnsureCache (void);
215 /* @Namespace=System.Windows.Media.Animation */
216 class ColorAnimation
: public Animation
{
218 /* @PropertyType=Color,Nullable,GenerateAccessors */
219 const static int ByProperty
;
220 /* @PropertyType=Color,Nullable,GenerateAccessors */
221 const static int FromProperty
;
222 /* @PropertyType=Color,Nullable,GenerateAccessors */
223 const static int ToProperty
;
224 /* @PropertyType=EasingFunctionBase,ManagedPropertyType=IEasingFunction,GenerateAccessors */
225 const static int EasingFunctionProperty
;
227 /* @GenerateCBinding,GeneratePInvoke */
230 virtual Type::Kind
GetValueKind () { return Type::COLOR
; };
232 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
234 virtual Value
*GetTargetValue (Value
*defaultOriginValue
);
235 virtual Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
,
236 AnimationClock
*animationClock
);
239 // Property Accessors
242 void SetBy (Color
*pv
);
243 void SetBy (Color v
);
246 void SetFrom (Color
*pv
);
247 void SetFrom (Color v
);
250 void SetTo (Color
*pv
);
251 void SetTo (Color v
);
253 EasingFunctionBase
* GetEasingFunction ();
254 void SetEasingFunction (EasingFunctionBase
* value
);
257 virtual ~ColorAnimation () {}
260 Color
*colorToCached
;
261 Color
*colorFromCached
;
262 Color
*colorByCached
;
265 void EnsureCache (void);
269 /* @Namespace=System.Windows.Media.Animation */
270 class PointAnimation
: public Animation
{
272 /* @PropertyType=Point,Nullable,GenerateAccessors */
273 const static int ByProperty
;
274 /* @PropertyType=Point,Nullable,GenerateAccessors */
275 const static int FromProperty
;
276 /* @PropertyType=Point,Nullable,GenerateAccessors */
277 const static int ToProperty
;
278 /* @PropertyType=EasingFunctionBase,ManagedPropertyType=IEasingFunction,GenerateAccessors */
279 const static int EasingFunctionProperty
;
281 /* @GenerateCBinding,GeneratePInvoke */
284 virtual Type::Kind
GetValueKind () { return Type::POINT
; };
286 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
288 virtual Value
*GetTargetValue (Value
*defaultOriginValue
);
289 virtual Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
,
290 AnimationClock
*animationClock
);
293 // Property Accessors
296 void SetBy (Point
*pv
);
297 void SetBy (Point v
);
300 void SetFrom (Point
*pv
);
301 void SetFrom (Point v
);
304 void SetTo (Point
*pv
);
305 void SetTo (Point v
);
307 EasingFunctionBase
* GetEasingFunction ();
308 void SetEasingFunction (EasingFunctionBase
* value
);
311 virtual ~PointAnimation ();
314 Point
*pointToCached
;
315 Point
*pointFromCached
;
316 Point
*pointByCached
;
319 void EnsureCache (void);
324 /* @Namespace=None,ManagedDependencyProperties=None */
325 class KeyFrame
: public DependencyObject
{
327 TimeSpan resolved_keytime
;
330 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
333 // Property Accessors
335 virtual KeyTime
*GetKeyTime () = 0;
336 virtual void SetKeyTime (KeyTime keytime
) = 0;
337 virtual void SetKeyTime (KeyTime
*keytime
) = 0;
340 virtual ~KeyFrame ();
344 /* @Namespace=None */
345 class KeyFrameCollection
: public DependencyObjectCollection
{
347 GPtrArray
*sorted_list
;
350 /* @GenerateCBinding,GeneratePInvoke */
351 KeyFrameCollection ();
353 virtual Type::Kind
GetElementType() { return Type::KEYFRAME
; }
355 virtual bool Clear ();
357 KeyFrame
*GetKeyFrameForTime (TimeSpan t
, KeyFrame
**previous_frame
);
359 virtual void OnSubPropertyChanged (DependencyProperty
*prop
, DependencyObject
*obj
, PropertyChangedEventArgs
*subobj_args
);
362 virtual bool AddedToCollection (Value
*value
, MoonError
*error
);
363 virtual void RemovedFromCollection (Value
*value
);
365 virtual ~KeyFrameCollection ();
368 /* @Namespace=System.Windows.Media.Animation */
369 class ColorKeyFrameCollection
: public KeyFrameCollection
{
371 /* @GenerateCBinding,GeneratePInvoke */
372 ColorKeyFrameCollection ();
374 virtual Type::Kind
GetElementType() { return Type::COLORKEYFRAME
; }
377 virtual ~ColorKeyFrameCollection ();
380 /* @Namespace=System.Windows.Media.Animation */
381 class DoubleKeyFrameCollection
: public KeyFrameCollection
{
383 /* @GenerateCBinding,GeneratePInvoke */
384 DoubleKeyFrameCollection ();
386 virtual Type::Kind
GetElementType() { return Type::DOUBLEKEYFRAME
; }
389 virtual ~DoubleKeyFrameCollection ();
392 /* @Namespace=System.Windows.Media.Animation */
393 class PointKeyFrameCollection
: public KeyFrameCollection
{
395 /* @GenerateCBinding,GeneratePInvoke */
396 PointKeyFrameCollection ();
398 virtual Type::Kind
GetElementType() { return Type::POINTKEYFRAME
; }
401 virtual ~PointKeyFrameCollection ();
404 /* @Version=2,Namespace=System.Windows.Media.Animation */
405 class ObjectKeyFrameCollection
: public KeyFrameCollection
{
407 /* @GenerateCBinding,GeneratePInvoke */
408 ObjectKeyFrameCollection ();
410 virtual Type::Kind
GetElementType() { return Type::OBJECTKEYFRAME
; }
413 virtual ~ObjectKeyFrameCollection ();
416 /* @Namespace=System.Windows.Media.Animation */
417 class DoubleKeyFrame
: public KeyFrame
{
419 /* @PropertyType=double,Nullable,ManagedPropertyType=double,GenerateAccessors */
420 const static int ValueProperty
;
421 /* @PropertyType=KeyTime,Nullable,ManagedPropertyType=KeyTime,GenerateAccessors */
422 const static int KeyTimeProperty
;
424 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Protected */
428 // Property Accessors
431 void SetValue (double *pv
);
432 void SetValue (double v
);
434 virtual KeyTime
*GetKeyTime ();
435 virtual void SetKeyTime (KeyTime keytime
);
436 virtual void SetKeyTime (KeyTime
*keytime
);
439 virtual ~DoubleKeyFrame ();
442 /* @Namespace=System.Windows.Media.Animation */
443 class ColorKeyFrame
: public KeyFrame
{
445 /* @PropertyType=Color,Nullable,ManagedPropertyType=Color,GenerateAccessors */
446 const static int ValueProperty
;
447 /* @PropertyType=KeyTime,Nullable,ManagedPropertyType=KeyTime,GenerateAccessors */
448 const static int KeyTimeProperty
;
450 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Protected */
454 // Property Accessors
457 void SetValue (Color
*pv
);
458 void SetValue (Color v
);
460 virtual KeyTime
*GetKeyTime ();
461 virtual void SetKeyTime (KeyTime keytime
);
462 virtual void SetKeyTime (KeyTime
*keytime
);
465 virtual ~ColorKeyFrame ();
468 /* @Version=2,Namespace=System.Windows.Media.Animation */
469 class ObjectKeyFrame
: public KeyFrame
/* The managed class derives directly from DependencyObject */ {
471 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Protected */
474 /* @PropertyType=object,GenerateAccessors,GenerateManagedAccessors=false,ManagedFieldAccess=Internal */
475 const static int ConvertedValueProperty
;
476 /* @PropertyType=object,ManagedPropertyType=object */
477 const static int ValueProperty
;
478 /* @PropertyType=KeyTime,Nullable,ManagedPropertyType=KeyTime,GenerateAccessors */
479 const static int KeyTimeProperty
;
481 Value
*GetConvertedValue ();
482 void SetConvertedValue (Value
*value
);
485 virtual KeyTime
*GetKeyTime ();
486 virtual void SetKeyTime (KeyTime keytime
);
487 virtual void SetKeyTime (KeyTime
*keytime
);
490 virtual ~ObjectKeyFrame ();
493 /* @Namespace=System.Windows.Media.Animation */
494 class PointKeyFrame
: public KeyFrame
{
496 /* @PropertyType=Point,Nullable,ManagedPropertyType=Point,GenerateAccessors */
497 const static int ValueProperty
;
498 /* @PropertyType=KeyTime,Nullable,ManagedPropertyType=KeyTime,GenerateAccessors */
499 const static int KeyTimeProperty
;
501 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Protected */
505 // Property Accessors
508 void SetValue (Point
*pv
);
509 void SetValue (Point v
);
511 virtual KeyTime
*GetKeyTime ();
512 virtual void SetKeyTime (KeyTime keytime
);
513 virtual void SetKeyTime (KeyTime
*keytime
);
516 virtual ~PointKeyFrame ();
521 /* @Namespace=System.Windows.Media.Animation */
522 class DiscreteDoubleKeyFrame
: public DoubleKeyFrame
{
524 /* @GenerateCBinding,GeneratePInvoke */
525 DiscreteDoubleKeyFrame ();
527 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
530 virtual ~DiscreteDoubleKeyFrame ();
536 /* @Namespace=System.Windows.Media.Animation */
537 class DiscreteColorKeyFrame
: public ColorKeyFrame
{
539 /* @GenerateCBinding,GeneratePInvoke */
540 DiscreteColorKeyFrame ();
542 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
545 virtual ~DiscreteColorKeyFrame ();
549 /* @Version=2,Namespace=System.Windows.Media.Animation */
550 class DiscreteObjectKeyFrame
: public ObjectKeyFrame
{
552 /* @GenerateCBinding,GeneratePInvoke */
553 DiscreteObjectKeyFrame ();
555 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
558 virtual ~DiscreteObjectKeyFrame ();
561 /* @Namespace=System.Windows.Media.Animation */
562 class DiscretePointKeyFrame
: public PointKeyFrame
{
564 /* @GenerateCBinding,GeneratePInvoke */
565 DiscretePointKeyFrame ();
567 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
570 virtual ~DiscretePointKeyFrame ();
574 /* @Namespace=System.Windows.Media.Animation */
575 class LinearDoubleKeyFrame
: public DoubleKeyFrame
{
577 /* @GenerateCBinding,GeneratePInvoke */
578 LinearDoubleKeyFrame ();
580 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
583 virtual ~LinearDoubleKeyFrame ();
588 /* @Namespace=System.Windows.Media.Animation */
589 class LinearColorKeyFrame
: public ColorKeyFrame
{
591 /* @GenerateCBinding,GeneratePInvoke */
592 LinearColorKeyFrame ();
594 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
597 virtual ~LinearColorKeyFrame ();
602 /* @Namespace=System.Windows.Media.Animation */
603 class LinearPointKeyFrame
: public PointKeyFrame
{
605 /* @GenerateCBinding,GeneratePInvoke */
606 LinearPointKeyFrame ();
608 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
611 virtual ~LinearPointKeyFrame ();
616 /* @Namespace=System.Windows.Media.Animation */
617 class SplineDoubleKeyFrame
: public DoubleKeyFrame
{
619 /* @PropertyType=KeySpline,AutoCreateValue,GenerateAccessors */
620 const static int KeySplineProperty
;
622 /* @GenerateCBinding,GeneratePInvoke */
623 SplineDoubleKeyFrame ();
625 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
628 // Property Accessors
630 KeySpline
*GetKeySpline ();
631 void SetKeySpline (KeySpline
* value
);
634 virtual ~SplineDoubleKeyFrame ();
639 /* @Namespace=System.Windows.Media.Animation */
640 class SplineColorKeyFrame
: public ColorKeyFrame
{
642 /* @PropertyType=KeySpline,AutoCreateValue,GenerateAccessors */
643 const static int KeySplineProperty
;
645 /* @GenerateCBinding,GeneratePInvoke */
646 SplineColorKeyFrame ();
648 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
651 // Property Accessors
653 KeySpline
*GetKeySpline ();
654 void SetKeySpline (KeySpline
* value
);
657 virtual ~SplineColorKeyFrame ();
662 /* @Namespace=System.Windows.Media.Animation */
663 class SplinePointKeyFrame
: public PointKeyFrame
{
665 /* @PropertyType=KeySpline,AutoCreateValue,GenerateAccessors */
666 const static int KeySplineProperty
;
668 /* @GenerateCBinding,GeneratePInvoke */
669 SplinePointKeyFrame ();
671 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
674 // Property Accessors
676 KeySpline
*GetKeySpline ();
677 void SetKeySpline (KeySpline
* value
);
680 virtual ~SplinePointKeyFrame ();
683 /* @Namespace=System.Windows.Media.Animation */
684 class EasingColorKeyFrame
: public ColorKeyFrame
{
686 /* @PropertyType=EasingFunctionBase,ManagedPropertyType=IEasingFunction,GenerateAccessors */
687 const static int EasingFunctionProperty
;
689 /* @GenerateCBinding,GeneratePInvoke */
690 EasingColorKeyFrame ();
692 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
695 // Property Accessors
697 EasingFunctionBase
*GetEasingFunction ();
698 void SetEasingFunction (EasingFunctionBase
* value
);
701 virtual ~EasingColorKeyFrame ();
704 /* @Namespace=System.Windows.Media.Animation */
705 class EasingDoubleKeyFrame
: public DoubleKeyFrame
{
707 /* @PropertyType=EasingFunctionBase,ManagedPropertyType=IEasingFunction,GenerateAccessors */
708 const static int EasingFunctionProperty
;
710 /* @GenerateCBinding,GeneratePInvoke */
711 EasingDoubleKeyFrame ();
713 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
716 // Property Accessors
718 EasingFunctionBase
*GetEasingFunction ();
719 void SetEasingFunction (EasingFunctionBase
* value
);
722 virtual ~EasingDoubleKeyFrame ();
725 /* @Namespace=System.Windows.Media.Animation */
726 class EasingPointKeyFrame
: public PointKeyFrame
{
728 /* @PropertyType=EasingFunctionBase,ManagedPropertyType=IEasingFunction,GenerateAccessors */
729 const static int EasingFunctionProperty
;
731 /* @GenerateCBinding,GeneratePInvoke */
732 EasingPointKeyFrame ();
734 virtual Value
*InterpolateValue (Value
*baseValue
, double keyFrameProgress
);
737 // Property Accessors
739 EasingFunctionBase
*GetEasingFunction ();
740 void SetEasingFunction (EasingFunctionBase
* value
);
743 virtual ~EasingPointKeyFrame ();
746 /* @Namespace=System.Windows.Media.Animation */
747 /* @ContentProperty="KeyFrames" */
748 class DoubleAnimationUsingKeyFrames
: public DoubleAnimation
{
750 /* @PropertyType=DoubleKeyFrameCollection,AutoCreateValue,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
751 const static int KeyFramesProperty
;
753 /* @GenerateCBinding,GeneratePInvoke */
754 DoubleAnimationUsingKeyFrames ();
756 void AddKeyFrame (DoubleKeyFrame
*frame
);
757 void RemoveKeyFrame (DoubleKeyFrame
*frame
);
759 virtual Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
,
760 AnimationClock
*animationClock
);
761 virtual bool Resolve (DependencyObject
*target
, DependencyProperty
*property
);
763 virtual Duration
GetNaturalDurationCore (Clock
* clock
);
765 virtual bool Validate ();
768 // Property Accessors
770 DoubleKeyFrameCollection
*GetKeyFrames ();
771 void SetKeyFrames (DoubleKeyFrameCollection
* value
);
774 virtual ~DoubleAnimationUsingKeyFrames ();
777 /* @Namespace=System.Windows.Media.Animation */
778 /* @ContentProperty="KeyFrames" */
779 class ColorAnimationUsingKeyFrames
: public ColorAnimation
{
781 /* @PropertyType=ColorKeyFrameCollection,AutoCreateValue,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
782 const static int KeyFramesProperty
;
784 /* @GenerateCBinding,GeneratePInvoke */
785 ColorAnimationUsingKeyFrames ();
787 void AddKeyFrame (ColorKeyFrame
*frame
);
788 void RemoveKeyFrame (ColorKeyFrame
*frame
);
790 virtual Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
,
791 AnimationClock
*animationClock
);
792 virtual bool Resolve (DependencyObject
*target
, DependencyProperty
*property
);
794 virtual Duration
GetNaturalDurationCore (Clock
* clock
);
796 virtual bool Validate ();
799 // Property Accessors
801 ColorKeyFrameCollection
*GetKeyFrames ();
802 void SetKeyFrames (ColorKeyFrameCollection
* value
);
805 virtual ~ColorAnimationUsingKeyFrames ();
809 /* @Namespace=System.Windows.Media.Animation */
810 /* @ContentProperty="KeyFrames" */
811 class ObjectAnimationUsingKeyFrames
: public /*Object*/Animation
{
813 /* @PropertyType=ObjectKeyFrameCollection,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors,AutoCreateValue */
814 const static int KeyFramesProperty
;
816 /* @GenerateCBinding,GeneratePInvoke */
817 ObjectAnimationUsingKeyFrames ();
819 void AddKeyFrame (ObjectKeyFrame
*frame
);
820 void RemoveKeyFrame (ObjectKeyFrame
*frame
);
822 // Property accessors
823 ObjectKeyFrameCollection
*GetKeyFrames ();
824 void SetKeyFrames (ObjectKeyFrameCollection
* value
);
826 virtual Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
,
827 AnimationClock
* animationClock
);
829 virtual bool Resolve (DependencyObject
*target
, DependencyProperty
*property
);
831 virtual Duration
GetNaturalDurationCore (Clock
* clock
);
832 virtual bool Validate ();
834 virtual Type::Kind
GetValueKind () { return Type::INVALID
; };
837 virtual ~ObjectAnimationUsingKeyFrames ();
840 /* @Namespace=System.Windows.Media.Animation */
841 /* @ContentProperty="KeyFrames" */
842 class PointAnimationUsingKeyFrames
: public PointAnimation
{
844 /* @PropertyType=PointKeyFrameCollection,AutoCreateValue,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
845 const static int KeyFramesProperty
;
847 /* @GenerateCBinding,GeneratePInvoke */
848 PointAnimationUsingKeyFrames ();
850 void AddKeyFrame (PointKeyFrame
*frame
);
851 void RemoveKeyFrame (PointKeyFrame
*frame
);
853 virtual Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
,
854 AnimationClock
*animationClock
);
855 virtual bool Resolve (DependencyObject
*target
, DependencyProperty
*property
);
857 virtual Duration
GetNaturalDurationCore (Clock
*clock
);
859 virtual bool Validate ();
862 // Property Accessors
864 PointKeyFrameCollection
*GetKeyFrames ();
865 void SetKeyFrames (PointKeyFrameCollection
* value
);
868 virtual ~PointAnimationUsingKeyFrames ();
871 /* @Namespace=System.Windows.Media.Animation */
872 /* @ContentProperty="Children" */
873 class Storyboard
: public ParallelTimeline
{
875 /* @PropertyType=string,Attached,GenerateAccessors,Validator=IsTimelineValidator */
876 const static int TargetNameProperty
;
877 /* @PropertyType=PropertyPath,Attached,GenerateAccessors,Validator=StoryboardTargetPropertyValidator */
878 const static int TargetPropertyProperty
;
880 /* @GenerateCBinding,GeneratePInvoke */
883 /* @GenerateCBinding,GeneratePInvoke */
884 bool BeginWithError (MoonError
*error
);
886 /* @GenerateCBinding,GeneratePInvoke */
887 void PauseWithError (MoonError
*error
);
889 /* @GenerateCBinding,GeneratePInvoke */
890 void ResumeWithError (MoonError
*error
);
892 /* @GenerateCBinding,GeneratePInvoke */
893 void SeekWithError (TimeSpan timespan
, MoonError
*error
);
895 /* @GenerateCBinding,GeneratePInvoke */
896 void SeekAlignedToLastTickWithError (TimeSpan timespan
, MoonError
*error
);
898 /* @GenerateCBinding,GeneratePInvoke */
899 void SkipToFillWithError (MoonError
*error
);
901 /* @GenerateCBinding,GeneratePInvoke */
902 void StopWithError (MoonError
*error
);
904 /* @GenerateCBinding,GeneratePInvoke */
905 TimeSpan
GetCurrentTime ();
907 /* @GenerateCBinding,GeneratePInvoke */
908 int GetCurrentState ();
910 /* @GenerateCBinding,GeneratePInvoke */
911 DependencyProperty
*GetTargetDependencyProperty ();
913 static void SetTargetName (DependencyObject
*o
, const char *targetName
);
914 static const char *GetTargetName (DependencyObject
*o
);
915 static void SetTargetProperty (DependencyObject
*o
, PropertyPath
*targetProperty
);
916 static PropertyPath
*GetTargetProperty (DependencyObject
*o
);
919 virtual ~Storyboard ();
922 bool HookupAnimationsRecurse (Clock
*clock
,
923 DependencyObject
*targetObject
, PropertyPath
*targetPropertyPath
,
924 GHashTable
*promoted_values
,
928 /* @Namespace=System.Windows.Media.Animation */
929 /* @ContentProperty="Storyboard" */
930 class BeginStoryboard
: public TriggerAction
{
932 /* @PropertyType=Storyboard,GenerateAccessors */
933 const static int StoryboardProperty
;
935 /* @GenerateCBinding,GeneratePInvoke */
938 virtual void Fire ();
941 // Property Accessors
943 void SetStoryboard (Storyboard
*sb
);
944 Storyboard
*GetStoryboard ();
947 virtual ~BeginStoryboard ();
950 // internal WPF class gleaned from stack traces
951 class AnimationStorage
{
954 class Node
: public List::Node
{
956 AnimationStorage
*storage
;
957 DependencyProperty
*key
;
959 Node (DependencyProperty
*key
, AnimationStorage
*storage
) {
961 this->storage
= storage
;
965 return new Node (key
, storage
);
969 AnimationStorage (AnimationClock
*clock
, Animation
*timeline
,
970 DependencyObject
*targetobj
, DependencyProperty
*targetprop
);
971 ~AnimationStorage ();
973 void SwitchTarget (DependencyObject
*target
);
977 bool IsCurrentStorage ();
979 Value
* GetResetValue ();
980 void SetStopValue (Value
*value
);
982 AnimationClock
*GetClock ();
983 Animation
*GetTimeline ();
987 void ResetPropertyValue ();
988 void UpdatePropertyValue ();
989 static void update_property_value (EventObject
*sender
, EventArgs
*calldata
, gpointer data
);
991 void TargetObjectDestroyed ();
992 static void target_object_destroyed (EventObject
*sender
, EventArgs
*calldata
, gpointer data
);
994 void AttachUpdateHandler ();
995 void DetachUpdateHandler ();
996 void AttachTargetHandler ();
997 void DetachTargetHandler ();
998 void DetachFromProperty ();
1000 AnimationClock
*clock
;
1001 Animation
* timeline
;
1002 DependencyObject
*targetobj
;
1003 DependencyProperty
*targetprop
;
1009 /* @Namespace=None,ManagedDependencyProperties=None */
1010 class AnimationClock
: public Clock
{
1012 AnimationClock (Animation
*timeline
);
1014 Value
*GetCurrentValue (Value
*defaultOriginValue
, Value
*defaultDestinationValue
);
1016 AnimationStorage
*HookupStorage (DependencyObject
*targetobj
, DependencyProperty
*targetprop
);
1017 void DetachStorage ();
1019 virtual void Stop ();
1020 virtual void Begin (TimeSpan parentTime
);
1023 virtual ~AnimationClock ();
1026 Animation
*timeline
;
1027 AnimationStorage
*storage
;
1030 #endif /* MOON_ANIMATION_H */