[NUI] sync with dalihub (#651)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Layouting / LinearLayout.cs
1 /* Copyright (c) 2018 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 using System.ComponentModel;
17
18 namespace Tizen.NUI
19 {
20     /// <summary>
21     /// [Draft] This class implements a linear box layout, automatically handling right to left or left to right direction change.
22     /// </summary>
23     internal class LinearLayout : LayoutGroupWrapper
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26
27         internal LinearLayout(global::System.IntPtr cPtr, bool cMemoryOwn) : base(LayoutPINVOKE.LinearLayout_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(LinearLayout 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             if (swigCPtr.Handle != global::System.IntPtr.Zero)
56             {
57                 if (swigCMemOwn)
58                 {
59                     swigCMemOwn = false;
60                     LayoutPINVOKE.delete_LinearLayout(swigCPtr);
61                 }
62                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
63             }
64             base.Dispose(type);
65         }
66
67         internal static new class ChildProperty
68         {
69             internal static readonly int WEIGHT = LayoutPINVOKE.LinearLayout_ChildProperty_WEIGHT_get();
70         }
71         public LinearLayout() : this(LayoutPINVOKE.LinearLayout_New(), true)
72         {
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74         }
75
76         public static LinearLayout DownCast(BaseHandle handle)
77         {
78             LinearLayout ret = new LinearLayout(LayoutPINVOKE.LinearLayout_DownCast(BaseHandle.getCPtr(handle)), true);
79             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80             return ret;
81         }
82
83         internal LinearLayout(LinearLayout other) : this(LayoutPINVOKE.new_LinearLayout__SWIG_1(LinearLayout.getCPtr(other)), true)
84         {
85             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86         }
87
88         internal LinearLayout Assign(LinearLayout other)
89         {
90             LinearLayout ret = new LinearLayout(LayoutPINVOKE.LinearLayout_Assign(swigCPtr, LinearLayout.getCPtr(other)), false);
91             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
92             return ret;
93         }
94
95         internal void SetCellPadding(LayoutSize size)
96         {
97             LayoutPINVOKE.LinearLayout_SetCellPadding(swigCPtr, LayoutSize.getCPtr(size));
98             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99         }
100
101         internal LayoutSize GetCellPadding()
102         {
103             LayoutSize ret = new LayoutSize(LayoutPINVOKE.LinearLayout_GetCellPadding(swigCPtr), true);
104             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
105             return ret;
106         }
107
108
109         internal void SetOrientation(LinearLayout.Orientation orientation)
110         {
111             LayoutPINVOKE.LinearLayout_SetOrientation(swigCPtr, (int)orientation);
112             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113         }
114
115         internal LinearLayout.Orientation GetOrientation()
116         {
117             LinearLayout.Orientation ret = (LinearLayout.Orientation)LayoutPINVOKE.LinearLayout_GetOrientation(swigCPtr);
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119             return ret;
120         }
121
122         internal void SetAlignment(LinearLayout.Alignment alignment)
123         {
124             LayoutPINVOKE.LinearLayout_SetAlignment(swigCPtr, (uint)alignment);
125             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126         }
127
128         internal LinearLayout.Alignment GetAlignment()
129         {
130             LinearLayout.Alignment ret = (LinearLayout.Alignment)LayoutPINVOKE.LinearLayout_GetAlignment(swigCPtr);
131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132             return ret;
133         }
134
135         internal enum PropertyRange
136         {
137             CHILD_PROPERTY_START_INDEX = PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX,
138             CHILD_PROPERTY_END_INDEX = PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX + 1000
139         }
140
141         /// <summary>
142         /// [Draft] Get/Set the orientation in the layout
143         /// </summary>
144         public LinearLayout.Orientation LinearOrientation
145         {
146             get
147             {
148                 return GetOrientation();
149             }
150             set
151             {
152                 SetOrientation(value);
153             }
154         }
155
156         /// <summary>
157         /// [Draft] Get/Set the padding between cells in the layout
158         /// </summary>
159         public LayoutSize CellPadding
160         {
161             get
162             {
163                 return GetCellPadding();
164             }
165             set
166             {
167                 SetCellPadding(value);
168             }
169         }
170
171         /// <summary>
172         /// [Draft] Get/Set the alignment in the layout
173         /// </summary>
174         public LinearLayout.Alignment LinearAlignment
175         {
176             get
177             {
178                 return GetAlignment();
179             }
180             set
181             {
182                 SetAlignment(value);
183             }
184         }
185
186         /// <summary>
187         /// [Draft] Enumeration for the direction in which the content is laid out
188         /// </summary>
189         public enum Orientation
190         {
191             /// <summary>
192             /// Horizontal (row)
193             /// </summary>
194             Horizontal,
195             /// <summary>
196             /// Vertical (column)
197             /// </summary>
198             Vertical
199         }
200
201         /// <summary>
202         /// [Draft] Enumeration for the alignment of the linear layout items
203         /// </summary>
204         public enum Alignment
205         {
206             /// <summary>
207             /// At the left/right edge of the container (maps to LTR/RTL direction for horizontal orientation)
208             /// </summary>
209             Begin              = 0x1,
210             /// <summary>
211             /// At the right/left edge of the container (maps to LTR/RTL direction for horizontal orientation)
212             /// </summary>
213             End                = 0x2,
214             /// <summary>
215             /// At the horizontal center of the container
216             /// </summary>
217             CenterHorizontal   = 0x4,
218             /// <summary>
219             /// At the top edge of the container
220             /// </summary>
221             Top                = 0x8,
222             /// <summary>
223             /// At the bottom edge of the container
224             /// </summary>
225             Bottom             = 0x10,
226             /// <summary>
227             /// At the vertical center of the container
228             /// </summary>
229             CenterVertical     = 0x20
230         }
231
232     }
233
234 }