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 LongPressGesture_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
25 %define LongPressGesture_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
26 %typemap(cscode) NameSpace::ClassName %{
29 public class DetectedEventArgs : EventArgs
32 private LongPressGesture _longPressGesture;
46 public LongPressGesture LongPressGesture
50 return _longPressGesture;
54 _longPressGesture = value;
59 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
60 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr longPressGesture);
61 private DaliEventHandler<object,DetectedEventArgs> _longPressGestureEventHandler;
62 private DetectedCallbackDelegate _longPressGestureCallbackDelegate;
65 public event DaliEventHandler<object,DetectedEventArgs> Detected
71 // Restricted to only one listener
72 if (_longPressGestureEventHandler == null)
74 _longPressGestureEventHandler += value;
76 _longPressGestureCallbackDelegate = new DetectedCallbackDelegate(OnLongPressGestureDetected);
77 this.DetectedSignal().Connect(_longPressGestureCallbackDelegate);
86 if (_longPressGestureEventHandler != null)
88 this.DetectedSignal().Disconnect(_longPressGestureCallbackDelegate);
91 _longPressGestureEventHandler -= value;
96 private void OnLongPressGestureDetected(IntPtr actor, IntPtr longPressGesture)
98 DetectedEventArgs e = new DetectedEventArgs();
100 // Populate all members of "e" (LongPressGestureEventArgs) with real data
101 e.Actor = Actor.GetActorFromPtr(actor);
102 e.LongPressGesture = Dali.LongPressGesture.GetLongPressGestureFromPtr(longPressGesture);
104 if (_longPressGestureEventHandler != null)
106 //here we send all data to user event handlers
107 _longPressGestureEventHandler(this, e);
113 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
114 ClassName ret = new ClassName(cPtr, false);
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 %define DALI_longPressGesture_EVENTHANDLER_PARAM( NameSpace, ClassName)
125 LongPressGesture_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
126 LongPressGesture_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
132 DALI_longPressGesture_EVENTHANDLER_PARAM( Dali, LongPressGestureDetector);