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 TapGesture_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
26 %define TapGesture_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
27 %typemap(cscode) NameSpace::ClassName %{
30 public class DetectedEventArgs : EventArgs
33 private TapGesture _tapGesture;
47 public TapGesture TapGesture
60 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
61 public delegate void DetectedEventHandler(object source, DetectedEventArgs e);
63 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
64 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
65 private DetectedEventHandler _tapGestureEventHandler;
66 private DetectedCallbackDelegate _tapGestureCallbackDelegate;
69 public event DetectedEventHandler Detected
75 // Restricted to only one listener
76 if (_tapGestureEventHandler == null)
78 _tapGestureEventHandler += value;
80 _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
81 this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
90 if (_tapGestureEventHandler != null)
92 this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
95 _tapGestureEventHandler -= value;
100 private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
102 DetectedEventArgs e = new DetectedEventArgs();
104 // Populate all members of "e" (DetectedEventArgs) with real data
105 e.Actor = Actor.GetActorFromPtr(actor);
106 e.TapGesture = Dali.TapGesture.GetTapGestureFromPtr(tapGesture);
108 if (_tapGestureEventHandler != null)
110 //here we send all data to user event handlers
111 _tapGestureEventHandler(this, e);
117 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
118 ClassName ret = new ClassName(cPtr, false);
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127 %define DALI_tapGesture_EVENTHANDLER_PARAM( NameSpace, ClassName)
129 TapGesture_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
130 TapGesture_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
136 DALI_tapGesture_EVENTHANDLER_PARAM( Dali, TapGestureDetector);