2009-09-12 Chris Toshok <toshok@ximian.com>
[moon.git] / src / timeline.h
blob7cd2a394b79ddbaeb59f900ad0db8462bf42eeb1
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * Contact:
4 * Moonlight List (moonlight-list@lists.ximian.com)
6 * Copyright 2007 Novell, Inc. (http://www.novell.com)
8 * See the LICENSE file included with the distribution for details.
9 *
12 #ifndef MOON_TIMELINE_H
13 #define MOON_TIMELINE_H
15 #include <glib.h>
17 #include "clock.h"
20 /* @Namespace=System.Windows.Media.Animation */
21 class Timeline : public DependencyObject {
22 public:
23 /* @PropertyType=bool,DefaultValue=false,GenerateAccessors */
24 const static int AutoReverseProperty;
25 /* @PropertyType=TimeSpan,Nullable,DefaultValue=(gint64) 0\, Type::TIMESPAN */
26 const static int BeginTimeProperty;
27 /* @PropertyType=Duration,DefaultValue=Duration::Automatic */
28 const static int DurationProperty;
29 /* @PropertyType=FillBehavior,DefaultValue=FillBehaviorHoldEnd,GenerateAccessors */
30 const static int FillBehaviorProperty;
31 /* @PropertyType=RepeatBehavior,DefaultValue=RepeatBehavior ((double) 1) */
32 const static int RepeatBehaviorProperty;
33 /* @PropertyType=double,DefaultValue=1.0,GenerateAccessors */
34 const static int SpeedRatioProperty;
36 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Protected */
37 Timeline ();
39 void SetAutoReverse (bool autoreverse);
40 bool GetAutoReverse ();
42 TimeSpan GetBeginTime ();
44 void SetDuration (Duration duration);
45 Duration *GetDuration ();
47 FillBehavior GetFillBehavior ();
48 void SetFillBehavior (FillBehavior behavior);
50 bool GetHadParent () { return this->had_parent; }
51 void SetHadParent (bool had_parent) { this->had_parent = had_parent; }
53 void SetRepeatBehavior (RepeatBehavior behavior);
54 RepeatBehavior *GetRepeatBehavior ();
56 void SetSpeedRatio (double ratio);
57 double GetSpeedRatio ();
59 Duration GetNaturalDuration (Clock *clock);
60 virtual Duration GetNaturalDurationCore (Clock *clock);
62 virtual Clock *AllocateClock ();
63 virtual bool Validate ();
65 Clock* GetClock ();
67 enum TimelineStatus {
68 TIMELINE_STATUS_OK,
69 TIMELINE_STATUS_DETACHED
72 TimelineStatus GetTimelineStatus () { return timeline_status; }
74 bool HasManualTarget () { return manual_target != NULL; }
76 /* @GenerateCBinding,GeneratePInvoke */
77 DependencyObject* GetManualTarget () { return manual_target; }
79 /* @GenerateCBinding,GeneratePInvoke */
80 void SetManualTarget (DependencyObject *o) { manual_target = o; }
82 // events
83 const static int CompletedEvent;
85 virtual void TeardownClock ();
87 protected:
88 virtual ~Timeline ();
90 void AttachCompletedHandler ();
91 void DetachCompletedHandler ();
93 virtual void OnClockCompleted ();
95 static void clock_completed (EventObject *sender, EventArgs *calldata, gpointer closure);
97 Clock *clock;
99 private:
100 bool had_parent;
101 TimelineStatus timeline_status;
102 DependencyObject *manual_target;
106 /* @Namespace=System.Windows.Media.Animation */
107 class TimelineCollection : public DependencyObjectCollection {
108 public:
109 /* @GenerateCBinding,GeneratePInvoke */
110 TimelineCollection ();
112 virtual Type::Kind GetElementType() { return Type::TIMELINE; }
114 protected:
115 virtual ~TimelineCollection ();
119 /* @Namespace=None,ManagedDependencyProperties=None */
120 class TimelineGroup : public Timeline {
121 public:
122 /* @PropertyType=TimelineCollection,AutoCreateValue,GenerateAccessors */
123 const static int ChildrenProperty;
125 /* @GenerateCBinding,GeneratePInvoke */
126 TimelineGroup ();
128 virtual Clock *AllocateClock ();
129 virtual bool Validate ();
131 void AddChild (Timeline *child);
132 void RemoveChild (Timeline *child);
134 virtual void OnCollectionChanged (Collection *col, CollectionChangedEventArgs *args);
137 // Property Accessors
139 void SetChildren (TimelineCollection *children);
140 TimelineCollection *GetChildren ();
142 protected:
143 virtual ~TimelineGroup ();
147 /* @Namespace=None */
148 class ParallelTimeline : public TimelineGroup {
149 public:
150 /* @GenerateCBinding,GeneratePInvoke */
151 ParallelTimeline ();
153 virtual Duration GetNaturalDurationCore (Clock *clock);
155 protected:
156 virtual ~ParallelTimeline ();
160 /* @Namespace=System.Windows.Media */
161 class TimelineMarker : public DependencyObject {
162 public:
163 /* @PropertyType=string,GenerateAccessors */
164 const static int TextProperty;
165 /* @PropertyType=TimeSpan,GenerateAccessors */
166 const static int TimeProperty;
167 /* @PropertyType=string,GenerateAccessors */
168 const static int TypeProperty;
170 /* @GenerateCBinding,GeneratePInvoke */
171 TimelineMarker ();
174 // Property Accessors
176 void SetText (const char *text);
177 const char *GetText ();
179 void SetTime (TimeSpan time);
180 TimeSpan GetTime ();
182 void SetType (const char *type);
183 const char *GetType ();
185 protected:
186 virtual ~TimelineMarker ();
190 /* @Namespace=Mono,Version=2 */
191 class DispatcherTimer : public Timeline {
192 public:
193 /* @GenerateCBinding,GeneratePInvoke,MainThread,Version=2 */
194 DispatcherTimer ();
196 /* @GenerateCBinding,GeneratePInvoke,Version=2 */
197 void Start ();
199 /* @GenerateCBinding,GeneratePInvoke,Version=2 */
200 void Stop ();
202 const static int TickEvent;
204 bool IsStopped () { return stopped; }
205 bool IsStarted () { return started; }
206 void Restart ();
208 virtual Duration GetNaturalDurationCore (Clock *clock);
209 virtual void TeardownClock ();
211 protected:
212 virtual void OnClockCompleted ();
214 private:
215 bool stopped;
216 bool started;
219 #endif /* MOON_TIMELINE_H */