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 private delegate void PanFinishedEventCallbackDelegate();
55 private DaliEventHandler<object,PanFinishedEventArgs> _scrollBarPanFinishedEventHandler;
56 private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
58 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
59 private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
60 private DaliEventHandler<object,ScrollPositionIntervalReachedEventArgs> _scrollBarScrollPositionIntervalReachedEventHandler;
61 private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
63 public event DaliEventHandler<object,PanFinishedEventArgs> PanFinished
69 // Restricted to only one listener
70 if (_scrollBarPanFinishedEventHandler == null)
72 _scrollBarPanFinishedEventHandler += value;
74 _scrollBarPanFinishedEventCallbackDelegate = new PanFinishedEventCallbackDelegate(OnScrollBarPanFinished);
75 this.PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
84 if (_scrollBarPanFinishedEventHandler != null)
86 this.PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
89 _scrollBarPanFinishedEventHandler -= value;
94 // Callback for ScrollBar PanFinishedSignal
95 private void OnScrollBarPanFinished()
97 PanFinishedEventArgs e = new PanFinishedEventArgs();
99 if (_scrollBarPanFinishedEventHandler != null)
101 //here we send all data to user event handlers
102 _scrollBarPanFinishedEventHandler(this, e);
107 public event DaliEventHandler<object,ScrollPositionIntervalReachedEventArgs> ScrollPositionIntervalReached
113 // Restricted to only one listener
114 if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
116 _scrollBarScrollPositionIntervalReachedEventHandler += value;
118 _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = new ScrollPositionIntervalReachedEventCallbackDelegate(OnScrollBarScrollPositionIntervalReached);
119 this.ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
128 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
130 this.ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
133 _scrollBarScrollPositionIntervalReachedEventHandler -= value;
138 // Callback for ScrollBar ScrollPositionIntervalReachedSignal
139 private void OnScrollBarScrollPositionIntervalReached()
141 ScrollPositionIntervalReachedEventArgs e = new ScrollPositionIntervalReachedEventArgs();
143 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
145 //here we send all data to user event handlers
146 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
153 %define DALI_SCROLLBAR_EVENTHANDLER_PARAM( NameSpace, ClassName)
154 SCROLLBAR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
155 SCROLLBAR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
160 DALI_SCROLLBAR_EVENTHANDLER_PARAM( Dali::Toolkit, ScrollBar);