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 RenderTask_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
27 %define RenderTask_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
28 %typemap(cscode) NameSpace::ClassName %{
31 public class FinishedEventArgs : EventArgs
33 private RenderTask _renderTask;
35 public RenderTask RenderTask
48 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
49 private delegate void RenderTaskCallbackDelegate(IntPtr renderTask);
50 private DaliEventHandler<object,FinishedEventArgs> _renderTaskEventHandler;
51 private RenderTaskCallbackDelegate _renderTaskCallbackDelegate;
54 public event DaliEventHandler<object,FinishedEventArgs> Finished
60 // Restricted to only one listener
61 if (_renderTaskEventHandler == null)
63 _renderTaskEventHandler += value;
65 _renderTaskCallbackDelegate = new RenderTaskCallbackDelegate(OnFinished);
66 this.FinishedSignal().Connect(_renderTaskCallbackDelegate);
75 if (_renderTaskEventHandler != null)
77 this.FinishedSignal().Disconnect(_renderTaskCallbackDelegate);
80 _renderTaskEventHandler -= value;
85 private void OnFinished(IntPtr actor, IntPtr renderTask)
87 FinishedEventArgs e = new FinishedEventArgs();
89 // Populate all members of "e" (FinishedEventArgs) with real data
90 e.RenderTask = Dali.RenderTask.GetRenderTaskFromPtr(renderTask);
92 if (_renderTaskEventHandler != null)
94 //here we send all data to user event handlers
95 _renderTaskEventHandler(this, e);
101 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
102 ClassName ret = new ClassName(cPtr, false);
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111 %define DALI_renderTask_EVENTHANDLER_PARAM( NameSpace, ClassName)
113 RenderTask_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
114 RenderTask_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
120 DALI_renderTask_EVENTHANDLER_PARAM( Dali, RenderTask);