Release 4.0.0-preview1-00301
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ItemLayout.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     internal class ItemLayout : RefObject
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26
27         internal ItemLayout(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ItemLayout_SWIGUpcast(cPtr), cMemoryOwn)
28         {
29             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
30         }
31
32         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemLayout obj)
33         {
34             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35         }
36
37         protected override void Dispose(DisposeTypes type)
38         {
39             if (disposed)
40             {
41                 return;
42             }
43
44             if (type == DisposeTypes.Explicit)
45             {
46                 //Called by User
47                 //Release your own managed resources here.
48                 //You should release all of your own disposable objects here.
49
50             }
51
52             //Release your own unmanaged resources here.
53             //You should not access any managed member here except static instance.
54             //because the execution order of Finalizes is non-deterministic.
55
56             if (swigCPtr.Handle != global::System.IntPtr.Zero)
57             {
58                 if (swigCMemOwn)
59                 {
60                     swigCMemOwn = false;
61                     NDalicPINVOKE.delete_ItemLayout(swigCPtr);
62                 }
63                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
64             }
65
66             base.Dispose(type);
67         }
68
69
70         public void SetLayoutProperties(PropertyMap properties)
71         {
72             NDalicPINVOKE.ItemLayout_SetLayoutProperties(swigCPtr, PropertyMap.getCPtr(properties));
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74         }
75
76         public PropertyMap GetLayoutProperties()
77         {
78             PropertyMap ret = new PropertyMap(NDalicPINVOKE.ItemLayout_GetLayoutProperties(swigCPtr), true);
79             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80             return ret;
81         }
82
83         public void GetItemSize(uint itemId, Vector3 layoutSize, Vector3 itemSize)
84         {
85             NDalicPINVOKE.ItemLayout_GetItemSize(swigCPtr, itemId, Vector3.getCPtr(layoutSize), Vector3.getCPtr(itemSize));
86             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87         }
88
89         public void SetItemSize(Vector3 itemSize)
90         {
91             NDalicPINVOKE.ItemLayout_SetItemSize(swigCPtr, Vector3.getCPtr(itemSize));
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93         }
94
95         public virtual float GetMinimumLayoutPosition(uint numberOfItems, Vector3 layoutSize)
96         {
97             float ret = NDalicPINVOKE.ItemLayout_GetMinimumLayoutPosition(swigCPtr, numberOfItems, Vector3.getCPtr(layoutSize));
98             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99             return ret;
100         }
101
102         public virtual float GetClosestAnchorPosition(float layoutPosition)
103         {
104             float ret = NDalicPINVOKE.ItemLayout_GetClosestAnchorPosition(swigCPtr, layoutPosition);
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106             return ret;
107         }
108
109         public virtual float GetItemScrollToPosition(uint itemId)
110         {
111             float ret = NDalicPINVOKE.ItemLayout_GetItemScrollToPosition(swigCPtr, itemId);
112             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113             return ret;
114         }
115
116         public virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize)
117         {
118             ItemRange ret = new ItemRange(NDalicPINVOKE.ItemLayout_GetItemsWithinArea(swigCPtr, firstItemPosition, Vector3.getCPtr(layoutSize)), true);
119             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120             return ret;
121         }
122
123         public virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, Vector3 layoutSize)
124         {
125             float ret = NDalicPINVOKE.ItemLayout_GetClosestOnScreenLayoutPosition(swigCPtr, itemID, currentLayoutPosition, Vector3.getCPtr(layoutSize));
126             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127             return ret;
128         }
129
130         public virtual uint GetReserveItemCount(Vector3 layoutSize)
131         {
132             uint ret = NDalicPINVOKE.ItemLayout_GetReserveItemCount(swigCPtr, Vector3.getCPtr(layoutSize));
133             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134             return ret;
135         }
136
137         public virtual void GetDefaultItemSize(uint itemId, Vector3 layoutSize, Vector3 itemSize)
138         {
139             NDalicPINVOKE.ItemLayout_GetDefaultItemSize(swigCPtr, itemId, Vector3.getCPtr(layoutSize), Vector3.getCPtr(itemSize));
140             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141         }
142
143         public virtual Degree GetScrollDirection()
144         {
145             Degree ret = new Degree(NDalicPINVOKE.ItemLayout_GetScrollDirection(swigCPtr), true);
146             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147             return ret;
148         }
149
150         public virtual float GetScrollSpeedFactor()
151         {
152             float ret = NDalicPINVOKE.ItemLayout_GetScrollSpeedFactor(swigCPtr);
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154             return ret;
155         }
156
157         public virtual float GetMaximumSwipeSpeed()
158         {
159             float ret = NDalicPINVOKE.ItemLayout_GetMaximumSwipeSpeed(swigCPtr);
160             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161             return ret;
162         }
163
164         public virtual float GetItemFlickAnimationDuration()
165         {
166             float ret = NDalicPINVOKE.ItemLayout_GetItemFlickAnimationDuration(swigCPtr);
167             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168             return ret;
169         }
170
171         public virtual int GetNextFocusItemID(int itemID, int maxItems, View.FocusDirection direction, bool loopEnabled)
172         {
173             int ret = NDalicPINVOKE.ItemLayout_GetNextFocusItemID(swigCPtr, itemID, maxItems, (int)direction, loopEnabled);
174             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175             return ret;
176         }
177
178         public virtual float GetFlickSpeedFactor()
179         {
180             float ret = NDalicPINVOKE.ItemLayout_GetFlickSpeedFactor(swigCPtr);
181             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182             return ret;
183         }
184
185         public virtual void ApplyConstraints(View view, int itemId, Vector3 layoutSize, View itemView)
186         {
187             NDalicPINVOKE.ItemLayout_ApplyConstraints(swigCPtr, View.getCPtr(view), itemId, Vector3.getCPtr(layoutSize), View.getCPtr(itemView));
188             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189         }
190
191         public virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, Vector3 layoutSize)
192         {
193             Vector3 ret = new Vector3(NDalicPINVOKE.ItemLayout_GetItemPosition(swigCPtr, itemID, currentLayoutPosition, Vector3.getCPtr(layoutSize)), true);
194             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195             return ret;
196         }
197
198     }
199
200 }