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 SCROLLBAR_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
28 %define SCROLLBAR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
29 %typemap(cscode) NameSpace::ClassName %{
32 public class PanFinishedEventArgs : EventArgs
36 public class ScrollPositionIntervalReachedEventArgs : EventArgs
38 private float _currentScrollPosition;
40 public float CurrentScrollPosition
44 return _currentScrollPosition;
48 _currentScrollPosition = value;
53 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
54 public delegate void PanFinishedEventHandler(object source, PanFinishedEventArgs e);
56 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
57 public delegate void ScrollPositionIntervalReachedEventHandler(object source, ScrollPositionIntervalReachedEventArgs e);
59 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
60 private delegate void PanFinishedEventCallbackDelegate();
61 private PanFinishedEventHandler _scrollBarPanFinishedEventHandler;
62 private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
64 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
65 private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
66 private ScrollPositionIntervalReachedEventHandler _scrollBarScrollPositionIntervalReachedEventHandler;
67 private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
69 public event PanFinishedEventHandler PanFinished
75 // Restricted to only one listener
76 if (_scrollBarPanFinishedEventHandler == null)
78 _scrollBarPanFinishedEventHandler += value;
80 _scrollBarPanFinishedEventCallbackDelegate = new PanFinishedEventCallbackDelegate(OnScrollBarPanFinished);
81 this.PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
90 if (_scrollBarPanFinishedEventHandler != null)
92 this.PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
95 _scrollBarPanFinishedEventHandler -= value;
100 // Callback for ScrollBar PanFinishedSignal
101 private void OnScrollBarPanFinished()
103 PanFinishedEventArgs e = new PanFinishedEventArgs();
105 if (_scrollBarPanFinishedEventHandler != null)
107 //here we send all data to user event handlers
108 _scrollBarPanFinishedEventHandler(this, e);
113 public event ScrollPositionIntervalReachedEventHandler ScrollPositionIntervalReached
119 // Restricted to only one listener
120 if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
122 _scrollBarScrollPositionIntervalReachedEventHandler += value;
124 _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = new ScrollPositionIntervalReachedEventCallbackDelegate(OnScrollBarScrollPositionIntervalReached);
125 this.ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
134 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
136 this.ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
139 _scrollBarScrollPositionIntervalReachedEventHandler -= value;
144 // Callback for ScrollBar ScrollPositionIntervalReachedSignal
145 private void OnScrollBarScrollPositionIntervalReached()
147 ScrollPositionIntervalReachedEventArgs e = new ScrollPositionIntervalReachedEventArgs();
149 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
151 //here we send all data to user event handlers
152 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
159 %define DALI_SCROLLBAR_EVENTHANDLER_PARAM( NameSpace, ClassName)
160 SCROLLBAR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
161 SCROLLBAR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
166 DALI_SCROLLBAR_EVENTHANDLER_PARAM( Dali::Toolkit, ScrollBar);