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 %{
30 * @brief Event arguments that passed via Finished signal
33 public class FinishedEventArgs : EventArgs
35 private Animation _animation;
38 * @brief Animation - is the Animation which has finished with the animation.
41 public Animation Animation
54 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
55 public delegate void FinishedEventHandler(object source, FinishedEventArgs e);
57 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
58 private delegate void FinishedEventCallbackDelegate(IntPtr Animation);
59 private FinishedEventHandler _animationFinishedEventHandler;
60 private FinishedEventCallbackDelegate _animationFinishedEventCallbackDelegate;
63 * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler
64 * (in the type of FinishedEventHandler) provided by the user.
65 * Finished signal is emitted when an Animation's animations have finished.
67 public event FinishedEventHandler Finished
73 // Restricted to only one listener
74 if (_animationFinishedEventHandler == null)
76 _animationFinishedEventHandler += value;
78 _animationFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
79 this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate);
88 if (_animationFinishedEventHandler != null)
90 this.FinishedSignal().Disconnect(_animationFinishedEventCallbackDelegate);
93 _animationFinishedEventHandler -= value;
98 // Callback for Animation FinishedSignal
99 private void OnFinished(IntPtr data)
101 FinishedEventArgs e = new FinishedEventArgs();
103 // Populate all members of "e" (FinishedEventArgs) with real data
104 e.Animation = Animation.GetAnimationFromPtr(data);
106 if (_animationFinishedEventHandler != null)
108 //here we send all data to user event handlers
109 _animationFinishedEventHandler(this, e);
114 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
115 ClassName ret = new ClassName(cPtr, false);
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 public float Duration
129 float ret = GetDuration();
134 public AlphaFunction DefaultAlphaFunction
138 SetDefaultAlphaFunction(value);
142 AlphaFunction ret = GetDefaultAlphaFunction();
147 public Animation.State Status
151 Animation.State ret = GetState();
161 %define DALI_animation_EVENTHANDLER_PARAM( NameSpace, ClassName)
162 Animation_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
163 Animation_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
168 DALI_animation_EVENTHANDLER_PARAM( Dali, Animation);