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 PINCHGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
27 %define PINCHGESTURE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
28 %typemap(cscode) NameSpace::ClassName %{
30 public class DetectedEventArgs : EventArgs
33 private PinchGesture _pinchGesture;
47 public PinchGesture PinchGesture
55 _pinchGesture = value;
60 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
61 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr pinchGesture);
62 private DaliEventHandler<object,DetectedEventArgs> _pinchGestureEventHandler;
63 private DetectedCallbackDelegate _pinchGestureCallbackDelegate;
66 public event DaliEventHandler<object,DetectedEventArgs> Detected
72 // Restricted to only one listener
73 if (_pinchGestureEventHandler == null)
75 _pinchGestureEventHandler += value;
77 _pinchGestureCallbackDelegate = new DetectedCallbackDelegate(OnPinchGestureDetected);
78 this.DetectedSignal().Connect(_pinchGestureCallbackDelegate);
87 if (_pinchGestureEventHandler != null)
89 this.DetectedSignal().Disconnect(_pinchGestureCallbackDelegate);
92 _pinchGestureEventHandler -= value;
97 private void OnPinchGestureDetected(IntPtr actor, IntPtr pinchGesture)
99 DetectedEventArgs e = new DetectedEventArgs();
101 // Populate all members of "e" (DetectedEventArgs) with real data
102 e.Actor = Actor.GetActorFromPtr(actor);
103 e.PinchGesture = Dali.PinchGesture.GetPinchGestureFromPtr(pinchGesture);
105 if (_pinchGestureEventHandler != null)
107 //here we send all data to user event handlers
108 _pinchGestureEventHandler(this, e);
114 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
115 ClassName ret = new ClassName(cPtr, false);
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 %define DALI_PINCHGESTURE_EVENTHANDLER_PARAM( NameSpace, ClassName)
126 PINCHGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
127 PINCHGESTURE_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
133 DALI_PINCHGESTURE_EVENTHANDLER_PARAM( Dali, PinchGestureDetector);