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 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr panGesture);
63 private DaliEventHandler<object,DetectedEventArgs> _panGestureEventHandler;
64 private DetectedCallbackDelegate _panGestureCallbackDelegate;
67 public event DaliEventHandler<object,DetectedEventArgs> Detected
73 // Restricted to only one listener
74 if (_panGestureEventHandler == null)
76 _panGestureEventHandler += value;
78 _panGestureCallbackDelegate = new DetectedCallbackDelegate(OnPanGestureDetected);
79 this.DetectedSignal().Connect(_panGestureCallbackDelegate);
88 if (_panGestureEventHandler != null)
90 this.DetectedSignal().Disconnect(_panGestureCallbackDelegate);
93 _panGestureEventHandler -= value;
98 private void OnPanGestureDetected(IntPtr actor, IntPtr panGesture)
100 DetectedEventArgs e = new DetectedEventArgs();
102 // Populate all members of "e" (PanGestureEventArgs) with real data
103 e.Actor = Actor.GetActorFromPtr(actor);
104 e.PanGesture = Dali.PanGesture.GetPanGestureFromPtr(panGesture);
106 if (_panGestureEventHandler != null)
108 //here we send all data to user event handlers
109 _panGestureEventHandler(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();
125 %define DALI_PANGESTURE_EVENTHANDLER_PARAM( NameSpace, ClassName)
127 PANGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
128 PANGESTURE_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
134 DALI_PANGESTURE_EVENTHANDLER_PARAM( Dali, PanGestureDetector);