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);
112 /* Properties earlier added by Ruby Script */
114 public bool WrapEnabled
119 GetProperty( ScrollView.Property.WRAP_ENABLED).Get( ref temp );
124 SetProperty( ScrollView.Property.WRAP_ENABLED, new Dali.Property.Value( value ) );
127 public bool PanningEnabled
132 GetProperty( ScrollView.Property.PANNING_ENABLED).Get( ref temp );
137 SetProperty( ScrollView.Property.PANNING_ENABLED, new Dali.Property.Value( value ) );
140 public bool AxisAutoLockEnabled
145 GetProperty( ScrollView.Property.AXIS_AUTO_LOCK_ENABLED).Get( ref temp );
150 SetProperty( ScrollView.Property.AXIS_AUTO_LOCK_ENABLED, new Dali.Property.Value( value ) );
153 public Dali.CSharp.Size WheelScrollDistanceStep
157 Vector2 temp = new Vector2(0.0f,0.0f);
158 GetProperty( ScrollView.Property.WHEEL_SCROLL_DISTANCE_STEP).Get( temp );
159 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
164 SetProperty( ScrollView.Property.WHEEL_SCROLL_DISTANCE_STEP, new Dali.Property.Value( value ) );
167 public Dali.CSharp.Size ScrollPosition
171 Vector2 temp = new Vector2(0.0f,0.0f);
172 GetProperty( ScrollView.Property.SCROLL_POSITION).Get( temp );
173 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
178 SetProperty( ScrollView.Property.SCROLL_POSITION, new Dali.Property.Value( value ) );
181 public Dali.CSharp.Size ScrollPrePosition
185 Vector2 temp = new Vector2(0.0f,0.0f);
186 GetProperty( ScrollView.Property.SCROLL_PRE_POSITION).Get( temp );
187 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
192 SetProperty( ScrollView.Property.SCROLL_PRE_POSITION, new Dali.Property.Value( value ) );
195 public Dali.CSharp.Size ScrollPrePositionMax
199 Vector2 temp = new Vector2(0.0f,0.0f);
200 GetProperty( ScrollView.Property.SCROLL_PRE_POSITION_MAX).Get( temp );
201 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
206 SetProperty( ScrollView.Property.SCROLL_PRE_POSITION_MAX, new Dali.Property.Value( value ) );
209 public float OvershootX
214 GetProperty( ScrollView.Property.OVERSHOOT_X).Get( ref temp );
219 SetProperty( ScrollView.Property.OVERSHOOT_X, new Dali.Property.Value( value ) );
222 public float OvershootY
227 GetProperty( ScrollView.Property.OVERSHOOT_Y).Get( ref temp );
232 SetProperty( ScrollView.Property.OVERSHOOT_Y, new Dali.Property.Value( value ) );
235 public Dali.CSharp.Size ScrollFinal
239 Vector2 temp = new Vector2(0.0f,0.0f);
240 GetProperty( ScrollView.Property.SCROLL_FINAL).Get( temp );
241 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
246 SetProperty( ScrollView.Property.SCROLL_FINAL, new Dali.Property.Value( value ) );
254 GetProperty( ScrollView.Property.WRAP).Get( ref temp );
259 SetProperty( ScrollView.Property.WRAP, new Dali.Property.Value( value ) );
267 GetProperty( ScrollView.Property.PANNING).Get( ref temp );
272 SetProperty( ScrollView.Property.PANNING, new Dali.Property.Value( value ) );
275 public bool Scrolling
280 GetProperty( ScrollView.Property.SCROLLING).Get( ref temp );
285 SetProperty( ScrollView.Property.SCROLLING, new Dali.Property.Value( value ) );
288 public Dali.CSharp.Size ScrollDomainSize
292 Vector2 temp = new Vector2(0.0f,0.0f);
293 GetProperty( ScrollView.Property.SCROLL_DOMAIN_SIZE).Get( temp );
294 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
299 SetProperty( ScrollView.Property.SCROLL_DOMAIN_SIZE, new Dali.Property.Value( value ) );
302 public Dali.CSharp.Size ScrollDomainOffset
306 Vector2 temp = new Vector2(0.0f,0.0f);
307 GetProperty( ScrollView.Property.SCROLL_DOMAIN_OFFSET).Get( temp );
308 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
313 SetProperty( ScrollView.Property.SCROLL_DOMAIN_OFFSET, new Dali.Property.Value( value ) );
316 public Dali.CSharp.Size ScrollPositionDelta
320 Vector2 temp = new Vector2(0.0f,0.0f);
321 GetProperty( ScrollView.Property.SCROLL_POSITION_DELTA).Get( temp );
322 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
327 SetProperty( ScrollView.Property.SCROLL_POSITION_DELTA, new Dali.Property.Value( value ) );
330 public Dali.CSharp.Position StartPagePosition
334 Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
335 GetProperty( ScrollView.Property.START_PAGE_POSITION).Get( temp );
336 Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
341 SetProperty( ScrollView.Property.START_PAGE_POSITION, new Dali.Property.Value( value ) );
346 /* Properties ends */
353 %define DALI_SCROLLVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
355 SCROLLVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
356 SCROLLVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
362 DALI_SCROLLVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, ScrollView);