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 private delegate void FinishedEventCallbackDelegate(IntPtr Animation);
56 private DaliEventHandler<object,FinishedEventArgs> _animationFinishedEventHandler;
57 private FinishedEventCallbackDelegate _animationFinishedEventCallbackDelegate;
60 * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler
61 * (in the type of FinishedEventHandler - DaliEventHandler<object,FinishedEventArgs>) provided by the user.
62 * Finished signal is emitted when an Animation's animations have finished.
64 public event DaliEventHandler<object,FinishedEventArgs> Finished
70 // Restricted to only one listener
71 if (_animationFinishedEventHandler == null)
73 _animationFinishedEventHandler += value;
75 _animationFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
76 this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate);
85 if (_animationFinishedEventHandler != null)
87 this.FinishedSignal().Disconnect(_animationFinishedEventCallbackDelegate);
90 _animationFinishedEventHandler -= value;
95 // Callback for Animation FinishedSignal
96 private void OnFinished(IntPtr data)
98 FinishedEventArgs e = new FinishedEventArgs();
100 // Populate all members of "e" (FinishedEventArgs) with real data
101 e.Animation = Animation.GetAnimationFromPtr(data);
103 if (_animationFinishedEventHandler != null)
105 //here we send all data to user event handlers
106 _animationFinishedEventHandler(this, e);
111 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
112 ClassName ret = new ClassName(cPtr, false);
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 public float Duration
126 float ret = GetDuration();
131 public AlphaFunction DefaultAlphaFunction
135 SetDefaultAlphaFunction(value);
139 AlphaFunction ret = GetDefaultAlphaFunction();
144 public Animation.State Status
148 Animation.State ret = GetState();
158 %define DALI_animation_EVENTHANDLER_PARAM( NameSpace, ClassName)
159 Animation_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
160 Animation_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
165 DALI_animation_EVENTHANDLER_PARAM( Dali, Animation);