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 PANGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
27 %define PANGESTURE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
28 %typemap(cscode) NameSpace::ClassName %{
31 public class DetectedEventArgs : EventArgs
34 private PanGesture _panGesture;
48 public PanGesture PanGesture
61 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
62 public delegate void DetectedEventHandler(object source, DetectedEventArgs e);
64 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
65 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr panGesture);
66 private DetectedEventHandler _panGestureEventHandler;
67 private DetectedCallbackDelegate _panGestureCallbackDelegate;
70 public event DetectedEventHandler Detected
76 // Restricted to only one listener
77 if (_panGestureEventHandler == null)
79 _panGestureEventHandler += value;
81 _panGestureCallbackDelegate = new DetectedCallbackDelegate(OnPanGestureDetected);
82 this.DetectedSignal().Connect(_panGestureCallbackDelegate);
91 if (_panGestureEventHandler != null)
93 this.DetectedSignal().Disconnect(_panGestureCallbackDelegate);
96 _panGestureEventHandler -= value;
101 private void OnPanGestureDetected(IntPtr actor, IntPtr panGesture)
103 DetectedEventArgs e = new DetectedEventArgs();
105 // Populate all members of "e" (PanGestureEventArgs) with real data
106 e.Actor = Actor.GetActorFromPtr(actor);
107 e.PanGesture = Dali.PanGesture.GetPanGestureFromPtr(panGesture);
109 if (_panGestureEventHandler != null)
111 //here we send all data to user event handlers
112 _panGestureEventHandler(this, e);
118 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
119 ClassName ret = new ClassName(cPtr, false);
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 %define DALI_PANGESTURE_EVENTHANDLER_PARAM( NameSpace, ClassName)
130 PANGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
131 PANGESTURE_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
137 DALI_PANGESTURE_EVENTHANDLER_PARAM( Dali, PanGestureDetector);