2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 namespace Tizen.NUI.BaseComponents
21 /// FlexContainer implements a subset of the flexbox spec (defined by W3C):https://www.w3.org/TR/css3-flexbox/<br />
22 /// It aims at providing a more efficient way to layout, align, and distribute space among items in the container, even when their size is unknown or dynamic.<br />
23 /// FlexContainer has the ability to alter the width and the height of its children (i.e., flex items) to fill the available space in the best possible way on different screen sizes.<br />
24 /// FlexContainer can expand items to fill available free space, or shrink them to prevent overflow.<br />
26 /// <since_tizen> 3 </since_tizen>
27 public class FlexContainer : View
29 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31 internal FlexContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.FlexContainer_SWIGUpcast(cPtr), cMemoryOwn)
33 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FlexContainer obj)
38 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42 /// To make the FlexContainer instance be disposed.
44 /// <since_tizen> 3 </since_tizen>
45 protected override void Dispose(DisposeTypes type)
52 if(type == DisposeTypes.Explicit)
55 //Release your own managed resources here.
56 //You should release all of your own disposable objects here.
59 //Release your own unmanaged resources here.
60 //You should not access any managed member here except static instance.
61 //because the execution order of Finalizes is non-deterministic.
63 if (swigCPtr.Handle != global::System.IntPtr.Zero)
68 NDalicPINVOKE.delete_FlexContainer(swigCPtr);
70 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
77 internal new class Property
79 internal static readonly int CONTENT_DIRECTION = NDalicPINVOKE.FlexContainer_Property_CONTENT_DIRECTION_get();
80 internal static readonly int FLEX_DIRECTION = NDalicPINVOKE.FlexContainer_Property_FLEX_DIRECTION_get();
81 internal static readonly int FLEX_WRAP = NDalicPINVOKE.FlexContainer_Property_FLEX_WRAP_get();
82 internal static readonly int JUSTIFY_CONTENT = NDalicPINVOKE.FlexContainer_Property_JUSTIFY_CONTENT_get();
83 internal static readonly int ALIGN_ITEMS = NDalicPINVOKE.FlexContainer_Property_ALIGN_ITEMS_get();
84 internal static readonly int ALIGN_CONTENT = NDalicPINVOKE.FlexContainer_Property_ALIGN_CONTENT_get();
89 /// Enumeration for the instance of child properties belonging to the FlexContainer class.
91 /// <since_tizen> 3 </since_tizen>
92 public class ChildProperty
94 internal static readonly int FLEX = NDalicPINVOKE.FlexContainer_ChildProperty_FLEX_get();
95 internal static readonly int ALIGN_SELF = NDalicPINVOKE.FlexContainer_ChildProperty_ALIGN_SELF_get();
96 internal static readonly int FLEX_MARGIN = NDalicPINVOKE.FlexContainer_ChildProperty_FLEX_MARGIN_get();
100 /// Creates a FlexContainer handle.
101 /// Calling member functions with an uninitialized handle is not allowed.
103 /// <since_tizen> 3 </since_tizen>
104 public FlexContainer() : this(NDalicPINVOKE.FlexContainer_New(), true)
106 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111 /// Enumeration for the direction of the main axis in the flex container. This determines
112 /// the direction that flex items are laid out in the flex container.
114 /// <since_tizen> 3 </since_tizen>
115 public enum FlexDirectionType
118 /// The flexible items are displayed vertically as a column.
120 /// <since_tizen> 3 </since_tizen>
123 /// The flexible items are displayed vertically as a column, but in reverse order.
125 /// <since_tizen> 3 </since_tizen>
128 /// The flexible items are displayed horizontally as a row.
130 /// <since_tizen> 3 </since_tizen>
133 /// The flexible items are displayed horizontally as a row.
135 /// <since_tizen> 3 </since_tizen>
140 /// Enumeration for the primary direction in which content is ordered in the flex container
141 /// and on which sides the ?�start??and ?�end??are.
143 /// <since_tizen> 3 </since_tizen>
144 public enum ContentDirectionType
147 /// Inherits the same direction from the parent.
149 /// <since_tizen> 3 </since_tizen>
152 /// From left to right.
154 /// <since_tizen> 3 </since_tizen>
157 /// From right to left.
159 /// <since_tizen> 3 </since_tizen>
164 /// Enumeration for the alignment of the flex items when the items do not use all available
165 /// space on the main axis.
167 /// <since_tizen> 3 </since_tizen>
168 public enum Justification
171 /// Items are positioned at the beginning of the container.
173 /// <since_tizen> 3 </since_tizen>
176 /// Items are positioned at the center of the container.
178 /// <since_tizen> 3 </since_tizen>
181 /// Items are positioned at the end of the container.
183 /// <since_tizen> 3 </since_tizen>
186 /// Items are positioned with equal space between the lines.
188 /// <since_tizen> 3 </since_tizen>
191 /// Items are positioned with equal space before, between, and after the lines.
193 /// <since_tizen> 3 </since_tizen>
198 /// Enumeration for the alignment of the flex items or lines when the items or lines do not
199 /// use all the available space on the cross axis.
201 /// <since_tizen> 3 </since_tizen>
202 public enum Alignment
205 /// Inherits the same alignment from the parent (only valid for "alignSelf" property).
207 /// <since_tizen> 3 </since_tizen>
210 /// At the beginning of the container.
212 /// <since_tizen> 3 </since_tizen>
215 /// At the center of the container.
217 /// <since_tizen> 3 </since_tizen>
220 /// At the end of the container.
222 /// <since_tizen> 3 </since_tizen>
225 /// Stretch to fit the container.
227 /// <since_tizen> 3 </since_tizen>
232 /// Enumeration for the wrap type of the flex container when there is no enough room for
233 /// all the items on one flex line.
235 /// <since_tizen> 3 </since_tizen>
239 /// Flex items laid out in single line (shrunk to fit the flex container along the main axis).
241 /// <since_tizen> 3 </since_tizen>
244 /// Flex items laid out in multiple lines if needed.
246 /// <since_tizen> 3 </since_tizen>
251 /// The primary direction in which content is ordered.
253 /// <since_tizen> 3 </since_tizen>
254 public ContentDirectionType ContentDirection
259 GetProperty(FlexContainer.Property.CONTENT_DIRECTION).Get(out temp);
260 return (ContentDirectionType)temp;
264 SetProperty(FlexContainer.Property.CONTENT_DIRECTION, new Tizen.NUI.PropertyValue((int)value));
269 /// The direction of the main axis which determines the direction that flex items are laid out.
271 /// <since_tizen> 3 </since_tizen>
272 public FlexDirectionType FlexDirection
277 GetProperty(FlexContainer.Property.FLEX_DIRECTION).Get(out temp);
278 return (FlexDirectionType)temp;
282 SetProperty(FlexContainer.Property.FLEX_DIRECTION, new Tizen.NUI.PropertyValue((int)value));
287 /// Whether the flex items should wrap or not if there is no enough room for them on one flex line.
289 /// <since_tizen> 3 </since_tizen>
290 public WrapType FlexWrap
295 GetProperty(FlexContainer.Property.FLEX_WRAP).Get(out temp);
296 return (WrapType)temp;
300 SetProperty(FlexContainer.Property.FLEX_WRAP, new Tizen.NUI.PropertyValue((int)value));
305 /// The alignment of flex items when the items do not use all available space on the main axis.
307 /// <since_tizen> 3 </since_tizen>
308 public Justification JustifyContent
313 GetProperty(FlexContainer.Property.JUSTIFY_CONTENT).Get(out temp);
314 return (Justification)temp;
318 SetProperty(FlexContainer.Property.JUSTIFY_CONTENT, new Tizen.NUI.PropertyValue((int)value));
323 /// The alignment of flex items when the items do not use all available space on the cross axis.
325 /// <since_tizen> 3 </since_tizen>
326 public Alignment AlignItems
331 GetProperty(FlexContainer.Property.ALIGN_ITEMS).Get(out temp);
332 return (Alignment)temp;
336 SetProperty(FlexContainer.Property.ALIGN_ITEMS, new Tizen.NUI.PropertyValue((int)value));
341 /// Similar to "alignItems", but it aligns flex lines; so only works when there are multiple lines.
343 /// <since_tizen> 3 </since_tizen>
344 public Alignment AlignContent
349 GetProperty(FlexContainer.Property.ALIGN_CONTENT).Get(out temp);
350 return (Alignment)temp;
354 SetProperty(FlexContainer.Property.ALIGN_CONTENT, new Tizen.NUI.PropertyValue((int)value));