2 * Copyright(c) 2019 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.
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
25 /// ScrollView contains views that can be scrolled manually (via touch).
27 /// <since_tizen> 3 </since_tizen>
28 public partial class ScrollView
30 private DaliEventHandler<object, SnapStartedEventArgs> _scrollViewSnapStartedEventHandler;
31 private SnapStartedCallbackDelegate _scrollViewSnapStartedCallbackDelegate;
33 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
34 private delegate void SnapStartedCallbackDelegate(IntPtr data);
37 /// SnapStarted can be used to subscribe or unsubscribe the event handler
38 /// The SnapStarted signal is emitted when the ScrollView has started to snap or flick (it tells the target
39 /// position, scale, rotation for the snap or flick).
41 /// <since_tizen> 3 </since_tizen>
42 /// This will be deprecated
43 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
44 [EditorBrowsable(EditorBrowsableState.Never)]
45 public event DaliEventHandler<object, SnapStartedEventArgs> SnapStarted
51 // Restricted to only one listener
52 if (_scrollViewSnapStartedEventHandler == null)
54 _scrollViewSnapStartedEventHandler += value;
56 _scrollViewSnapStartedCallbackDelegate = new SnapStartedCallbackDelegate(OnSnapStarted);
57 this.SnapStartedSignal().Connect(_scrollViewSnapStartedCallbackDelegate);
66 if (_scrollViewSnapStartedEventHandler != null)
68 this.SnapStartedSignal().Disconnect(_scrollViewSnapStartedCallbackDelegate);
71 _scrollViewSnapStartedEventHandler -= value;
76 internal ScrollViewSnapStartedSignal SnapStartedSignal()
78 ScrollViewSnapStartedSignal ret = new ScrollViewSnapStartedSignal(Interop.ScrollView.ScrollView_SnapStartedSignal(swigCPtr), false);
79 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
83 // Callback for ScrollView SnapStarted signal
84 private void OnSnapStarted(IntPtr data)
86 SnapStartedEventArgs e = new SnapStartedEventArgs();
88 // Populate all members of "e" (SnapStartedEventArgs) with real data
89 e.SnapEventInfo = SnapEvent.GetSnapEventFromPtr(data);
91 if (_scrollViewSnapStartedEventHandler != null)
93 //here we send all data to user event handlers
94 _scrollViewSnapStartedEventHandler(this, e);
99 /// Snaps signal event's data.
101 /// <since_tizen> 3 </since_tizen>
102 /// This will be deprecated
103 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
104 [EditorBrowsable(EditorBrowsableState.Never)]
105 public class SnapEvent : Disposable
110 /// <since_tizen> 3 </since_tizen>
111 /// This will be deprecated
112 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
113 [EditorBrowsable(EditorBrowsableState.Never)]
114 protected bool swigCMemOwn;
115 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
118 /// Create an instance of SnapEvent.
120 /// <since_tizen> 3 </since_tizen>
121 /// This will be deprecated
122 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
123 [EditorBrowsable(EditorBrowsableState.Never)]
124 public SnapEvent() : this(Interop.ScrollView.new_ScrollView_SnapEvent(), true)
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 internal SnapEvent(global::System.IntPtr cPtr, bool cMemoryOwn)
131 swigCMemOwn = cMemoryOwn;
132 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
138 /// <since_tizen> 3 </since_tizen>
139 /// This will be deprecated
140 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public Vector2 position
146 Interop.ScrollView.ScrollView_SnapEvent_position_set(swigCPtr, Vector2.getCPtr(value));
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151 global::System.IntPtr cPtr = Interop.ScrollView.ScrollView_SnapEvent_position_get(swigCPtr);
152 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 /// <since_tizen> 3 </since_tizen>
162 /// This will be deprecated
163 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 public float duration
169 Interop.ScrollView.ScrollView_SnapEvent_duration_set(swigCPtr, value);
170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 float ret = Interop.ScrollView.ScrollView_SnapEvent_duration_get(swigCPtr);
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 internal SnapType type
184 Interop.ScrollView.ScrollView_SnapEvent_type_set(swigCPtr, (int)value);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 SnapType ret = (SnapType)Interop.ScrollView.ScrollView_SnapEvent_type_get(swigCPtr);
190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 /// Get SnapEvent From Ptr
198 /// <since_tizen> 3 </since_tizen>
199 /// This will be deprecated
200 [Obsolete("Deprecated in API6, Will be removed in API9, " +
201 "Please use SnapStarted event instead!" +
202 "IntPtr(native integer pointer) is supposed to be not used in Application!")]
203 [EditorBrowsable(EditorBrowsableState.Never)]
204 public static SnapEvent GetSnapEventFromPtr(global::System.IntPtr cPtr)
206 SnapEvent ret = new SnapEvent(cPtr, false);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SnapEvent obj)
213 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
219 /// <param name="type">the dispose type</param>
220 /// <since_tizen> 3 </since_tizen>
221 /// This will be deprecated
222 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
223 [EditorBrowsable(EditorBrowsableState.Never)]
224 protected override void Dispose(DisposeTypes type)
231 //Release your own unmanaged resources here.
232 //You should not access any managed member here except static instance.
233 //because the execution order of Finalizes is non-deterministic.
235 if (swigCPtr.Handle != global::System.IntPtr.Zero)
240 Interop.ScrollView.delete_ScrollView_SnapEvent(swigCPtr);
242 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
251 /// Event arguments that passed via the SnapStarted signal.
253 /// <since_tizen> 3 </since_tizen>
254 /// This will be deprecated
255 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
256 [EditorBrowsable(EditorBrowsableState.Never)]
257 public class SnapStartedEventArgs : EventArgs
259 private Tizen.NUI.ScrollView.SnapEvent _snapEvent;
262 /// SnapEventInfo is the SnapEvent information like snap or flick (it tells the target position, scale, rotation for the snap or flick).
264 /// <since_tizen> 3 </since_tizen>
265 /// This will be deprecated
266 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
267 [EditorBrowsable(EditorBrowsableState.Never)]
268 public Tizen.NUI.ScrollView.SnapEvent SnapEventInfo