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 PAGETURNVIEW_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
26 %define PAGETURNVIEW_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
27 %typemap(cscode) NameSpace::ClassName %{
29 public class PagePanStartedEventArgs : EventArgs
31 private PageTurnView _pageTurnView;
33 public PageTurnView PageTurnView
41 _pageTurnView = value;
46 public class PagePanFinishedEventArgs : EventArgs
48 private PageTurnView _pageTurnView;
50 public PageTurnView PageTurnView
58 _pageTurnView = value;
63 public class PageTurnStartedEventArgs : EventArgs
65 private PageTurnView _pageTurnView;
66 private uint _pageIndex;
67 private bool _isTurningForward;
69 public PageTurnView PageTurnView
77 _pageTurnView = value;
93 public bool IsTurningForward
97 return _isTurningForward;
101 _isTurningForward = value;
107 public class PageTurnFinishedEventArgs : EventArgs
109 private PageTurnView _pageTurnView;
110 private uint _pageIndex;
111 private bool _isTurningForward;
113 public PageTurnView PageTurnView
117 return _pageTurnView;
121 _pageTurnView = value;
125 public uint PageIndex
137 public bool IsTurningForward
141 return _isTurningForward;
145 _isTurningForward = value;
151 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
152 private delegate void PagePanStartedCallbackDelegate(IntPtr page);
153 private DaliEventHandler<object,PagePanStartedEventArgs> _pageTurnViewPagePanStartedEventHandler;
154 private PagePanStartedCallbackDelegate _pageTurnViewPagePanStartedCallbackDelegate;
156 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
157 private delegate void PagePanFinishedCallbackDelegate(IntPtr page);
158 private DaliEventHandler<object,PagePanFinishedEventArgs> _pageTurnViewPagePanFinishedEventHandler;
159 private PagePanFinishedCallbackDelegate _pageTurnViewPagePanFinishedCallbackDelegate;
161 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
162 private delegate void PageTurnStartedCallbackDelegate(IntPtr page, uint pageIndex, bool isTurningForward);
163 private DaliEventHandler<object,PageTurnStartedEventArgs> _pageTurnViewPageTurnStartedEventHandler;
164 private PageTurnStartedCallbackDelegate _pageTurnViewPageTurnStartedCallbackDelegate;
166 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
167 private delegate void PageTurnFinishedCallbackDelegate(IntPtr page, uint pageIndex, bool isTurningForward);
168 private DaliEventHandler<object,PageTurnFinishedEventArgs> _pageTurnViewPageTurnFinishedEventHandler;
169 private PageTurnFinishedCallbackDelegate _pageTurnViewPageTurnFinishedCallbackDelegate;
171 public event DaliEventHandler<object,PagePanStartedEventArgs> PagePanStarted
177 // Restricted to only one listener
178 if (_pageTurnViewPagePanStartedEventHandler == null)
180 _pageTurnViewPagePanStartedEventHandler += value;
182 _pageTurnViewPagePanStartedCallbackDelegate = new PagePanStartedCallbackDelegate(OnPagePanStarted);
183 this.PagePanStartedSignal().Connect(_pageTurnViewPagePanStartedCallbackDelegate);
192 if (_pageTurnViewPagePanStartedEventHandler != null)
194 this.PagePanStartedSignal().Disconnect(_pageTurnViewPagePanStartedCallbackDelegate);
197 _pageTurnViewPagePanStartedEventHandler -= value;
202 // Callback for PageTurnView PagePanStarted signal
203 private void OnPagePanStarted(IntPtr page)
205 PagePanStartedEventArgs e = new PagePanStartedEventArgs();
207 // Populate all members of "e" (PagePanStartedEventArgs) with real page
208 e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr( page );
210 if (_pageTurnViewPagePanStartedEventHandler != null)
212 //here we send all page to user event handlers
213 _pageTurnViewPagePanStartedEventHandler(this, e);
217 public event DaliEventHandler<object,PagePanFinishedEventArgs> PagePanFinished
223 // Restricted to only one listener
224 if (_pageTurnViewPagePanFinishedEventHandler == null)
226 _pageTurnViewPagePanFinishedEventHandler += value;
228 _pageTurnViewPagePanFinishedCallbackDelegate = new PagePanFinishedCallbackDelegate(OnPagePanFinished);
229 this.PagePanFinishedSignal().Connect(_pageTurnViewPagePanFinishedCallbackDelegate);
238 if (_pageTurnViewPagePanFinishedEventHandler != null)
240 this.PagePanFinishedSignal().Disconnect(_pageTurnViewPagePanFinishedCallbackDelegate);
243 _pageTurnViewPagePanFinishedEventHandler -= value;
248 // Callback for PageTurnView PagePanFinished signal
249 private void OnPagePanFinished(IntPtr page)
251 PagePanFinishedEventArgs e = new PagePanFinishedEventArgs();
253 // Populate all members of "e" (PagePanFinishedEventArgs) with real page
254 e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr( page );
256 if (_pageTurnViewPagePanFinishedEventHandler != null)
258 //here we send all page to user event handlers
259 _pageTurnViewPagePanFinishedEventHandler(this, e);
264 public event DaliEventHandler<object,PageTurnStartedEventArgs> PageTurnStarted
270 // Restricted to only one listener
271 if (_pageTurnViewPageTurnStartedEventHandler == null)
273 _pageTurnViewPageTurnStartedEventHandler += value;
275 _pageTurnViewPageTurnStartedCallbackDelegate = new PageTurnStartedCallbackDelegate(OnPageTurnStarted);
276 this.PageTurnStartedSignal().Connect(_pageTurnViewPageTurnStartedCallbackDelegate);
285 if (_pageTurnViewPageTurnStartedEventHandler != null)
287 this.PageTurnStartedSignal().Disconnect(_pageTurnViewPageTurnStartedCallbackDelegate);
290 _pageTurnViewPageTurnStartedEventHandler -= value;
295 // Callback for PageTurnView PageTurnStarted signal
296 private void OnPageTurnStarted(IntPtr page, uint pageIndex, bool isTurningForward)
298 PageTurnStartedEventArgs e = new PageTurnStartedEventArgs();
300 // Populate all members of "e" (PageTurnStartedEventArgs) with real page
301 e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr( page );
302 e.PageIndex = pageIndex;
303 e.IsTurningForward = isTurningForward;
306 if (_pageTurnViewPageTurnStartedEventHandler != null)
308 //here we send all page to user event handlers
309 _pageTurnViewPageTurnStartedEventHandler(this, e);
314 public event DaliEventHandler<object,PageTurnFinishedEventArgs> PageTurnFinished
320 // Restricted to only one listener
321 if (_pageTurnViewPageTurnFinishedEventHandler == null)
323 _pageTurnViewPageTurnFinishedEventHandler += value;
325 _pageTurnViewPageTurnFinishedCallbackDelegate = new PageTurnFinishedCallbackDelegate(OnPageTurnFinished);
326 this.PageTurnFinishedSignal().Connect(_pageTurnViewPageTurnFinishedCallbackDelegate);
335 if (_pageTurnViewPageTurnFinishedEventHandler != null)
337 this.PageTurnFinishedSignal().Disconnect(_pageTurnViewPageTurnFinishedCallbackDelegate);
340 _pageTurnViewPageTurnFinishedEventHandler -= value;
345 // Callback for PageTurnView PageTurnFinished signal
346 private void OnPageTurnFinished(IntPtr page, uint pageIndex, bool isTurningForward)
348 PageTurnFinishedEventArgs e = new PageTurnFinishedEventArgs();
350 // Populate all members of "e" (PageTurnFinishedEventArgs) with real page
351 e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr( page );
352 e.PageIndex = pageIndex;
353 e.IsTurningForward = isTurningForward;
356 if (_pageTurnViewPageTurnFinishedEventHandler != null)
358 //here we send all page to user event handlers
359 _pageTurnViewPageTurnFinishedEventHandler(this, e);
363 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
364 ClassName ret = new ClassName(cPtr, false);
365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
374 %define DALI_PAGETURNVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
376 PAGETURNVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
377 PAGETURNVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
383 DALI_PAGETURNVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, PageTurnView);