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 SCROLLVIEW_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
26 %define SCROLLVIEW_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
27 %typemap(cscode) NameSpace::ClassName %{
30 * @brief Event arguments that passed via SnapStarted signal
33 public class SnapStartedEventArgs : EventArgs
35 private Dali.ScrollView.SnapEvent _snapEvent;
38 * @brief SnapEvent - is the SnapEvent information like snap or flick (it tells the target position, scale, rotation for the snap or flick).
41 public Dali.ScrollView.SnapEvent SnapEventInfo
54 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
55 private delegate void SnapStartedCallbackDelegate(IntPtr data);
56 private DaliEventHandler<object,SnapStartedEventArgs> _scrollViewSnapStartedEventHandler;
57 private SnapStartedCallbackDelegate _scrollViewSnapStartedCallbackDelegate;
60 * @brief Event for SnapStarted signal which can be used to subscribe/unsubscribe the event handler
61 * (in the type of SnapStartedEventHandler-DaliEventHandler<object,SnapStartedEventArgs>) provided by the user.
62 * SnapStarted signal is emitted hen the ScrollView has started to snap or flick (it tells the target
63 * position, scale, rotation for the snap or flick).
66 public event DaliEventHandler<object,SnapStartedEventArgs> SnapStarted
72 // Restricted to only one listener
73 if (_scrollViewSnapStartedEventHandler == null)
75 _scrollViewSnapStartedEventHandler += value;
77 _scrollViewSnapStartedCallbackDelegate = new SnapStartedCallbackDelegate(OnSnapStarted);
78 this.SnapStartedSignal().Connect(_scrollViewSnapStartedCallbackDelegate);
87 if (_scrollViewSnapStartedEventHandler != null)
89 this.SnapStartedSignal().Disconnect(_scrollViewSnapStartedCallbackDelegate);
92 _scrollViewSnapStartedEventHandler -= value;
97 // Callback for ScrollView SnapStarted signal
98 private void OnSnapStarted(IntPtr data)
100 SnapStartedEventArgs e = new SnapStartedEventArgs();
102 // Populate all members of "e" (SnapStartedEventArgs) with real data
103 e.SnapEventInfo = SnapEvent.GetSnapEventFromPtr( data );
105 if (_scrollViewSnapStartedEventHandler != null)
107 //here we send all data to user event handlers
108 _scrollViewSnapStartedEventHandler(this, e);
117 %define DALI_SCROLLVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
119 SCROLLVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
120 SCROLLVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
126 DALI_SCROLLVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, ScrollView);