[NUI] Fix Svace issue (#949)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ItemView.cs
1 /*
2  * Copyright(c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using Tizen.NUI.BaseComponents;
19
20 namespace Tizen.NUI
21 {
22
23     using System;
24     using System.Runtime.InteropServices;
25
26
27     internal class ItemView : Scrollable
28     {
29         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30
31         internal ItemView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.ItemView.ItemView_SWIGUpcast(cPtr), cMemoryOwn)
32         {
33             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
34         }
35
36         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemView obj)
37         {
38             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
39         }
40
41         protected override void Dispose(DisposeTypes type)
42         {
43             if (disposed)
44             {
45                 return;
46             }
47
48             if (type == DisposeTypes.Explicit)
49             {
50                 //Called by User
51                 //Release your own managed resources here.
52                 //You should release all of your own disposable objects here.
53
54             }
55
56             //Release your own unmanaged resources here.
57             //You should not access any managed member here except static instance.
58             //because the execution order of Finalizes is non-deterministic.
59
60             if (swigCPtr.Handle != global::System.IntPtr.Zero)
61             {
62                 if (swigCMemOwn)
63                 {
64                     swigCMemOwn = false;
65                     Interop.ItemView.delete_ItemView(swigCPtr);
66                 }
67                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
68             }
69
70             base.Dispose(type);
71         }
72
73         public new Tizen.NUI.PropertyArray Layout
74         {
75             get
76             {
77                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
78                 GetProperty(ItemView.Property.LAYOUT).Get(temp);
79                 return temp;
80             }
81             set
82             {
83                 SetProperty(ItemView.Property.LAYOUT, new Tizen.NUI.PropertyValue(value));
84             }
85         }
86
87         /// <since_tizen> 3 </since_tizen>
88         public new class Property
89         {
90             /// <since_tizen> 3 </since_tizen>
91             public static readonly int LAYOUT = Interop.ItemView.ItemView_Property_LAYOUT_get();
92             /// <since_tizen> 3 </since_tizen>
93             public static readonly int MINIMUM_SWIPE_SPEED = Interop.ItemView.ItemView_Property_MINIMUM_SWIPE_SPEED_get();
94             /// <since_tizen> 3 </since_tizen>
95             public static readonly int MINIMUM_SWIPE_DISTANCE = Interop.ItemView.ItemView_Property_MINIMUM_SWIPE_DISTANCE_get();
96             /// <since_tizen> 3 </since_tizen>
97             public static readonly int WHEEL_SCROLL_DISTANCE_STEP = Interop.ItemView.ItemView_Property_WHEEL_SCROLL_DISTANCE_STEP_get();
98             /// <since_tizen> 3 </since_tizen>
99             public static readonly int SNAP_TO_ITEM_ENABLED = Interop.ItemView.ItemView_Property_SNAP_TO_ITEM_ENABLED_get();
100             /// <since_tizen> 3 </since_tizen>
101             public static readonly int REFRESH_INTERVAL = Interop.ItemView.ItemView_Property_REFRESH_INTERVAL_get();
102             /// <since_tizen> 3 </since_tizen>
103             public static readonly int LAYOUT_POSITION = Interop.ItemView.ItemView_Property_LAYOUT_POSITION_get();
104             /// <since_tizen> 3 </since_tizen>
105             public static readonly int SCROLL_SPEED = Interop.ItemView.ItemView_Property_SCROLL_SPEED_get();
106             /// <since_tizen> 3 </since_tizen>
107             public static readonly int OVERSHOOT = Interop.ItemView.ItemView_Property_OVERSHOOT_get();
108             /// <since_tizen> 3 </since_tizen>
109             public static readonly int SCROLL_DIRECTION = Interop.ItemView.ItemView_Property_SCROLL_DIRECTION_get();
110             /// <since_tizen> 3 </since_tizen>
111             public static readonly int LAYOUT_ORIENTATION = Interop.ItemView.ItemView_Property_LAYOUT_ORIENTATION_get();
112             /// <since_tizen> 3 </since_tizen>
113             public static readonly int SCROLL_CONTENT_SIZE = Interop.ItemView.ItemView_Property_SCROLL_CONTENT_SIZE_get();
114         }
115
116         public ItemView(ItemFactory factory) : this(Interop.ItemView.ItemView_New(ItemFactory.getCPtr(factory)), true)
117         {
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119
120         }
121
122         internal static ItemView DownCast(BaseHandle handle)
123         {
124             ItemView ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as ItemView;
125             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126             return ret;
127         }
128
129         public uint GetLayoutCount()
130         {
131             uint ret = Interop.ItemView.ItemView_GetLayoutCount(swigCPtr);
132             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
133             return ret;
134         }
135
136         public void AddLayout(ItemLayout layout)
137         {
138             Interop.ItemView.ItemView_AddLayout(swigCPtr, ItemLayout.getCPtr(layout));
139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140         }
141
142         public void RemoveLayout(uint layoutIndex)
143         {
144             Interop.ItemView.ItemView_RemoveLayout(swigCPtr, layoutIndex);
145             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146         }
147
148         public SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t GetLayout(uint layoutIndex)
149         {
150             SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t ret = new SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t(Interop.ItemView.ItemView_GetLayout(swigCPtr, layoutIndex), true);
151             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152             return ret;
153         }
154
155         public SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t GetActiveLayout()
156         {
157             SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t ret = new SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t(Interop.ItemView.ItemView_GetActiveLayout(swigCPtr), true);
158             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159             return ret;
160         }
161
162         public float GetCurrentLayoutPosition(uint itemId)
163         {
164             float ret = Interop.ItemView.ItemView_GetCurrentLayoutPosition(swigCPtr, itemId);
165             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166             return ret;
167         }
168
169         public void ActivateLayout(uint layoutIndex, Vector3 targetSize, float durationSeconds)
170         {
171             Interop.ItemView.ItemView_ActivateLayout(swigCPtr, layoutIndex, Vector3.getCPtr(targetSize), durationSeconds);
172             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173         }
174
175         public void DeactivateCurrentLayout()
176         {
177             Interop.ItemView.ItemView_DeactivateCurrentLayout(swigCPtr);
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179         }
180
181         public void SetMinimumSwipeSpeed(float speed)
182         {
183             Interop.ItemView.ItemView_SetMinimumSwipeSpeed(swigCPtr, speed);
184             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185         }
186
187         public float GetMinimumSwipeSpeed()
188         {
189             float ret = Interop.ItemView.ItemView_GetMinimumSwipeSpeed(swigCPtr);
190             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191             return ret;
192         }
193
194         public void SetMinimumSwipeDistance(float distance)
195         {
196             Interop.ItemView.ItemView_SetMinimumSwipeDistance(swigCPtr, distance);
197             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198         }
199
200         public float GetMinimumSwipeDistance()
201         {
202             float ret = Interop.ItemView.ItemView_GetMinimumSwipeDistance(swigCPtr);
203             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204             return ret;
205         }
206
207         public void SetWheelScrollDistanceStep(float step)
208         {
209             Interop.ItemView.ItemView_SetWheelScrollDistanceStep(swigCPtr, step);
210             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211         }
212
213         public float GetWheelScrollDistanceStep()
214         {
215             float ret = Interop.ItemView.ItemView_GetWheelScrollDistanceStep(swigCPtr);
216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217             return ret;
218         }
219
220         public void SetAnchoring(bool enabled)
221         {
222             Interop.ItemView.ItemView_SetAnchoring(swigCPtr, enabled);
223             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224         }
225
226         public bool GetAnchoring()
227         {
228             bool ret = Interop.ItemView.ItemView_GetAnchoring(swigCPtr);
229             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230             return ret;
231         }
232
233         public void SetAnchoringDuration(float durationSeconds)
234         {
235             Interop.ItemView.ItemView_SetAnchoringDuration(swigCPtr, durationSeconds);
236             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237         }
238
239         public float GetAnchoringDuration()
240         {
241             float ret = Interop.ItemView.ItemView_GetAnchoringDuration(swigCPtr);
242             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243             return ret;
244         }
245
246         public void ScrollToItem(uint itemId, float durationSeconds)
247         {
248             Interop.ItemView.ItemView_ScrollToItem(swigCPtr, itemId, durationSeconds);
249             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
250         }
251
252         public void SetRefreshInterval(float intervalLayoutPositions)
253         {
254             Interop.ItemView.ItemView_SetRefreshInterval(swigCPtr, intervalLayoutPositions);
255             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256         }
257
258         public float GetRefreshInterval()
259         {
260             float ret = Interop.ItemView.ItemView_GetRefreshInterval(swigCPtr);
261             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262             return ret;
263         }
264
265         public void Refresh()
266         {
267             Interop.ItemView.ItemView_Refresh(swigCPtr);
268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269         }
270
271         public View GetItem(uint itemId)
272         {
273             View ret = new View(Interop.ItemView.ItemView_GetItem(swigCPtr, itemId), true);
274             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275             return ret;
276         }
277
278         public uint GetItemId(View view)
279         {
280             uint ret = Interop.ItemView.ItemView_GetItemId(swigCPtr, View.getCPtr(view));
281             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282             return ret;
283         }
284
285         public void InsertItem(Item newItem, float durationSeconds)
286         {
287             Interop.ItemView.ItemView_InsertItem(swigCPtr, Item.getCPtr(newItem), durationSeconds);
288             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289         }
290
291         public void InsertItems(ItemContainer newItems, float durationSeconds)
292         {
293             Interop.ItemView.ItemView_InsertItems(swigCPtr, ItemContainer.getCPtr(newItems), durationSeconds);
294             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295         }
296
297         public void RemoveItem(uint itemId, float durationSeconds)
298         {
299             Interop.ItemView.ItemView_RemoveItem(swigCPtr, itemId, durationSeconds);
300             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301         }
302
303         public void RemoveItems(ItemIdContainer itemIds, float durationSeconds)
304         {
305             Interop.ItemView.ItemView_RemoveItems(swigCPtr, ItemIdContainer.getCPtr(itemIds), durationSeconds);
306             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307         }
308
309         public void ReplaceItem(Item replacementItem, float durationSeconds)
310         {
311             Interop.ItemView.ItemView_ReplaceItem(swigCPtr, Item.getCPtr(replacementItem), durationSeconds);
312             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313         }
314
315         public void ReplaceItems(ItemContainer replacementItems, float durationSeconds)
316         {
317             Interop.ItemView.ItemView_ReplaceItems(swigCPtr, ItemContainer.getCPtr(replacementItems), durationSeconds);
318             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
319         }
320
321         public void SetItemsParentOrigin(Vector3 parentOrigin)
322         {
323             Interop.ItemView.ItemView_SetItemsParentOrigin(swigCPtr, Vector3.getCPtr(parentOrigin));
324             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325         }
326
327         public Vector3 GetItemsParentOrigin()
328         {
329             Vector3 ret = new Vector3(Interop.ItemView.ItemView_GetItemsParentOrigin(swigCPtr), true);
330             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331             return ret;
332         }
333
334         public void SetItemsAnchorPoint(Vector3 anchorPoint)
335         {
336             Interop.ItemView.ItemView_SetItemsAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint));
337             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338         }
339
340         public Vector3 GetItemsAnchorPoint()
341         {
342             Vector3 ret = new Vector3(Interop.ItemView.ItemView_GetItemsAnchorPoint(swigCPtr), true);
343             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344             return ret;
345         }
346
347         public void GetItemsRange(ItemRange range)
348         {
349             Interop.ItemView.ItemView_GetItemsRange(swigCPtr, ItemRange.getCPtr(range));
350             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
351         }
352
353         public VoidSignal LayoutActivatedSignal()
354         {
355             VoidSignal ret = new VoidSignal(Interop.ItemView.ItemView_LayoutActivatedSignal(swigCPtr), false);
356             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357             return ret;
358         }
359
360         public float MinimumSwipeSpeed
361         {
362             get
363             {
364                 float temp = 0.0f;
365                 GetProperty(ItemView.Property.MINIMUM_SWIPE_SPEED).Get(out temp);
366                 return temp;
367             }
368             set
369             {
370                 SetProperty(ItemView.Property.MINIMUM_SWIPE_SPEED, new Tizen.NUI.PropertyValue(value));
371             }
372         }
373         public float MinimumSwipeDistance
374         {
375             get
376             {
377                 float temp = 0.0f;
378                 GetProperty(ItemView.Property.MINIMUM_SWIPE_DISTANCE).Get(out temp);
379                 return temp;
380             }
381             set
382             {
383                 SetProperty(ItemView.Property.MINIMUM_SWIPE_DISTANCE, new Tizen.NUI.PropertyValue(value));
384             }
385         }
386         public float WheelScrollDistanceStep
387         {
388             get
389             {
390                 float temp = 0.0f;
391                 GetProperty(ItemView.Property.WHEEL_SCROLL_DISTANCE_STEP).Get(out temp);
392                 return temp;
393             }
394             set
395             {
396                 SetProperty(ItemView.Property.WHEEL_SCROLL_DISTANCE_STEP, new Tizen.NUI.PropertyValue(value));
397             }
398         }
399         public bool SnapToItemEnabled
400         {
401             get
402             {
403                 bool temp = false;
404                 GetProperty(ItemView.Property.SNAP_TO_ITEM_ENABLED).Get(out temp);
405                 return temp;
406             }
407             set
408             {
409                 SetProperty(ItemView.Property.SNAP_TO_ITEM_ENABLED, new Tizen.NUI.PropertyValue(value));
410             }
411         }
412         public float RefreshInterval
413         {
414             get
415             {
416                 float temp = 0.0f;
417                 GetProperty(ItemView.Property.REFRESH_INTERVAL).Get(out temp);
418                 return temp;
419             }
420             set
421             {
422                 SetProperty(ItemView.Property.REFRESH_INTERVAL, new Tizen.NUI.PropertyValue(value));
423             }
424         }
425         public float LayoutPosition
426         {
427             get
428             {
429                 float temp = 0.0f;
430                 GetProperty(ItemView.Property.LAYOUT_POSITION).Get(out temp);
431                 return temp;
432             }
433             set
434             {
435                 SetProperty(ItemView.Property.LAYOUT_POSITION, new Tizen.NUI.PropertyValue(value));
436             }
437         }
438         public float ScrollSpeed
439         {
440             get
441             {
442                 float temp = 0.0f;
443                 GetProperty(ItemView.Property.SCROLL_SPEED).Get(out temp);
444                 return temp;
445             }
446             set
447             {
448                 SetProperty(ItemView.Property.SCROLL_SPEED, new Tizen.NUI.PropertyValue(value));
449             }
450         }
451         public float Overshoot
452         {
453             get
454             {
455                 float temp = 0.0f;
456                 GetProperty(ItemView.Property.OVERSHOOT).Get(out temp);
457                 return temp;
458             }
459             set
460             {
461                 SetProperty(ItemView.Property.OVERSHOOT, new Tizen.NUI.PropertyValue(value));
462             }
463         }
464         public Vector2 ScrollDirection
465         {
466             get
467             {
468                 Vector2 temp = new Vector2(0.0f, 0.0f);
469                 GetProperty(ItemView.Property.SCROLL_DIRECTION).Get(temp);
470                 return temp;
471             }
472             set
473             {
474                 SetProperty(ItemView.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(value));
475             }
476         }
477         public int LayoutOrientation
478         {
479             get
480             {
481                 int temp = 0;
482                 GetProperty(ItemView.Property.LAYOUT_ORIENTATION).Get(out temp);
483                 return temp;
484             }
485             set
486             {
487                 SetProperty(ItemView.Property.LAYOUT_ORIENTATION, new Tizen.NUI.PropertyValue(value));
488             }
489         }
490         public float ScrollContentSize
491         {
492             get
493             {
494                 float temp = 0.0f;
495                 GetProperty(ItemView.Property.SCROLL_CONTENT_SIZE).Get(out temp);
496                 return temp;
497             }
498             set
499             {
500                 SetProperty(ItemView.Property.SCROLL_CONTENT_SIZE, new Tizen.NUI.PropertyValue(value));
501             }
502         }
503
504     }
505
506 }