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 private delegate void OutsideTouchedEventCallbackDelegate();
53 private DaliEventHandler<object,OutsideTouchedEventArgs> _popUpOutsideTouchedEventHandler;
54 private OutsideTouchedEventCallbackDelegate _popUpOutsideTouchedEventCallbackDelegate;
56 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
57 private delegate void ShowingEventCallbackDelegate();
58 private DaliEventHandler<object,ShowingEventArgs> _popUpShowingEventHandler;
59 private ShowingEventCallbackDelegate _popUpShowingEventCallbackDelegate;
61 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
62 private delegate void ShownEventCallbackDelegate();
63 private DaliEventHandler<object,ShownEventArgs> _popUpShownEventHandler;
64 private ShownEventCallbackDelegate _popUpShownEventCallbackDelegate;
66 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
67 private delegate void HidingEventCallbackDelegate();
68 private DaliEventHandler<object,HidingEventArgs> _popUpHidingEventHandler;
69 private HidingEventCallbackDelegate _popUpHidingEventCallbackDelegate;
71 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
72 private delegate void HiddenEventCallbackDelegate();
73 private DaliEventHandler<object,HiddenEventArgs> _popUpHiddenEventHandler;
74 private HiddenEventCallbackDelegate _popUpHiddenEventCallbackDelegate;
76 public event DaliEventHandler<object,OutsideTouchedEventArgs> OutsideTouched
82 // Restricted to only one listener
83 if (_popUpOutsideTouchedEventHandler == null)
85 _popUpOutsideTouchedEventHandler += value;
87 _popUpOutsideTouchedEventCallbackDelegate = new OutsideTouchedEventCallbackDelegate(OnOutsideTouched);
88 this.OutsideTouchedSignal().Connect(_popUpOutsideTouchedEventCallbackDelegate);
97 if (_popUpOutsideTouchedEventHandler != null)
99 this.OutsideTouchedSignal().Disconnect(_popUpOutsideTouchedEventCallbackDelegate);
102 _popUpOutsideTouchedEventHandler -= value;
107 // Callback for Popup OutsideTouchedSignal
108 private void OnOutsideTouched()
110 OutsideTouchedEventArgs e = new OutsideTouchedEventArgs();
112 if (_popUpOutsideTouchedEventHandler != null)
114 //here we send all data to user event handlers
115 _popUpOutsideTouchedEventHandler(this, e);
119 public event DaliEventHandler<object,ShowingEventArgs> Showing
125 // Restricted to only one listener
126 if (_popUpShowingEventHandler == null)
128 _popUpShowingEventHandler += value;
130 _popUpShowingEventCallbackDelegate = new ShowingEventCallbackDelegate(OnShowing);
131 this.ShowingSignal().Connect(_popUpShowingEventCallbackDelegate);
140 if (_popUpShowingEventHandler != null)
142 this.ShowingSignal().Disconnect(_popUpShowingEventCallbackDelegate);
145 _popUpShowingEventHandler -= value;
150 // Callback for ShowingSignal
151 private void OnShowing()
153 ShowingEventArgs e = new ShowingEventArgs();
155 if (_popUpShowingEventHandler != null)
157 //here we send all data to user event handlers
158 _popUpShowingEventHandler(this, e);
163 public event DaliEventHandler<object,ShownEventArgs> Shown
169 // Restricted to only one listener
170 if (_popUpShownEventHandler == null)
172 _popUpShownEventHandler += value;
174 _popUpShownEventCallbackDelegate = new ShownEventCallbackDelegate(OnShown);
175 this.ShownSignal().Connect(_popUpShownEventCallbackDelegate);
184 if (_popUpShownEventHandler != null)
186 this.ShownSignal().Disconnect(_popUpShownEventCallbackDelegate);
189 _popUpShownEventHandler -= value;
194 // Callback for ShownSignal
195 private void OnShown()
197 ShownEventArgs e = new ShownEventArgs();
199 if (_popUpShownEventHandler != null)
201 //here we send all data to user event handlers
202 _popUpShownEventHandler(this, e);
206 public event DaliEventHandler<object,HidingEventArgs> Hiding
212 // Restricted to only one listener
213 if (_popUpHidingEventHandler == null)
215 _popUpHidingEventHandler += value;
217 _popUpHidingEventCallbackDelegate = new HidingEventCallbackDelegate(OnHiding);
218 this.HidingSignal().Connect(_popUpHidingEventCallbackDelegate);
227 if (_popUpHidingEventHandler != null)
229 this.HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate);
232 _popUpHidingEventHandler -= value;
237 // Callback for HidingSignal
238 private void OnHiding()
240 HidingEventArgs e = new HidingEventArgs();
242 if (_popUpHidingEventHandler != null)
244 //here we send all data to user event handlers
245 _popUpHidingEventHandler(this, e);
249 public event DaliEventHandler<object,HiddenEventArgs> Hidden
255 // Restricted to only one listener
256 if (_popUpHiddenEventHandler == null)
258 _popUpHiddenEventHandler += value;
260 _popUpHiddenEventCallbackDelegate = new HiddenEventCallbackDelegate(OnHidden);
261 this.HiddenSignal().Connect(_popUpHiddenEventCallbackDelegate);
270 if (_popUpHiddenEventHandler != null)
272 this.HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate);
275 _popUpHiddenEventHandler -= value;
280 // Callback for HiddenSignal
281 private void OnHidden()
283 HiddenEventArgs e = new HiddenEventArgs();
285 if (_popUpHiddenEventHandler != null)
287 //here we send all data to user event handlers
288 _popUpHiddenEventHandler(this, e);
294 %define DALI_POPUP_EVENTHANDLER_PARAM( NameSpace, ClassName)
295 POPUP_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
296 POPUP_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
301 DALI_POPUP_EVENTHANDLER_PARAM( Dali::Toolkit, Popup);