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