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 POPUP_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
28 %define POPUP_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
29 %typemap(cscode) NameSpace::ClassName %{
31 public class OutsideTouchedEventArgs : EventArgs
35 public class ShowingEventArgs : EventArgs
39 public class ShownEventArgs : EventArgs
43 public class HidingEventArgs : EventArgs
47 public class HiddenEventArgs : EventArgs
51 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
52 public delegate void OutsideTouchedEventHandler(object source, OutsideTouchedEventArgs e);
54 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
55 public delegate void ShowingEventHandler(object source, ShowingEventArgs e);
57 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
58 public delegate void ShownEventHandler(object source, ShownEventArgs e);
60 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
61 public delegate void HidingEventHandler(object source, HidingEventArgs e);
63 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
64 public delegate void HiddenEventHandler(object source, HiddenEventArgs e);
66 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
67 private delegate void OutsideTouchedEventCallbackDelegate();
68 private OutsideTouchedEventHandler _popUpOutsideTouchedEventHandler;
69 private OutsideTouchedEventCallbackDelegate _popUpOutsideTouchedEventCallbackDelegate;
71 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
72 private delegate void ShowingEventCallbackDelegate();
73 private ShowingEventHandler _popUpShowingEventHandler;
74 private ShowingEventCallbackDelegate _popUpShowingEventCallbackDelegate;
76 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
77 private delegate void ShownEventCallbackDelegate();
78 private ShownEventHandler _popUpShownEventHandler;
79 private ShownEventCallbackDelegate _popUpShownEventCallbackDelegate;
81 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
82 private delegate void HidingEventCallbackDelegate();
83 private HidingEventHandler _popUpHidingEventHandler;
84 private HidingEventCallbackDelegate _popUpHidingEventCallbackDelegate;
86 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
87 private delegate void HiddenEventCallbackDelegate();
88 private HiddenEventHandler _popUpHiddenEventHandler;
89 private HiddenEventCallbackDelegate _popUpHiddenEventCallbackDelegate;
91 public event OutsideTouchedEventHandler OutsideTouched
97 // Restricted to only one listener
98 if (_popUpOutsideTouchedEventHandler == null)
100 _popUpOutsideTouchedEventHandler += value;
102 _popUpOutsideTouchedEventCallbackDelegate = new OutsideTouchedEventCallbackDelegate(OnOutsideTouched);
103 this.OutsideTouchedSignal().Connect(_popUpOutsideTouchedEventCallbackDelegate);
112 if (_popUpOutsideTouchedEventHandler != null)
114 this.OutsideTouchedSignal().Disconnect(_popUpOutsideTouchedEventCallbackDelegate);
117 _popUpOutsideTouchedEventHandler -= value;
122 // Callback for Popup OutsideTouchedSignal
123 private void OnOutsideTouched()
125 OutsideTouchedEventArgs e = new OutsideTouchedEventArgs();
127 if (_popUpOutsideTouchedEventHandler != null)
129 //here we send all data to user event handlers
130 _popUpOutsideTouchedEventHandler(this, e);
134 public event ShowingEventHandler Showing
140 // Restricted to only one listener
141 if (_popUpShowingEventHandler == null)
143 _popUpShowingEventHandler += value;
145 _popUpShowingEventCallbackDelegate = new ShowingEventCallbackDelegate(OnShowing);
146 this.ShowingSignal().Connect(_popUpShowingEventCallbackDelegate);
155 if (_popUpShowingEventHandler != null)
157 this.ShowingSignal().Disconnect(_popUpShowingEventCallbackDelegate);
160 _popUpShowingEventHandler -= value;
165 // Callback for ShowingSignal
166 private void OnShowing()
168 ShowingEventArgs e = new ShowingEventArgs();
170 if (_popUpShowingEventHandler != null)
172 //here we send all data to user event handlers
173 _popUpShowingEventHandler(this, e);
178 public event ShownEventHandler Shown
184 // Restricted to only one listener
185 if (_popUpShownEventHandler == null)
187 _popUpShownEventHandler += value;
189 _popUpShownEventCallbackDelegate = new ShownEventCallbackDelegate(OnShown);
190 this.ShownSignal().Connect(_popUpShownEventCallbackDelegate);
199 if (_popUpShownEventHandler != null)
201 this.ShownSignal().Disconnect(_popUpShownEventCallbackDelegate);
204 _popUpShownEventHandler -= value;
209 // Callback for ShownSignal
210 private void OnShown()
212 ShownEventArgs e = new ShownEventArgs();
214 if (_popUpShownEventHandler != null)
216 //here we send all data to user event handlers
217 _popUpShownEventHandler(this, e);
221 public event HidingEventHandler Hiding
227 // Restricted to only one listener
228 if (_popUpHidingEventHandler == null)
230 _popUpHidingEventHandler += value;
232 _popUpHidingEventCallbackDelegate = new HidingEventCallbackDelegate(OnHiding);
233 this.HidingSignal().Connect(_popUpHidingEventCallbackDelegate);
242 if (_popUpHidingEventHandler != null)
244 this.HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate);
247 _popUpHidingEventHandler -= value;
252 // Callback for HidingSignal
253 private void OnHiding()
255 HidingEventArgs e = new HidingEventArgs();
257 if (_popUpHidingEventHandler != null)
259 //here we send all data to user event handlers
260 _popUpHidingEventHandler(this, e);
264 public event HiddenEventHandler Hidden
270 // Restricted to only one listener
271 if (_popUpHiddenEventHandler == null)
273 _popUpHiddenEventHandler += value;
275 _popUpHiddenEventCallbackDelegate = new HiddenEventCallbackDelegate(OnHidden);
276 this.HiddenSignal().Connect(_popUpHiddenEventCallbackDelegate);
285 if (_popUpHiddenEventHandler != null)
287 this.HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate);
290 _popUpHiddenEventHandler -= value;
295 // Callback for HiddenSignal
296 private void OnHidden()
298 HiddenEventArgs e = new HiddenEventArgs();
300 if (_popUpHiddenEventHandler != null)
302 //here we send all data to user event handlers
303 _popUpHiddenEventHandler(this, e);
309 %define DALI_POPUP_EVENTHANDLER_PARAM( NameSpace, ClassName)
310 POPUP_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
311 POPUP_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
316 DALI_POPUP_EVENTHANDLER_PARAM( Dali::Toolkit, Popup);