~ubuntu-branches/ubuntu/karmic/moon/karmic

« back to all changes in this revision

Viewing changes to src/animation.h

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-14 12:01:08 UTC
  • Revision ID: james.westby@ubuntu.com-20090214120108-06539vb25vhbd8bn
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
2
/*
 
3
 * animation.h: Animation engine
 
4
 *
 
5
 * Contact:
 
6
 *   Moonlight List (moonlight-list@lists.ximian.com)
 
7
 *
 
8
 * Copyright 2007 Novell, Inc. (http://www.novell.com)
 
9
 *
 
10
 * See the LICENSE file included with the distribution for details.
 
11
 * 
 
12
 */
 
13
 
 
14
#ifndef MOON_ANIMATION_H
 
15
#define MOON_ANIMATION_H
 
16
 
 
17
#include <glib.h>
 
18
 
 
19
#include "trigger.h"
 
20
#include "collection.h"
 
21
#include "clock.h"
 
22
#include "list.h"
 
23
#include "point.h"
 
24
#include "moon-curves.h"
 
25
#include "applier.h"
 
26
 
 
27
// misc types
 
28
/* @Namespace=System.Windows.Media.Animation */
 
29
class KeySpline : public DependencyObject {
 
30
        moon_quadratic quadraticsArray [16];
 
31
        
 
32
 protected:
 
33
        virtual ~KeySpline () {}
 
34
        
 
35
 public:
 
36
        /* @GenerateCBinding,GeneratePInvoke */
 
37
        KeySpline ();
 
38
        
 
39
        KeySpline (Point controlPoint1, Point controlPoint2);
 
40
        KeySpline (double x1, double y1, double x2, double y2);
 
41
 
 
42
        virtual Type::Kind GetObjectType () { return Type::KEYSPLINE; }
 
43
        virtual void OnPropertyChanged (PropertyChangedEventArgs *args);
 
44
        
 
45
        void RegenerateQuadratics ();
 
46
 
 
47
        double GetSplineProgress (double linearProgress);
 
48
        /* @PropertyType=Point,ManagedPropertyType=Point,DefaultValue=Point (0\,0),ManagedFieldAccess=Internal,GenerateAccessors */
 
49
        static DependencyProperty *ControlPoint1Property;
 
50
        /* @PropertyType=Point,ManagedPropertyType=Point,DefaultValue=Point (1.0\, 1.0),ManagedFieldAccess=Internal,GenerateAccessors */
 
51
        static DependencyProperty *ControlPoint2Property;
 
52
 
 
53
        Point *GetControlPoint1 ();
 
54
        void SetControlPoint1 (Point *controlPoint1);
 
55
 
 
56
        Point *GetControlPoint2 ();
 
57
        void SetControlPoint2 (Point *controlPoint2);
 
58
};
 
59
 
 
60
/* @IncludeInKinds */
 
61
/* @Namespace=System.Windows.Media.Animation */
 
62
struct KeyTime {
 
63
 public:
 
64
        enum KeyTimeType {
 
65
                UNIFORM,
 
66
                PACED,
 
67
                PERCENT,
 
68
                TIMESPAN
 
69
        };
 
70
 
 
71
        KeyTime (const KeyTime &keytime)
 
72
        {
 
73
                k = keytime.k;
 
74
                percent = keytime.percent;
 
75
                timespan = keytime.timespan;
 
76
        }
 
77
 
 
78
        KeyTime (double percent)
 
79
          : k (PERCENT),
 
80
            percent (percent),
 
81
            timespan (0) { }
 
82
 
 
83
        KeyTime (TimeSpan timeSpan)
 
84
          : k (TIMESPAN),
 
85
            timespan (timeSpan) { }
 
86
 
 
87
 
 
88
        KeyTime (KeyTimeType kind) : k(kind) { }
 
89
 
 
90
        static KeyTime FromPercent (double percent) { return KeyTime (percent); }
 
91
        static KeyTime FromTimeSpan (TimeSpan timeSpan) { return KeyTime (timeSpan); }
 
92
 
 
93
        static KeyTime Paced;
 
94
        static KeyTime Uniform;
 
95
 
 
96
        bool operator!= (const KeyTime &v) const
 
97
        {
 
98
                return !(*this == v);
 
99
        }
 
100
 
 
101
        bool operator== (const KeyTime &v) const
 
102
        {
 
103
                if (v.k != k)
 
104
                        return false;
 
105
 
 
106
                switch (k) {
 
107
                case PERCENT: return percent == v.percent;
 
108
                case TIMESPAN: return timespan == v.timespan;
 
109
                default: return true;
 
110
                }
 
111
        }
 
112
 
 
113
        bool HasPercent () { return k == PERCENT; }
 
114
        double GetPercent () { return percent; }
 
115
 
 
116
        bool HasTimeSpan () { return k == TIMESPAN; }
 
117
        TimeSpan GetTimeSpan () { return timespan; }
 
118
 
 
119
 private:
 
120
        KeyTimeType k;
 
121
        gint32 padding;
 
122
        double percent;
 
123
        TimeSpan timespan;
 
124
};
 
125
 
 
126
 
 
127
//
 
128
// Animations (more specialized clocks and timelines) and their subclasses
 
129
//
 
130
class Animation;
 
131
class AnimationClock;
 
132
class AnimationStorage;
 
133
 
 
134
// internal WPF class gleaned from stack traces
 
135
class AnimationStorage {
 
136
 public:
 
137
        AnimationStorage (AnimationClock *clock, Animation/*Timeline*/ *timeline,
 
138
                          DependencyObject *targetobj, DependencyProperty *targetprop);
 
139
        ~AnimationStorage ();
 
140
        
 
141
        void ResetPropertyValue ();
 
142
        void DetachUpdateHandler ();
 
143
        void ReAttachUpdateHandler ();
 
144
        void DetachTarget ();
 
145
        void FlagAsNonResetable ();
 
146
        void Float ();
 
147
        bool IsFloating () { return floating; };
 
148
        bool IsCurrentStorage ();
 
149
        Value* GetResetValue ();
 
150
        void UpdatePropertyValueWith (Value *v);
 
151
        Value* GetStopValue (void);
 
152
        void DetachFromPrevStorage (void);
 
153
 
 
154
 private:
 
155
        void TargetObjectDestroyed ();
 
156
        static void target_object_destroyed (EventObject *sender, EventArgs *calldata, gpointer data);
 
157
 
 
158
        void UpdatePropertyValue ();
 
159
        static void update_property_value (EventObject *sender, EventArgs *calldata, gpointer data);
 
160
 
 
161
        AnimationClock *clock;
 
162
        Animation/*Timeline*/* timeline;
 
163
        DependencyObject *targetobj;
 
164
        DependencyProperty *targetprop;
 
165
        Value *baseValue;
 
166
        Value *stopValue;
 
167
        bool nonResetableFlag;
 
168
        bool floating;
 
169
        bool wasAttached;
 
170
};
 
171
 
 
172
 
 
173
class Animation/*Timeline*/;
 
174
 
 
175
/* @Namespace=None,ManagedDependencyProperties=None */
 
176
class AnimationClock : public Clock {
 
177
 protected:
 
178
        virtual ~AnimationClock ();
 
179
 
 
180
 public:
 
181
        AnimationClock (Animation/*Timeline*/ *timeline);
 
182
        virtual Type::Kind GetObjectType () { return Type::ANIMATIONCLOCK; };
 
183
        virtual void ExtraRepeatAction ();
 
184
        virtual void OnSurfaceDetach ();
 
185
        virtual void OnSurfaceReAttach ();
 
186
 
 
187
        Value *GetCurrentValue (Value *defaultOriginValue, Value *defaultDestinationValue);
 
188
 
 
189
        bool HookupStorage (DependencyObject *targetobj, DependencyProperty *targetprop);
 
190
 
 
191
        virtual void Stop ();
 
192
        virtual void Begin ();
 
193
 
 
194
 private:
 
195
        Animation/*Timeline*/ *timeline;
 
196
        AnimationStorage *storage;
 
197
};
 
198
 
 
199
 
 
200
 
 
201
 
 
202
 
 
203
/* this is called AnimationTimeline in wpf */
 
204
/* @Namespace=None */
 
205
class Animation/*Timeline*/ : public Timeline {
 
206
 protected:
 
207
        virtual ~Animation () {}
 
208
 
 
209
 public:
 
210
 
 
211
        Animation/*Timeline*/ () { };
 
212
        virtual Type::Kind GetObjectType () { return Type::ANIMATION; };
 
213
        
 
214
        virtual Clock *AllocateClock ();
 
215
 
 
216
        virtual Value *GetCurrentValue (Value *defaultOriginValue, Value *defaultDestinationValue,
 
217
                                        AnimationClock* animationClock);
 
218
        virtual Value *GetTargetValue (Value *defaultOriginValue);
 
219
 
 
220
        virtual Duration GetNaturalDurationCore (Clock* clock);
 
221
 
 
222
 
 
223
        virtual void Resolve () { };
 
224
 
 
225
        /* The kind of values this animation generates */
 
226
        virtual Type::Kind GetValueKind () { return Type::INVALID; };
 
227
};
 
228
 
 
229
/* @Namespace=System.Windows.Media.Animation */
 
230
class DoubleAnimation : public Animation/*Timeline*/ {
 
231
 protected:
 
232
        virtual ~DoubleAnimation () {}
 
233
 
 
234
 public:
 
235
        /* @PropertyType=double,Nullable,GenerateAccessors */
 
236
        static DependencyProperty *ByProperty;
 
237
        /* @PropertyType=double,Nullable,GenerateAccessors */
 
238
        static DependencyProperty *FromProperty;
 
239
        /* @PropertyType=double,Nullable,GenerateAccessors */
 
240
        static DependencyProperty *ToProperty;
 
241
        
 
242
        /* @GenerateCBinding,GeneratePInvoke */
 
243
        DoubleAnimation ();
 
244
        
 
245
        virtual Type::Kind GetObjectType () { return Type::DOUBLEANIMATION; };
 
246
        virtual Type::Kind GetValueKind () { return Type::DOUBLE; };
 
247
        
 
248
        virtual Value *GetTargetValue (Value *defaultOriginValue);
 
249
        virtual Value *GetCurrentValue (Value *defaultOriginValue, Value *defaultDestinationValue,
 
250
                                        AnimationClock *animationClock);
 
251
        
 
252
        //
 
253
        // Property Accessors
 
254
        //
 
255
        double *GetBy ();
 
256
        void    SetBy (double *pv);
 
257
        void    SetBy (double v);
 
258
        
 
259
        double *GetFrom ();
 
260
        void    SetFrom (double *pv);
 
261
        void    SetFrom (double v);
 
262
        
 
263
        double *GetTo ();
 
264
        void    SetTo (double *pv);
 
265
        void    SetTo (double v);
 
266
};
 
267
 
 
268
 
 
269
/* @Namespace=System.Windows.Media.Animation */
 
270
class ColorAnimation : public Animation/*Timeline*/ {
 
271
 protected:
 
272
        virtual ~ColorAnimation () {}
 
273
 
 
274
 public:
 
275
        /* @PropertyType=Color,Nullable,GenerateAccessors */
 
276
        static DependencyProperty *ByProperty;
 
277
        /* @PropertyType=Color,Nullable,GenerateAccessors */
 
278
        static DependencyProperty *FromProperty;
 
279
        /* @PropertyType=Color,Nullable,GenerateAccessors */
 
280
        static DependencyProperty *ToProperty;
 
281
        
 
282
        /* @GenerateCBinding,GeneratePInvoke */
 
283
        ColorAnimation ();
 
284
        
 
285
        virtual Type::Kind GetObjectType () { return Type::COLORANIMATION; };
 
286
        virtual Type::Kind GetValueKind () { return Type::COLOR; };
 
287
        
 
288
        virtual Value *GetTargetValue (Value *defaultOriginValue);
 
289
        virtual Value *GetCurrentValue (Value *defaultOriginValue, Value *defaultDestinationValue,
 
290
                                        AnimationClock *animationClock);
 
291
        
 
292
        //
 
293
        // Property Accessors
 
294
        //
 
295
        Color *GetBy ();
 
296
        void   SetBy (Color *pv);
 
297
        void   SetBy (Color v);
 
298
 
 
299
        Color *GetFrom ();
 
300
        void   SetFrom (Color *pv);
 
301
        void   SetFrom (Color v);
 
302
 
 
303
        Color *GetTo ();
 
304
        void   SetTo (Color *pv);
 
305
        void   SetTo (Color v);
 
306
};
 
307
 
 
308
 
 
309
/* @Namespace=System.Windows.Media.Animation */
 
310
class PointAnimation : public Animation/*Timeline*/ {
 
311
 protected:
 
312
        virtual ~PointAnimation () {}
 
313
 
 
314
 public:
 
315
        /* @PropertyType=Point,Nullable,GenerateAccessors */
 
316
        static DependencyProperty *ByProperty;
 
317
        /* @PropertyType=Point,Nullable,GenerateAccessors */
 
318
        static DependencyProperty *FromProperty;
 
319
        /* @PropertyType=Point,Nullable,GenerateAccessors */
 
320
        static DependencyProperty *ToProperty;
 
321
        
 
322
        /* @GenerateCBinding,GeneratePInvoke */
 
323
        PointAnimation () {}
 
324
        
 
325
        virtual Type::Kind GetObjectType () { return Type::POINTANIMATION; };
 
326
        virtual Type::Kind GetValueKind () { return Type::POINT; };
 
327
        
 
328
        virtual Value *GetTargetValue (Value *defaultOriginValue);
 
329
        virtual Value *GetCurrentValue (Value *defaultOriginValue, Value *defaultDestinationValue,
 
330
                                        AnimationClock *animationClock);
 
331
        
 
332
        //
 
333
        // Property Accessors
 
334
        //
 
335
        Point *GetBy ();
 
336
        void   SetBy (Point *pv);
 
337
        void   SetBy (Point v);
 
338
 
 
339
        Point *GetFrom ();
 
340
        void   SetFrom (Point *pv);
 
341
        void   SetFrom (Point v);
 
342
 
 
343
        Point *GetTo ();
 
344
        void   SetTo (Point *pv);
 
345
        void   SetTo (Point v);
 
346
};
 
347
 
 
348
 
 
349
/* @Namespace=None,ManagedDependencyProperties=None */
 
350
class KeyFrame : public DependencyObject {
 
351
 protected:
 
352
        virtual ~KeyFrame () {}
 
353
        KeyFrame ();
 
354
 
 
355
 public:
 
356
        TimeSpan resolved_keytime;
 
357
        bool resolved;
 
358
        
 
359
        virtual Type::Kind GetObjectType () { return Type::KEYFRAME; };
 
360
        
 
361
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
362
        
 
363
        //
 
364
        // Property Accessors
 
365
        //
 
366
        virtual KeyTime *GetKeyTime () = 0;
 
367
        virtual void SetKeyTime (KeyTime keytime) = 0;
 
368
        virtual void SetKeyTime (KeyTime *keytime) = 0;
 
369
};
 
370
 
 
371
/* @Namespace=None */
 
372
class KeyFrameCollection : public DependencyObjectCollection {
 
373
 protected:
 
374
        virtual bool AddedToCollection (Value *value, MoonError *error);
 
375
        virtual void RemovedFromCollection (Value *value);
 
376
        
 
377
        virtual ~KeyFrameCollection ();
 
378
 
 
379
 public:
 
380
        GPtrArray *sorted_list;
 
381
        bool resolved;
 
382
        
 
383
        /* @GenerateCBinding,GeneratePInvoke */
 
384
        KeyFrameCollection ();
 
385
        
 
386
        virtual Type::Kind GetObjectType() { return Type::KEYFRAME_COLLECTION; }
 
387
        virtual Type::Kind GetElementType() { return Type::KEYFRAME; }
 
388
        
 
389
        virtual bool Clear ();
 
390
        
 
391
        KeyFrame *GetKeyFrameForTime (TimeSpan t, KeyFrame **previous_frame);
 
392
 
 
393
        virtual void OnSubPropertyChanged (DependencyProperty *prop, DependencyObject *obj, PropertyChangedEventArgs *subobj_args);
 
394
};
 
395
 
 
396
/* @Namespace=System.Windows.Media.Animation */
 
397
class ColorKeyFrameCollection : public KeyFrameCollection {
 
398
 protected:
 
399
        virtual ~ColorKeyFrameCollection () {}
 
400
 
 
401
 public:
 
402
        /* @GenerateCBinding,GeneratePInvoke */
 
403
        ColorKeyFrameCollection () { }
 
404
        
 
405
        virtual Type::Kind GetObjectType() { return Type::COLORKEYFRAME_COLLECTION; }
 
406
        virtual Type::Kind GetElementType() { return Type::COLORKEYFRAME; }
 
407
};
 
408
 
 
409
/* @Namespace=System.Windows.Media.Animation */
 
410
class DoubleKeyFrameCollection : public KeyFrameCollection {
 
411
 protected:
 
412
        virtual ~DoubleKeyFrameCollection () {}
 
413
 
 
414
 public:
 
415
        /* @GenerateCBinding,GeneratePInvoke */
 
416
        DoubleKeyFrameCollection () { }
 
417
        
 
418
        virtual Type::Kind GetObjectType() { return Type::DOUBLEKEYFRAME_COLLECTION; }
 
419
        virtual Type::Kind GetElementType() { return Type::DOUBLEKEYFRAME; }
 
420
};
 
421
 
 
422
/* @Namespace=System.Windows.Media.Animation */
 
423
class PointKeyFrameCollection : public KeyFrameCollection {
 
424
 protected:
 
425
        virtual ~PointKeyFrameCollection () {}
 
426
 
 
427
 public:
 
428
        /* @GenerateCBinding,GeneratePInvoke */
 
429
        PointKeyFrameCollection () { }
 
430
        
 
431
        virtual Type::Kind GetObjectType() { return Type::POINTKEYFRAME_COLLECTION; }
 
432
        virtual Type::Kind GetElementType() { return Type::POINTKEYFRAME; }
 
433
};
 
434
 
 
435
/* @Namespace=System.Windows.Media.Animation */
 
436
class DoubleKeyFrame : public KeyFrame {
 
437
 protected:
 
438
        virtual ~DoubleKeyFrame () {}
 
439
 
 
440
 public:
 
441
        /* @PropertyType=double,Nullable,ManagedPropertyType=double,GenerateAccessors */
 
442
        static DependencyProperty *ValueProperty;
 
443
        /* @PropertyType=KeyTime,Nullable,ManagedPropertyType=KeyTime,GenerateAccessors */
 
444
        static DependencyProperty *KeyTimeProperty;
 
445
        
 
446
        /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Protected */
 
447
        DoubleKeyFrame ();
 
448
        virtual Type::Kind GetObjectType() { return Type::DOUBLEKEYFRAME; };
 
449
        
 
450
        //
 
451
        // Property Accessors
 
452
        //
 
453
        double *GetValue ();
 
454
        void    SetValue (double *pv);
 
455
        void    SetValue (double v);
 
456
 
 
457
        virtual KeyTime *GetKeyTime ();
 
458
        virtual void SetKeyTime (KeyTime keytime);
 
459
        virtual void SetKeyTime (KeyTime *keytime);
 
460
};
 
461
 
 
462
/* @Namespace=System.Windows.Media.Animation */
 
463
class ColorKeyFrame : public KeyFrame {
 
464
 protected:
 
465
        virtual ~ColorKeyFrame () {}
 
466
 
 
467
 public:
 
468
        /* @PropertyType=Color,Nullable,ManagedPropertyType=Color,GenerateAccessors */
 
469
        static DependencyProperty *ValueProperty;
 
470
        /* @PropertyType=KeyTime,Nullable,ManagedPropertyType=KeyTime,GenerateAccessors */
 
471
        static DependencyProperty *KeyTimeProperty;
 
472
        
 
473
        /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Protected */
 
474
        ColorKeyFrame ();
 
475
        virtual Type::Kind GetObjectType () { return Type::COLORKEYFRAME; };
 
476
        
 
477
        //
 
478
        // Property Accessors
 
479
        //
 
480
        Color *GetValue ();
 
481
        void   SetValue (Color *pv);
 
482
        void   SetValue (Color v);
 
483
 
 
484
        virtual KeyTime *GetKeyTime ();
 
485
        virtual void SetKeyTime (KeyTime keytime);
 
486
        virtual void SetKeyTime (KeyTime *keytime);
 
487
};
 
488
 
 
489
/* @Namespace=System.Windows.Media.Animation */
 
490
class PointKeyFrame : public KeyFrame {
 
491
 protected:
 
492
        virtual ~PointKeyFrame () {}
 
493
        
 
494
 public:
 
495
        /* @PropertyType=Point,Nullable,ManagedPropertyType=Point,GenerateAccessors */
 
496
        static DependencyProperty *ValueProperty;
 
497
        /* @PropertyType=KeyTime,Nullable,ManagedPropertyType=KeyTime,GenerateAccessors */
 
498
        static DependencyProperty *KeyTimeProperty;
 
499
        
 
500
        /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Protected */
 
501
        PointKeyFrame ();
 
502
        
 
503
        virtual Type::Kind GetObjectType () { return Type::POINTKEYFRAME; };
 
504
        
 
505
        //
 
506
        // Property Accessors
 
507
        //
 
508
        Point *GetValue ();
 
509
        void   SetValue (Point *pv);
 
510
        void   SetValue (Point v);
 
511
 
 
512
        virtual KeyTime *GetKeyTime ();
 
513
        virtual void SetKeyTime (KeyTime keytime);
 
514
        virtual void SetKeyTime (KeyTime *keytime);
 
515
};
 
516
 
 
517
 
 
518
 
 
519
/* @Namespace=System.Windows.Media.Animation */
 
520
class DiscreteDoubleKeyFrame : public DoubleKeyFrame {
 
521
 protected:
 
522
        virtual ~DiscreteDoubleKeyFrame () {}
 
523
 
 
524
 public:
 
525
        /* @GenerateCBinding,GeneratePInvoke */
 
526
        DiscreteDoubleKeyFrame () { }
 
527
        
 
528
        virtual Type::Kind GetObjectType () { return Type::DISCRETEDOUBLEKEYFRAME; };
 
529
 
 
530
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
531
};
 
532
 
 
533
 
 
534
 
 
535
 
 
536
/* @Namespace=System.Windows.Media.Animation */
 
537
class DiscreteColorKeyFrame : public ColorKeyFrame {
 
538
 protected:
 
539
        virtual ~DiscreteColorKeyFrame () {}
 
540
        
 
541
 public:
 
542
        /* @GenerateCBinding,GeneratePInvoke */
 
543
        DiscreteColorKeyFrame () { }
 
544
        
 
545
        virtual Type::Kind GetObjectType () { return Type::DISCRETECOLORKEYFRAME; };
 
546
        
 
547
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
548
};
 
549
 
 
550
 
 
551
 
 
552
/* @Namespace=System.Windows.Media.Animation */
 
553
class DiscretePointKeyFrame : public PointKeyFrame {
 
554
 protected:
 
555
        virtual ~DiscretePointKeyFrame () {}
 
556
        
 
557
 public:
 
558
        /* @GenerateCBinding,GeneratePInvoke */
 
559
        DiscretePointKeyFrame () { }
 
560
        
 
561
        virtual Type::Kind GetObjectType () { return Type::DISCRETEPOINTKEYFRAME; };
 
562
        
 
563
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
564
};
 
565
 
 
566
 
 
567
/* @Namespace=System.Windows.Media.Animation */
 
568
class LinearDoubleKeyFrame : public DoubleKeyFrame {
 
569
 protected:
 
570
        virtual ~LinearDoubleKeyFrame () {}
 
571
        
 
572
 public:
 
573
        /* @GenerateCBinding,GeneratePInvoke */
 
574
        LinearDoubleKeyFrame () { }
 
575
        
 
576
        virtual Type::Kind GetObjectType () { return Type::LINEARDOUBLEKEYFRAME; };
 
577
        
 
578
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
579
};
 
580
 
 
581
 
 
582
 
 
583
/* @Namespace=System.Windows.Media.Animation */
 
584
class LinearColorKeyFrame : public ColorKeyFrame {
 
585
 protected:
 
586
        virtual ~LinearColorKeyFrame () {}
 
587
        
 
588
 public:
 
589
        /* @GenerateCBinding,GeneratePInvoke */
 
590
        LinearColorKeyFrame () { }
 
591
        
 
592
        virtual Type::Kind GetObjectType () { return Type::LINEARCOLORKEYFRAME; };
 
593
        
 
594
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
595
};
 
596
 
 
597
 
 
598
 
 
599
/* @Namespace=System.Windows.Media.Animation */
 
600
class LinearPointKeyFrame : public PointKeyFrame {
 
601
 protected:
 
602
        virtual ~LinearPointKeyFrame () {}
 
603
        
 
604
 public:
 
605
        /* @GenerateCBinding,GeneratePInvoke */
 
606
        LinearPointKeyFrame () { }
 
607
        
 
608
        virtual Type::Kind GetObjectType () { return Type::LINEARPOINTKEYFRAME; };
 
609
        
 
610
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
611
};
 
612
 
 
613
 
 
614
 
 
615
/* @Namespace=System.Windows.Media.Animation */
 
616
class SplineDoubleKeyFrame : public DoubleKeyFrame {
 
617
 protected:
 
618
        virtual ~SplineDoubleKeyFrame () {}
 
619
 
 
620
 public:
 
621
        /* @PropertyType=KeySpline,GenerateAccessors */
 
622
        static DependencyProperty *KeySplineProperty;
 
623
        
 
624
        /* @GenerateCBinding,GeneratePInvoke */
 
625
        SplineDoubleKeyFrame ();
 
626
        
 
627
        virtual Type::Kind GetObjectType () { return Type::SPLINEDOUBLEKEYFRAME; };
 
628
        
 
629
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
630
        
 
631
        //
 
632
        // Property Accessors
 
633
        //
 
634
        KeySpline *GetKeySpline ();
 
635
        void SetKeySpline (KeySpline* value);
 
636
};
 
637
 
 
638
 
 
639
 
 
640
/* @Namespace=System.Windows.Media.Animation */
 
641
class SplineColorKeyFrame : public ColorKeyFrame {
 
642
 protected:
 
643
        virtual ~SplineColorKeyFrame () {}
 
644
 
 
645
 public:
 
646
        /* @PropertyType=KeySpline,GenerateAccessors */
 
647
        static DependencyProperty *KeySplineProperty;
 
648
        
 
649
        /* @GenerateCBinding,GeneratePInvoke */
 
650
        SplineColorKeyFrame ();
 
651
        
 
652
        virtual Type::Kind GetObjectType () { return Type::SPLINECOLORKEYFRAME; };
 
653
        
 
654
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
655
        
 
656
        //
 
657
        // Property Accessors
 
658
        //
 
659
        KeySpline *GetKeySpline ();
 
660
        void SetKeySpline (KeySpline* value);
 
661
};
 
662
 
 
663
 
 
664
 
 
665
/* @Namespace=System.Windows.Media.Animation */
 
666
class SplinePointKeyFrame : public PointKeyFrame {
 
667
 protected:
 
668
        virtual ~SplinePointKeyFrame () {}
 
669
        
 
670
 public:
 
671
        /* @PropertyType=KeySpline,GenerateAccessors */
 
672
        static DependencyProperty *KeySplineProperty;
 
673
        
 
674
        /* @GenerateCBinding,GeneratePInvoke */
 
675
        SplinePointKeyFrame ();
 
676
        virtual Type::Kind GetObjectType () { return Type::SPLINEPOINTKEYFRAME; };
 
677
        
 
678
        virtual Value *InterpolateValue (Value *baseValue, double keyFrameProgress);
 
679
        
 
680
        //
 
681
        // Property Accessors
 
682
        //
 
683
        KeySpline *GetKeySpline ();
 
684
        void SetKeySpline (KeySpline* value);
 
685
};
 
686
 
 
687
 
 
688
/* @Namespace=System.Windows.Media.Animation */
 
689
/* @ContentProperty="KeyFrames" */
 
690
class DoubleAnimationUsingKeyFrames : public DoubleAnimation {
 
691
 protected:
 
692
        virtual ~DoubleAnimationUsingKeyFrames ();
 
693
 
 
694
 public:
 
695
        /* @PropertyType=DoubleKeyFrameCollection,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
 
696
        static DependencyProperty *KeyFramesProperty;
 
697
        
 
698
        /* @GenerateCBinding,GeneratePInvoke */
 
699
        DoubleAnimationUsingKeyFrames ();
 
700
        
 
701
        virtual Type::Kind GetObjectType () { return Type::DOUBLEANIMATIONUSINGKEYFRAMES; };
 
702
        
 
703
        void AddKeyFrame (DoubleKeyFrame *frame);
 
704
        void RemoveKeyFrame (DoubleKeyFrame *frame);
 
705
        
 
706
        virtual Value *GetCurrentValue (Value *defaultOriginValue, Value *defaultDestinationValue,
 
707
                                        AnimationClock* animationClock);
 
708
 
 
709
        virtual void Resolve ();
 
710
 
 
711
        virtual Duration GetNaturalDurationCore (Clock* clock);
 
712
 
 
713
        virtual bool Validate ();
 
714
        
 
715
        //
 
716
        // Property Accessors
 
717
        //
 
718
        DoubleKeyFrameCollection *GetKeyFrames ();
 
719
        void SetKeyFrames (DoubleKeyFrameCollection* value);
 
720
};
 
721
 
 
722
/* @Namespace=System.Windows.Media.Animation */
 
723
/* @ContentProperty="KeyFrames" */
 
724
class ColorAnimationUsingKeyFrames : public ColorAnimation {
 
725
 protected:
 
726
        virtual ~ColorAnimationUsingKeyFrames ();
 
727
 
 
728
 public:
 
729
        /* @PropertyType=ColorKeyFrameCollection,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
 
730
        static DependencyProperty *KeyFramesProperty;
 
731
        
 
732
        /* @GenerateCBinding,GeneratePInvoke */
 
733
        ColorAnimationUsingKeyFrames ();
 
734
        
 
735
        virtual Type::Kind GetObjectType () { return Type::COLORANIMATIONUSINGKEYFRAMES; }
 
736
        
 
737
        void AddKeyFrame (ColorKeyFrame *frame);
 
738
        void RemoveKeyFrame (ColorKeyFrame *frame);
 
739
        
 
740
        virtual Value *GetCurrentValue (Value *defaultOriginValue, Value *defaultDestinationValue,
 
741
                                        AnimationClock* animationClock);
 
742
        
 
743
        virtual void Resolve ();
 
744
        
 
745
        virtual Duration GetNaturalDurationCore (Clock* clock);
 
746
        
 
747
        virtual bool Validate ();
 
748
        
 
749
        //
 
750
        // Property Accessors
 
751
        //
 
752
        ColorKeyFrameCollection *GetKeyFrames ();
 
753
        void SetKeyFrames (ColorKeyFrameCollection* value);
 
754
};
 
755
 
 
756
/* @Namespace=System.Windows.Media.Animation */
 
757
/* @ContentProperty="KeyFrames" */
 
758
class PointAnimationUsingKeyFrames : public PointAnimation {
 
759
 protected:
 
760
        virtual ~PointAnimationUsingKeyFrames ();
 
761
 
 
762
 public:
 
763
        /* @PropertyType=PointKeyFrameCollection,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
 
764
        static DependencyProperty *KeyFramesProperty;
 
765
        
 
766
        /* @GenerateCBinding,GeneratePInvoke */
 
767
        PointAnimationUsingKeyFrames ();
 
768
        
 
769
        virtual Type::Kind GetObjectType () { return Type::POINTANIMATIONUSINGKEYFRAMES; };
 
770
 
 
771
        void AddKeyFrame (PointKeyFrame *frame);
 
772
        void RemoveKeyFrame (PointKeyFrame *frame);
 
773
        
 
774
        virtual Value *GetCurrentValue (Value *defaultOriginValue, Value *defaultDestinationValue,
 
775
                                        AnimationClock *animationClock);
 
776
 
 
777
        virtual void Resolve ();
 
778
 
 
779
        virtual Duration GetNaturalDurationCore (Clock *clock);
 
780
 
 
781
        virtual bool Validate ();
 
782
        
 
783
        //
 
784
        // Property Accessors
 
785
        //
 
786
        PointKeyFrameCollection *GetKeyFrames ();
 
787
        void SetKeyFrames (PointKeyFrameCollection* value);
 
788
};
 
789
 
 
790
/* @Namespace=System.Windows.Media.Animation */
 
791
/* @ContentProperty="Children" */
 
792
class Storyboard : public ParallelTimeline {
 
793
        static void storyboard_completed (EventObject *sender, EventArgs *calldata, gpointer data);
 
794
        static gboolean storyboard_tick (gpointer data);
 
795
        
 
796
        void HookupAnimationsRecurse (Clock *clock);
 
797
        void TeardownClockGroup ();
 
798
        gboolean Tick ();
 
799
        
 
800
        Clock *root_clock;
 
801
        
 
802
 protected:
 
803
        virtual ~Storyboard ();
 
804
 
 
805
 public:
 
806
        /* @PropertyType=string,Attached,GenerateAccessors */
 
807
        static DependencyProperty *TargetNameProperty;
 
808
        /* @PropertyType=string,Attached,GenerateAccessors */
 
809
        static DependencyProperty *TargetPropertyProperty;
 
810
        
 
811
        /* @GenerateCBinding,GeneratePInvoke */
 
812
        Storyboard ();
 
813
        
 
814
        virtual Type::Kind GetObjectType () { return Type::STORYBOARD; };
 
815
        
 
816
        virtual void SetSurface (Surface *surface);
 
817
        
 
818
        /* @GenerateCBinding,GeneratePInvoke */
 
819
        bool Begin ();
 
820
        
 
821
        /* @GenerateCBinding,GeneratePInvoke */
 
822
        void Pause ();
 
823
        
 
824
        /* @GenerateCBinding,GeneratePInvoke */
 
825
        void Resume ();
 
826
        
 
827
        /* @GenerateCBinding,GeneratePInvoke */
 
828
        void Seek (TimeSpan timespan);
 
829
        
 
830
        /* @GenerateCBinding,GeneratePInvoke */
 
831
        void Stop ();
 
832
        
 
833
        // XXX event Completed
 
834
        
 
835
        static void SetTargetName (DependencyObject *o, const char *targetName);
 
836
        static const char *GetTargetName (DependencyObject *o);
 
837
        static void SetTargetProperty (DependencyObject *o, const char *targetProperty);
 
838
        static const char *GetTargetProperty (DependencyObject *o);
 
839
        
 
840
        // events you can AddHandler to
 
841
        const static int CompletedEvent;
 
842
};
 
843
 
 
844
/* @Namespace=System.Windows.Media.Animation */
 
845
/* @ContentProperty="Storyboard" */
 
846
class BeginStoryboard : public TriggerAction {
 
847
 protected:
 
848
        virtual ~BeginStoryboard ();
 
849
 
 
850
 public:
 
851
        /* @PropertyType=Storyboard,GenerateAccessors */
 
852
        static DependencyProperty *StoryboardProperty;
 
853
        
 
854
        /* @GenerateCBinding,GeneratePInvoke */
 
855
        BeginStoryboard () { }
 
856
        
 
857
        virtual Type::Kind GetObjectType () { return Type::BEGINSTORYBOARD; };
 
858
        
 
859
        virtual void Fire ();
 
860
        
 
861
        //
 
862
        // Property Accessors
 
863
        //
 
864
        void SetStoryboard (Storyboard *sb);
 
865
        Storyboard *GetStoryboard ();
 
866
};
 
867
 
 
868
G_BEGIN_DECLS
 
869
 
 
870
void animation_shutdown (void);
 
871
 
 
872
void key_spline_get_control_point_1 (KeySpline *ks, double *x, double *y);
 
873
void key_spline_set_control_point_1 (KeySpline *ks, double x, double y);
 
874
 
 
875
void key_spline_get_control_point_2 (KeySpline *ks, double *x, double *y);
 
876
void key_spline_set_control_point_2 (KeySpline *ks, double x, double y);
 
877
 
 
878
G_END_DECLS
 
879
 
 
880
#endif /* MOON_ANIMATION_H */