Release 4.0.0-preview1-00301
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ItemView.cs
1 /*
2  * Copyright(c) 2017 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(NDalicPINVOKE.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                     NDalicPINVOKE.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 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         public new class Property
88         {
89             public static readonly int LAYOUT = NDalicManualPINVOKE.ItemView_Property_LAYOUT_get();
90             public static readonly int MINIMUM_SWIPE_SPEED = NDalicPINVOKE.ItemView_Property_MINIMUM_SWIPE_SPEED_get();
91             public static readonly int MINIMUM_SWIPE_DISTANCE = NDalicPINVOKE.ItemView_Property_MINIMUM_SWIPE_DISTANCE_get();
92             public static readonly int WHEEL_SCROLL_DISTANCE_STEP = NDalicPINVOKE.ItemView_Property_WHEEL_SCROLL_DISTANCE_STEP_get();
93             public static readonly int SNAP_TO_ITEM_ENABLED = NDalicPINVOKE.ItemView_Property_SNAP_TO_ITEM_ENABLED_get();
94             public static readonly int REFRESH_INTERVAL = NDalicPINVOKE.ItemView_Property_REFRESH_INTERVAL_get();
95             public static readonly int LAYOUT_POSITION = NDalicPINVOKE.ItemView_Property_LAYOUT_POSITION_get();
96             public static readonly int SCROLL_SPEED = NDalicPINVOKE.ItemView_Property_SCROLL_SPEED_get();
97             public static readonly int OVERSHOOT = NDalicPINVOKE.ItemView_Property_OVERSHOOT_get();
98             public static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ItemView_Property_SCROLL_DIRECTION_get();
99             public static readonly int LAYOUT_ORIENTATION = NDalicPINVOKE.ItemView_Property_LAYOUT_ORIENTATION_get();
100             public static readonly int SCROLL_CONTENT_SIZE = NDalicPINVOKE.ItemView_Property_SCROLL_CONTENT_SIZE_get();
101         }
102
103         public ItemView(ItemFactory factory) : this(NDalicPINVOKE.ItemView_New(ItemFactory.getCPtr(factory)), true)
104         {
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106
107         }
108
109         internal new static ItemView DownCast(BaseHandle handle)
110         {
111             ItemView ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as ItemView;
112             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113             return ret;
114         }
115
116         public uint GetLayoutCount()
117         {
118             uint ret = NDalicPINVOKE.ItemView_GetLayoutCount(swigCPtr);
119             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120             return ret;
121         }
122
123         public void AddLayout(ItemLayout layout)
124         {
125             NDalicPINVOKE.ItemView_AddLayout(swigCPtr, ItemLayout.getCPtr(layout));
126             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127         }
128
129         public void RemoveLayout(uint layoutIndex)
130         {
131             NDalicPINVOKE.ItemView_RemoveLayout(swigCPtr, layoutIndex);
132             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
133         }
134
135         public SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t GetLayout(uint layoutIndex)
136         {
137             SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t ret = new SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t(NDalicPINVOKE.ItemView_GetLayout(swigCPtr, layoutIndex), true);
138             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139             return ret;
140         }
141
142         public SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t GetActiveLayout()
143         {
144             SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t ret = new SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t(NDalicPINVOKE.ItemView_GetActiveLayout(swigCPtr), true);
145             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146             return ret;
147         }
148
149         public float GetCurrentLayoutPosition(uint itemId)
150         {
151             float ret = NDalicPINVOKE.ItemView_GetCurrentLayoutPosition(swigCPtr, itemId);
152             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153             return ret;
154         }
155
156         public void ActivateLayout(uint layoutIndex, Vector3 targetSize, float durationSeconds)
157         {
158             NDalicPINVOKE.ItemView_ActivateLayout(swigCPtr, layoutIndex, Vector3.getCPtr(targetSize), durationSeconds);
159             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160         }
161
162         public void DeactivateCurrentLayout()
163         {
164             NDalicPINVOKE.ItemView_DeactivateCurrentLayout(swigCPtr);
165             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166         }
167
168         public void SetMinimumSwipeSpeed(float speed)
169         {
170             NDalicPINVOKE.ItemView_SetMinimumSwipeSpeed(swigCPtr, speed);
171             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172         }
173
174         public float GetMinimumSwipeSpeed()
175         {
176             float ret = NDalicPINVOKE.ItemView_GetMinimumSwipeSpeed(swigCPtr);
177             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178             return ret;
179         }
180
181         public void SetMinimumSwipeDistance(float distance)
182         {
183             NDalicPINVOKE.ItemView_SetMinimumSwipeDistance(swigCPtr, distance);
184             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185         }
186
187         public float GetMinimumSwipeDistance()
188         {
189             float ret = NDalicPINVOKE.ItemView_GetMinimumSwipeDistance(swigCPtr);
190             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191             return ret;
192         }
193
194         public void SetWheelScrollDistanceStep(float step)
195         {
196             NDalicPINVOKE.ItemView_SetWheelScrollDistanceStep(swigCPtr, step);
197             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198         }
199
200         public float GetWheelScrollDistanceStep()
201         {
202             float ret = NDalicPINVOKE.ItemView_GetWheelScrollDistanceStep(swigCPtr);
203             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204             return ret;
205         }
206
207         public void SetAnchoring(bool enabled)
208         {
209             NDalicPINVOKE.ItemView_SetAnchoring(swigCPtr, enabled);
210             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211         }
212
213         public bool GetAnchoring()
214         {
215             bool ret = NDalicPINVOKE.ItemView_GetAnchoring(swigCPtr);
216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217             return ret;
218         }
219
220         public void SetAnchoringDuration(float durationSeconds)
221         {
222             NDalicPINVOKE.ItemView_SetAnchoringDuration(swigCPtr, durationSeconds);
223             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224         }
225
226         public float GetAnchoringDuration()
227         {
228             float ret = NDalicPINVOKE.ItemView_GetAnchoringDuration(swigCPtr);
229             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230             return ret;
231         }
232
233         public void ScrollToItem(uint itemId, float durationSeconds)
234         {
235             NDalicPINVOKE.ItemView_ScrollToItem(swigCPtr, itemId, durationSeconds);
236             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237         }
238
239         public void SetRefreshInterval(float intervalLayoutPositions)
240         {
241             NDalicPINVOKE.ItemView_SetRefreshInterval(swigCPtr, intervalLayoutPositions);
242             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243         }
244
245         public float GetRefreshInterval()
246         {
247             float ret = NDalicPINVOKE.ItemView_GetRefreshInterval(swigCPtr);
248             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249             return ret;
250         }
251
252         public void Refresh()
253         {
254             NDalicPINVOKE.ItemView_Refresh(swigCPtr);
255             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256         }
257
258         public View GetItem(uint itemId)
259         {
260             View ret = new View(NDalicPINVOKE.ItemView_GetItem(swigCPtr, itemId), true);
261             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262             return ret;
263         }
264
265         public uint GetItemId(View view)
266         {
267             uint ret = NDalicPINVOKE.ItemView_GetItemId(swigCPtr, View.getCPtr(view));
268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269             return ret;
270         }
271
272         public void InsertItem(Item newItem, float durationSeconds)
273         {
274             NDalicPINVOKE.ItemView_InsertItem(swigCPtr, Item.getCPtr(newItem), durationSeconds);
275             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276         }
277
278         public void InsertItems(ItemContainer newItems, float durationSeconds)
279         {
280             NDalicPINVOKE.ItemView_InsertItems(swigCPtr, ItemContainer.getCPtr(newItems), durationSeconds);
281             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282         }
283
284         public void RemoveItem(uint itemId, float durationSeconds)
285         {
286             NDalicPINVOKE.ItemView_RemoveItem(swigCPtr, itemId, durationSeconds);
287             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288         }
289
290         public void RemoveItems(ItemIdContainer itemIds, float durationSeconds)
291         {
292             NDalicPINVOKE.ItemView_RemoveItems(swigCPtr, ItemIdContainer.getCPtr(itemIds), durationSeconds);
293             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294         }
295
296         public void ReplaceItem(Item replacementItem, float durationSeconds)
297         {
298             NDalicPINVOKE.ItemView_ReplaceItem(swigCPtr, Item.getCPtr(replacementItem), durationSeconds);
299             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300         }
301
302         public void ReplaceItems(ItemContainer replacementItems, float durationSeconds)
303         {
304             NDalicPINVOKE.ItemView_ReplaceItems(swigCPtr, ItemContainer.getCPtr(replacementItems), durationSeconds);
305             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306         }
307
308         public void SetItemsParentOrigin(Vector3 parentOrigin)
309         {
310             NDalicPINVOKE.ItemView_SetItemsParentOrigin(swigCPtr, Vector3.getCPtr(parentOrigin));
311             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312         }
313
314         public Vector3 GetItemsParentOrigin()
315         {
316             Vector3 ret = new Vector3(NDalicPINVOKE.ItemView_GetItemsParentOrigin(swigCPtr), true);
317             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318             return ret;
319         }
320
321         public void SetItemsAnchorPoint(Vector3 anchorPoint)
322         {
323             NDalicPINVOKE.ItemView_SetItemsAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint));
324             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325         }
326
327         public Vector3 GetItemsAnchorPoint()
328         {
329             Vector3 ret = new Vector3(NDalicPINVOKE.ItemView_GetItemsAnchorPoint(swigCPtr), true);
330             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331             return ret;
332         }
333
334         public void GetItemsRange(ItemRange range)
335         {
336             NDalicPINVOKE.ItemView_GetItemsRange(swigCPtr, ItemRange.getCPtr(range));
337             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338         }
339
340         public VoidSignal LayoutActivatedSignal()
341         {
342             VoidSignal ret = new VoidSignal(NDalicPINVOKE.ItemView_LayoutActivatedSignal(swigCPtr), false);
343             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344             return ret;
345         }
346
347         public float MinimumSwipeSpeed
348         {
349             get
350             {
351                 float temp = 0.0f;
352                 GetProperty(ItemView.Property.MINIMUM_SWIPE_SPEED).Get(out temp);
353                 return temp;
354             }
355             set
356             {
357                 SetProperty(ItemView.Property.MINIMUM_SWIPE_SPEED, new Tizen.NUI.PropertyValue(value));
358             }
359         }
360         public float MinimumSwipeDistance
361         {
362             get
363             {
364                 float temp = 0.0f;
365                 GetProperty(ItemView.Property.MINIMUM_SWIPE_DISTANCE).Get(out temp);
366                 return temp;
367             }
368             set
369             {
370                 SetProperty(ItemView.Property.MINIMUM_SWIPE_DISTANCE, new Tizen.NUI.PropertyValue(value));
371             }
372         }
373         public float WheelScrollDistanceStep
374         {
375             get
376             {
377                 float temp = 0.0f;
378                 GetProperty(ItemView.Property.WHEEL_SCROLL_DISTANCE_STEP).Get(out temp);
379                 return temp;
380             }
381             set
382             {
383                 SetProperty(ItemView.Property.WHEEL_SCROLL_DISTANCE_STEP, new Tizen.NUI.PropertyValue(value));
384             }
385         }
386         public bool SnapToItemEnabled
387         {
388             get
389             {
390                 bool temp = false;
391                 GetProperty(ItemView.Property.SNAP_TO_ITEM_ENABLED).Get(out temp);
392                 return temp;
393             }
394             set
395             {
396                 SetProperty(ItemView.Property.SNAP_TO_ITEM_ENABLED, new Tizen.NUI.PropertyValue(value));
397             }
398         }
399         public float RefreshInterval
400         {
401             get
402             {
403                 float temp = 0.0f;
404                 GetProperty(ItemView.Property.REFRESH_INTERVAL).Get(out temp);
405                 return temp;
406             }
407             set
408             {
409                 SetProperty(ItemView.Property.REFRESH_INTERVAL, new Tizen.NUI.PropertyValue(value));
410             }
411         }
412         public float LayoutPosition
413         {
414             get
415             {
416                 float temp = 0.0f;
417                 GetProperty(ItemView.Property.LAYOUT_POSITION).Get(out temp);
418                 return temp;
419             }
420             set
421             {
422                 SetProperty(ItemView.Property.LAYOUT_POSITION, new Tizen.NUI.PropertyValue(value));
423             }
424         }
425         public float ScrollSpeed
426         {
427             get
428             {
429                 float temp = 0.0f;
430                 GetProperty(ItemView.Property.SCROLL_SPEED).Get(out temp);
431                 return temp;
432             }
433             set
434             {
435                 SetProperty(ItemView.Property.SCROLL_SPEED, new Tizen.NUI.PropertyValue(value));
436             }
437         }
438         public float Overshoot
439         {
440             get
441             {
442                 float temp = 0.0f;
443                 GetProperty(ItemView.Property.OVERSHOOT).Get(out temp);
444                 return temp;
445             }
446             set
447             {
448                 SetProperty(ItemView.Property.OVERSHOOT, new Tizen.NUI.PropertyValue(value));
449             }
450         }
451         public Vector2 ScrollDirection
452         {
453             get
454             {
455                 Vector2 temp = new Vector2(0.0f, 0.0f);
456                 GetProperty(ItemView.Property.SCROLL_DIRECTION).Get(temp);
457                 return temp;
458             }
459             set
460             {
461                 SetProperty(ItemView.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(value));
462             }
463         }
464         public int LayoutOrientation
465         {
466             get
467             {
468                 int temp = 0;
469                 GetProperty(ItemView.Property.LAYOUT_ORIENTATION).Get(out temp);
470                 return temp;
471             }
472             set
473             {
474                 SetProperty(ItemView.Property.LAYOUT_ORIENTATION, new Tizen.NUI.PropertyValue(value));
475             }
476         }
477         public float ScrollContentSize
478         {
479             get
480             {
481                 float temp = 0.0f;
482                 GetProperty(ItemView.Property.SCROLL_CONTENT_SIZE).Get(out temp);
483                 return temp;
484             }
485             set
486             {
487                 SetProperty(ItemView.Property.SCROLL_CONTENT_SIZE, new Tizen.NUI.PropertyValue(value));
488             }
489         }
490
491     }
492
493 }