in plugin/:
[moon.git] / src / timeline.h
blob04bfee87007d18c7e2adfbe718a462092eba4e55
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,ManagedEvents=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 /* @ManagedEvents=Manual */
192 class DispatcherTimer : public Timeline {
193 public:
194 /* @GenerateCBinding,GeneratePInvoke,MainThread,Version=2 */
195 DispatcherTimer ();
197 /* @GenerateCBinding,GeneratePInvoke,Version=2 */
198 void Start ();
200 /* @GenerateCBinding,GeneratePInvoke,Version=2 */
201 void Stop ();
203 const static int TickEvent;
205 bool IsStopped () { return stopped; }
206 bool IsStarted () { return started; }
207 void Restart ();
209 virtual Duration GetNaturalDurationCore (Clock *clock);
210 virtual void TeardownClock ();
212 protected:
213 virtual void OnClockCompleted ();
215 private:
216 bool stopped;
217 bool started;
220 #endif /* MOON_TIMELINE_H */