2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 %define Animation_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
26 %define Animation_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
27 %typemap(cscode) NameSpace::ClassName %{
29 public static readonly int ParentOrigin = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_get();
30 public static readonly int ParentOriginX = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_X_get();
31 public static readonly int ParentOriginY = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Y_get();
32 public static readonly int ParentOriginZ = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Z_get();
33 public static readonly int AnchorPoint = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_get();
34 public static readonly int AnchorPointX = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_X_get();
35 public static readonly int AnchorPointY = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Y_get();
36 public static readonly int AnchorPointZ = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Z_get();
37 public static readonly int Size = NDalicPINVOKE.Actor_Property_SIZE_get();
38 public static readonly int SizeWidth = NDalicPINVOKE.Actor_Property_SIZE_WIDTH_get();
39 public static readonly int SizeHeight = NDalicPINVOKE.Actor_Property_SIZE_HEIGHT_get();
40 public static readonly int SizeDepth = NDalicPINVOKE.Actor_Property_SIZE_DEPTH_get();
41 public static readonly int Position = NDalicPINVOKE.Actor_Property_POSITION_get();
42 public static readonly int PositionX = NDalicPINVOKE.Actor_Property_POSITION_X_get();
43 public static readonly int PositionY = NDalicPINVOKE.Actor_Property_POSITION_Y_get();
44 public static readonly int PositionZ = NDalicPINVOKE.Actor_Property_POSITION_Z_get();
45 public static readonly int WorldPosition = NDalicPINVOKE.Actor_Property_WORLD_POSITION_get();
46 public static readonly int WorldPositionX = NDalicPINVOKE.Actor_Property_WORLD_POSITION_X_get();
47 public static readonly int WorldPositionY = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Y_get();
48 public static readonly int WorldPositionZ = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Z_get();
49 public static readonly int Orientation = NDalicPINVOKE.Actor_Property_ORIENTATION_get();
50 public static readonly int WorldOrientation = NDalicPINVOKE.Actor_Property_WORLD_ORIENTATION_get();
51 public static readonly int Scale = NDalicPINVOKE.Actor_Property_SCALE_get();
52 public static readonly int ScaleX = NDalicPINVOKE.Actor_Property_SCALE_X_get();
53 public static readonly int ScaleY = NDalicPINVOKE.Actor_Property_SCALE_Y_get();
54 public static readonly int ScaleZ = NDalicPINVOKE.Actor_Property_SCALE_Z_get();
55 public static readonly int WorldScale = NDalicPINVOKE.Actor_Property_WORLD_SCALE_get();
56 public static readonly int Visibile = NDalicPINVOKE.Actor_Property_VISIBLE_get();
57 public static readonly int Color = NDalicPINVOKE.Actor_Property_COLOR_get();
58 public static readonly int ColorRed = NDalicPINVOKE.Actor_Property_COLOR_RED_get();
59 public static readonly int ColorGreeb = NDalicPINVOKE.Actor_Property_COLOR_GREEN_get();
60 public static readonly int ColorBlue = NDalicPINVOKE.Actor_Property_COLOR_BLUE_get();
61 public static readonly int ColorAlpha = NDalicPINVOKE.Actor_Property_COLOR_ALPHA_get();
62 public static readonly int WorldColor = NDalicPINVOKE.Actor_Property_WORLD_COLOR_get();
63 public static readonly int WorldMatrix = NDalicPINVOKE.Actor_Property_WORLD_MATRIX_get();
64 public static readonly int Name = NDalicPINVOKE.Actor_Property_NAME_get();
65 public static readonly int Sensitive = NDalicPINVOKE.Actor_Property_SENSITIVE_get();
66 public static readonly int LeaveRequired = NDalicPINVOKE.Actor_Property_LEAVE_REQUIRED_get();
67 public static readonly int InheritOrientation = NDalicPINVOKE.Actor_Property_INHERIT_ORIENTATION_get();
68 public static readonly int InheritScale = NDalicPINVOKE.Actor_Property_INHERIT_SCALE_get();
69 public static readonly int ColorMode = NDalicPINVOKE.Actor_Property_COLOR_MODE_get();
70 public static readonly int PositionInheritance = NDalicPINVOKE.Actor_Property_POSITION_INHERITANCE_get();
71 public static readonly int DrawMode = NDalicPINVOKE.Actor_Property_DRAW_MODE_get();
72 public static readonly int SizeModeFactor = NDalicPINVOKE.Actor_Property_SIZE_MODE_FACTOR_get();
73 public static readonly int WidthResizePolicy = NDalicPINVOKE.Actor_Property_WIDTH_RESIZE_POLICY_get();
74 public static readonly int HeightResizePolicy = NDalicPINVOKE.Actor_Property_HEIGHT_RESIZE_POLICY_get();
75 public static readonly int SizeScalePolicy = NDalicPINVOKE.Actor_Property_SIZE_SCALE_POLICY_get();
76 public static readonly int WidthForHeight = NDalicPINVOKE.Actor_Property_WIDTH_FOR_HEIGHT_get();
77 public static readonly int HeightForWidth = NDalicPINVOKE.Actor_Property_HEIGHT_FOR_WIDTH_get();
78 public static readonly int Padding = NDalicPINVOKE.Actor_Property_PADDING_get();
79 public static readonly int MinimumSize = NDalicPINVOKE.Actor_Property_MINIMUM_SIZE_get();
80 public static readonly int MaximumSize = NDalicPINVOKE.Actor_Property_MAXIMUM_SIZE_get();
81 public static readonly int InheritPosition = NDalicPINVOKE.Actor_Property_INHERIT_POSITION_get();
82 public static readonly int ClippingMode = NDalicPINVOKE.Actor_Property_CLIPPING_MODE_get();
85 * @brief Event arguments that passed via Finished signal
88 public class FinishedEventArgs : EventArgs
90 private Animation _animation;
93 * @brief Animation - is the Animation which has finished with the animation.
96 public Animation Animation
109 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
110 private delegate void FinishedEventCallbackDelegate(IntPtr Animation);
111 private DaliEventHandler<object,FinishedEventArgs> _animationFinishedEventHandler;
112 private FinishedEventCallbackDelegate _animationFinishedEventCallbackDelegate;
115 * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler
116 * (in the type of FinishedEventHandler - DaliEventHandler<object,FinishedEventArgs>) provided by the user.
117 * Finished signal is emitted when an Animation's animations have finished.
119 public event DaliEventHandler<object,FinishedEventArgs> Finished
125 // Restricted to only one listener
126 if (_animationFinishedEventHandler == null)
128 _animationFinishedEventHandler += value;
130 _animationFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
131 this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate);
140 if (_animationFinishedEventHandler != null)
142 this.FinishedSignal().Disconnect(_animationFinishedEventCallbackDelegate);
145 _animationFinishedEventHandler -= value;
150 // Callback for Animation FinishedSignal
151 private void OnFinished(IntPtr data)
153 FinishedEventArgs e = new FinishedEventArgs();
155 // Populate all members of "e" (FinishedEventArgs) with real data
156 e.Animation = Animation.GetAnimationFromPtr(data);
158 if (_animationFinishedEventHandler != null)
160 //here we send all data to user event handlers
161 _animationFinishedEventHandler(this, e);
166 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
167 ClassName ret = new ClassName(cPtr, false);
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 public float Duration
181 float ret = GetDuration();
186 public int DurationMilliSecs
190 SetDuration(value/1000);
194 int ret = (int) GetDuration() * 1000;
199 public AlphaFunction DefaultAlphaFunction
203 SetDefaultAlphaFunction(value);
207 AlphaFunction ret = GetDefaultAlphaFunction();
212 public Animation.State Status
216 Animation.State ret = GetState();
229 int ret = GetLoopCount();
242 bool ret = IsLooping();
247 public void AnimateBy<T,U>(Actor target, T propertyIndex, U relativeValue)
249 dynamic var = (object)(propertyIndex);
250 dynamic obj = (object)(relativeValue);
251 AnimateBy(new Property(target, var), new Property.Value(obj));
254 public void AnimateBy<T,U>(Actor target, T propertyIndex, U relativeValue, AlphaFunction alpha)
256 dynamic var = (object)(propertyIndex);
257 dynamic obj = (object)(relativeValue);
258 AnimateBy(new Property(target, var), new Property.Value(obj), alpha);
261 public void AnimateBy<T,U>(Actor target, T propertyIndex, U relativeValue, TimePeriod period)
263 dynamic var = (object)(propertyIndex);
264 dynamic obj = (object)(relativeValue);
265 AnimateBy(new Property(target, var), new Property.Value(obj), period);
268 public void AnimateBy<T,U>(Actor target, T propertyIndex, U relativeValue, AlphaFunction alpha, TimePeriod period)
270 dynamic var = (object)(propertyIndex);
271 dynamic obj = (object)(relativeValue);
272 AnimateBy(new Property(target, var), new Property.Value(obj), alpha, period);
275 public void AnimateTo<T,U>(Actor target, T propertyIndex, U destinationValue)
277 dynamic var = (object)(propertyIndex);
278 dynamic obj = (object)(destinationValue);
279 AnimateTo(new Property(target, var), new Property.Value(obj));
282 public void AnimateTo<T,U>(Actor target, T propertyIndex, U destinationValue, AlphaFunction alpha)
284 dynamic var = (object)(propertyIndex);
285 dynamic obj = (object)(destinationValue);
286 AnimateTo(new Property(target, var), new Property.Value(obj), alpha);
289 public void AnimateTo<T,U>(Actor target, T propertyIndex, U destinationValue, TimePeriod period)
291 dynamic var = (object)(propertyIndex);
292 dynamic obj = (object)(destinationValue);
293 AnimateTo(new Property(target, var), new Property.Value(obj), period);
296 public void AnimateTo<T,U>(Actor target, T propertyIndex, U destinationValue, AlphaFunction alpha, TimePeriod period)
298 dynamic var = (object)(propertyIndex);
299 dynamic obj = (object)(destinationValue);
300 AnimateTo(new Property(target, var), new Property.Value(obj), alpha, period);
303 public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames)
305 dynamic var = (object)(propertyIndex);
306 AnimateBetween(new Property(target, var), keyFrames);
309 public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, Animation.Interpolation interpolation)
311 dynamic var = (object)(propertyIndex);
312 AnimateBetween(new Property(target, var), keyFrames, interpolation);
315 public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha)
317 dynamic var = (object)(propertyIndex);
318 AnimateBetween(new Property(target, var), keyFrames, alpha);
321 public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
323 dynamic var = (object)(propertyIndex);
324 AnimateBetween(new Property(target, var), keyFrames, alpha, interpolation);
327 public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period)
329 dynamic var = (object)(propertyIndex);
330 AnimateBetween(new Property(target, var), keyFrames, period);
333 public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
335 dynamic var = (object)(propertyIndex);
336 AnimateBetween(new Property(target, var), keyFrames, period, interpolation);
339 public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
341 dynamic var = (object)(propertyIndex);
342 AnimateBetween(new Property(target, var), keyFrames, alpha, period);
345 public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
347 dynamic var = (object)(propertyIndex);
348 AnimateBetween(new Property(target, var), keyFrames, alpha, period, interpolation);
351 public void Stop(Animation.EndAction action) {
352 SetEndAction(action);
353 NDalicPINVOKE.Animation_Stop(swigCPtr);
354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
358 * @brief Create an initialized Animation.
360 * The animation will not loop.
361 * The default end action is "Bake".
362 * The default Alpha function is linear.
364 * @param [in] durationmSeconds The duration in milli seconds (int).
365 * @return A handle to a newly allocated Dali resource.
366 * @pre DurationmSeconds must be greater than zero.
368 public Animation (int durationmSeconds) : this (NDalicPINVOKE.Animation_New((float)durationmSeconds/1000.0f), true) {
369 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
376 %define DALI_animation_EVENTHANDLER_PARAM( NameSpace, ClassName)
377 Animation_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
378 Animation_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
383 DALI_animation_EVENTHANDLER_PARAM( Dali, Animation);