[NUI] Sync dalihub and Samsung TizenFX (#349)
[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         public LinearLayout() : this(LayoutPINVOKE.LinearLayout_New(), true)
68         {
69             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
70         }
71
72         public new static LinearLayout DownCast(BaseHandle handle)
73         {
74             LinearLayout ret = new LinearLayout(LayoutPINVOKE.LinearLayout_DownCast(BaseHandle.getCPtr(handle)), true);
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76             return ret;
77         }
78
79         internal LinearLayout(LinearLayout other) : this(LayoutPINVOKE.new_LinearLayout__SWIG_1(LinearLayout.getCPtr(other)), true)
80         {
81             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82         }
83
84         internal LinearLayout Assign(LinearLayout other)
85         {
86             LinearLayout ret = new LinearLayout(LayoutPINVOKE.LinearLayout_Assign(swigCPtr, LinearLayout.getCPtr(other)), false);
87             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88             return ret;
89         }
90
91         internal void SetCellPadding(LayoutSize size)
92         {
93             LayoutPINVOKE.LinearLayout_SetCellPadding(swigCPtr, LayoutSize.getCPtr(size));
94             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95         }
96
97         internal LayoutSize GetCellPadding()
98         {
99             LayoutSize ret = new LayoutSize(LayoutPINVOKE.LinearLayout_GetCellPadding(swigCPtr), true);
100             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101             return ret;
102         }
103
104
105         internal void SetOrientation(LinearLayout.Orientation orientation)
106         {
107             LayoutPINVOKE.LinearLayout_SetOrientation(swigCPtr, (int)orientation);
108             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109         }
110
111         internal LinearLayout.Orientation GetOrientation()
112         {
113             LinearLayout.Orientation ret = (LinearLayout.Orientation)LayoutPINVOKE.LinearLayout_GetOrientation(swigCPtr);
114             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115             return ret;
116         }
117
118         internal enum PropertyRange
119         {
120             CHILD_PROPERTY_START_INDEX = PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX,
121             CHILD_PROPERTY_END_INDEX = PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX + 1000
122         }
123
124         /// <summary>
125         /// [Draft] Get/Set the orientation in the layout
126         /// </summary>
127         public LinearLayout.Orientation LinearOrientation
128         {
129             get
130             {
131                 return GetOrientation();
132             }
133             set
134             {
135                 SetOrientation(value);
136             }
137         }
138
139         /// <summary>
140         /// [Draft] Get/Set the padding between cells in the layout
141         /// </summary>
142         public LayoutSize CellPadding
143         {
144             get
145             {
146                 return GetCellPadding();
147             }
148             set
149             {
150                 SetCellPadding(value);
151             }
152         }
153
154         /// <summary>
155         /// [Draft] Enumeration for the direction in which the content is laid out   */
156         /// </summary>
157         public enum Orientation
158         {
159             /// <summary>
160             /// Horizontal (row)
161             /// </summary>
162             Horizontal,
163             /// <summary>
164             /// Vertical (column)
165             /// </summary>
166             Vertical
167         }
168
169     }
170
171 }