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 %{
31 * @brief Event arguments that passed via Finished signal
34 public class FinishedEventArgs : EventArgs
36 private Animation _animation;
39 * @brief Animation - is the Animation which has finished with the animation.
42 public Animation Animation
55 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
56 public delegate void FinishedEventHandler(object source, FinishedEventArgs e);
58 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
59 private delegate void FinishedEventCallbackDelegate(IntPtr Animation);
60 private FinishedEventHandler _animationFinishedEventHandler;
61 private FinishedEventCallbackDelegate _animationFinishedEventCallbackDelegate;
64 * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler
65 * (in the type of FinishedEventHandler) provided by the user.
66 * Finished signal is emitted when an Animation's animations have finished.
68 public event FinishedEventHandler Finished
74 // Restricted to only one listener
75 if (_animationFinishedEventHandler == null)
77 _animationFinishedEventHandler += value;
79 _animationFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
80 this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate);
89 if (_animationFinishedEventHandler != null)
91 this.FinishedSignal().Disconnect(_animationFinishedEventCallbackDelegate);
94 _animationFinishedEventHandler -= value;
99 // Callback for Animation FinishedSignal
100 private void OnFinished(IntPtr data)
102 FinishedEventArgs e = new FinishedEventArgs();
104 // Populate all members of "e" (FinishedEventArgs) with real data
105 e.Animation = Animation.GetAnimationFromPtr(data);
107 if (_animationFinishedEventHandler != null)
109 //here we send all data to user event handlers
110 _animationFinishedEventHandler(this, e);
115 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
116 ClassName ret = new ClassName(cPtr, false);
117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 %define DALI_animation_EVENTHANDLER_PARAM( NameSpace, ClassName)
127 Animation_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
128 Animation_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
133 DALI_animation_EVENTHANDLER_PARAM( Dali, Animation);