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 using System.ComponentModel;
19 using Tizen.NUI.Binding;
21 namespace Tizen.NUI.BaseComponents
24 /// FlexContainer implements a subset of the flexbox spec (defined by W3C):https://www.w3.org/TR/css3-flexbox/<br />
25 /// 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 />
26 /// 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 />
27 /// FlexContainer can expand items to fill available free space, or shrink them to prevent overflow.<br />
29 /// <since_tizen> 3 </since_tizen>
30 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
31 public class FlexContainer : View
33 /// <summary> Property of ContentDirection </summary>
34 [EditorBrowsable(EditorBrowsableState.Never)]
35 public static readonly BindableProperty ContentDirectionProperty = BindableProperty.Create(nameof(ContentDirection), typeof(ContentDirectionType), typeof(FlexContainer), ContentDirectionType.Inherit, propertyChanged: (bindable, oldValue, newValue) =>
37 var flexContainer = (FlexContainer)bindable;
40 Tizen.NUI.Object.SetProperty(flexContainer.swigCPtr, FlexContainer.Property.CONTENT_DIRECTION, new Tizen.NUI.PropertyValue((int)newValue));
43 defaultValueCreator: (bindable) =>
45 var flexContainer = (FlexContainer)bindable;
47 Tizen.NUI.Object.GetProperty(flexContainer.swigCPtr, FlexContainer.Property.CONTENT_DIRECTION).Get(out temp);
48 return (ContentDirectionType)temp;
50 /// <summary> Property of FlexDirection </summary>
51 [EditorBrowsable(EditorBrowsableState.Never)]
52 public static readonly BindableProperty FlexDirectionProperty = BindableProperty.Create(nameof(FlexDirection), typeof(FlexDirectionType), typeof(FlexContainer), FlexDirectionType.Column, propertyChanged: (bindable, oldValue, newValue) =>
54 var flexContainer = (FlexContainer)bindable;
57 Tizen.NUI.Object.SetProperty(flexContainer.swigCPtr, FlexContainer.Property.FLEX_DIRECTION, new Tizen.NUI.PropertyValue((int)newValue));
60 defaultValueCreator: (bindable) =>
62 var flexContainer = (FlexContainer)bindable;
64 Tizen.NUI.Object.GetProperty(flexContainer.swigCPtr, FlexContainer.Property.FLEX_DIRECTION).Get(out temp);
65 return (FlexDirectionType)temp;
67 /// <summary> Property of FlexWrap </summary>
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public static readonly BindableProperty FlexWrapProperty = BindableProperty.Create(nameof(FlexWrap), typeof(WrapType), typeof(FlexContainer), WrapType.NoWrap, propertyChanged: (bindable, oldValue, newValue) =>
71 var flexContainer = (FlexContainer)bindable;
74 Tizen.NUI.Object.SetProperty(flexContainer.swigCPtr, FlexContainer.Property.FLEX_WRAP, new Tizen.NUI.PropertyValue((int)newValue));
77 defaultValueCreator: (bindable) =>
79 var flexContainer = (FlexContainer)bindable;
81 Tizen.NUI.Object.GetProperty(flexContainer.swigCPtr, FlexContainer.Property.FLEX_WRAP).Get(out temp);
82 return (WrapType)temp;
84 /// <summary> Property of JustifyContent </summary>
85 [EditorBrowsable(EditorBrowsableState.Never)]
86 public static readonly BindableProperty JustifyContentProperty = BindableProperty.Create(nameof(JustifyContent), typeof(Justification), typeof(FlexContainer), Justification.JustifyFlexStart, propertyChanged: (bindable, oldValue, newValue) =>
88 var flexContainer = (FlexContainer)bindable;
91 Tizen.NUI.Object.SetProperty(flexContainer.swigCPtr, FlexContainer.Property.JUSTIFY_CONTENT, new Tizen.NUI.PropertyValue((int)newValue));
94 defaultValueCreator: (bindable) =>
96 var flexContainer = (FlexContainer)bindable;
98 Tizen.NUI.Object.GetProperty(flexContainer.swigCPtr, FlexContainer.Property.JUSTIFY_CONTENT).Get(out temp);
99 return (Justification)temp;
101 /// <summary> Property of AlignItems </summary>
102 [EditorBrowsable(EditorBrowsableState.Never)]
103 public static readonly BindableProperty AlignItemsProperty = BindableProperty.Create(nameof(AlignItems), typeof(Alignment), typeof(FlexContainer), Alignment.AlignAuto, propertyChanged: (bindable, oldValue, newValue) =>
105 var flexContainer = (FlexContainer)bindable;
106 if (newValue != null)
108 Tizen.NUI.Object.SetProperty(flexContainer.swigCPtr, FlexContainer.Property.ALIGN_ITEMS, new Tizen.NUI.PropertyValue((int)newValue));
111 defaultValueCreator: (bindable) =>
113 var flexContainer = (FlexContainer)bindable;
115 Tizen.NUI.Object.GetProperty(flexContainer.swigCPtr, FlexContainer.Property.ALIGN_ITEMS).Get(out temp);
116 return (Alignment)temp;
118 /// <summary> Property of AlignContent </summary>
119 [EditorBrowsable(EditorBrowsableState.Never)]
120 public static readonly BindableProperty AlignContentProperty = BindableProperty.Create(nameof(AlignContent), typeof(Alignment), typeof(FlexContainer), Alignment.AlignAuto, propertyChanged: (bindable, oldValue, newValue) =>
122 var flexContainer = (FlexContainer)bindable;
123 if (newValue != null)
125 Tizen.NUI.Object.SetProperty(flexContainer.swigCPtr, FlexContainer.Property.ALIGN_CONTENT, new Tizen.NUI.PropertyValue((int)newValue));
128 defaultValueCreator: (bindable) =>
130 var flexContainer = (FlexContainer)bindable;
132 Tizen.NUI.Object.GetProperty(flexContainer.swigCPtr, FlexContainer.Property.ALIGN_CONTENT).Get(out temp);
133 return (Alignment)temp;
138 /// Creates a FlexContainer handle.
139 /// Calling member functions with an uninitialized handle is not allowed.
141 /// <since_tizen> 3 </since_tizen>
142 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
143 public FlexContainer() : this(Interop.FlexContainer.FlexContainer_New(), true)
145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148 internal FlexContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.FlexContainer.FlexContainer_SWIGUpcast(cPtr), cMemoryOwn)
153 /// Enumeration for the direction of the main axis in the flex container. This determines
154 /// the direction that flex items are laid out in the flex container.
156 /// <since_tizen> 3 </since_tizen>
157 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
158 public enum FlexDirectionType
161 /// The flexible items are displayed vertically as a column.
163 /// <since_tizen> 3 </since_tizen>
164 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
167 /// The flexible items are displayed vertically as a column, but in reverse order.
169 /// <since_tizen> 3 </since_tizen>
170 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
173 /// The flexible items are displayed horizontally as a row.
175 /// <since_tizen> 3 </since_tizen>
176 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
179 /// The flexible items are displayed horizontally as a row.
181 /// <since_tizen> 3 </since_tizen>
182 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
187 /// Enumeration for the primary direction in which content is ordered in the flex container
188 /// and on which sides the ?�start??and ?�end??are.
190 /// <since_tizen> 3 </since_tizen>
191 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
192 public enum ContentDirectionType
195 /// Inherits the same direction from the parent.
197 /// <since_tizen> 3 </since_tizen>
198 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
201 /// From left to right.
203 /// <since_tizen> 3 </since_tizen>
204 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
207 /// From right to left.
209 /// <since_tizen> 3 </since_tizen>
210 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
215 /// Enumeration for the alignment of the flex items when the items do not use all available
216 /// space on the main axis.
218 /// <since_tizen> 3 </since_tizen>
219 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
220 public enum Justification
223 /// Items are positioned at the beginning of the container.
225 /// <since_tizen> 3 </since_tizen>
226 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
229 /// Items are positioned at the center of the container.
231 /// <since_tizen> 3 </since_tizen>
232 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
235 /// Items are positioned at the end of the container.
237 /// <since_tizen> 3 </since_tizen>
238 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
241 /// Items are positioned with equal space between the lines.
243 /// <since_tizen> 3 </since_tizen>
244 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
247 /// Items are positioned with equal space before, between, and after the lines.
249 /// <since_tizen> 3 </since_tizen>
250 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
255 /// Enumeration for the alignment of the flex items or lines when the items or lines do not
256 /// use all the available space on the cross axis.
258 /// <since_tizen> 3 </since_tizen>
259 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
260 public enum Alignment
263 /// Inherits the same alignment from the parent (only valid for "alignSelf" property).
265 /// <since_tizen> 3 </since_tizen>
266 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
269 /// At the beginning of the container.
271 /// <since_tizen> 3 </since_tizen>
272 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
275 /// At the center of the container.
277 /// <since_tizen> 3 </since_tizen>
278 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
281 /// At the end of the container.
283 /// <since_tizen> 3 </since_tizen>
284 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
287 /// Stretch to fit the container.
289 /// <since_tizen> 3 </since_tizen>
290 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
295 /// Enumeration for the wrap type of the flex container when there is no enough room for
296 /// all the items on one flex line.
298 /// <since_tizen> 3 </since_tizen>
299 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
303 /// Flex items laid out in single line (shrunk to fit the flex container along the main axis).
305 /// <since_tizen> 3 </since_tizen>
306 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
309 /// Flex items laid out in multiple lines if needed.
311 /// <since_tizen> 3 </since_tizen>
312 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
317 /// The primary direction in which content is ordered.
319 /// <since_tizen> 3 </since_tizen>
320 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
321 public ContentDirectionType ContentDirection
325 return (ContentDirectionType)GetValue(ContentDirectionProperty);
329 SetValue(ContentDirectionProperty, value);
330 NotifyPropertyChanged();
335 /// The direction of the main axis which determines the direction that flex items are laid out.
337 /// <since_tizen> 3 </since_tizen>
338 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
339 public FlexDirectionType FlexDirection
343 return (FlexDirectionType)GetValue(FlexDirectionProperty);
347 SetValue(FlexDirectionProperty, value);
348 NotifyPropertyChanged();
353 /// Whether the flex items should wrap or not if there is no enough room for them on one flex line.
355 /// <since_tizen> 3 </since_tizen>
356 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
357 public WrapType FlexWrap
361 return (WrapType)GetValue(FlexWrapProperty);
365 SetValue(FlexWrapProperty, value);
366 NotifyPropertyChanged();
371 /// The alignment of flex items when the items do not use all available space on the main axis.
373 /// <since_tizen> 3 </since_tizen>
374 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
375 public Justification JustifyContent
379 return (Justification)GetValue(JustifyContentProperty);
383 SetValue(JustifyContentProperty, value);
384 NotifyPropertyChanged();
389 /// The alignment of flex items when the items do not use all available space on the cross axis.
391 /// <since_tizen> 3 </since_tizen>
392 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
393 public Alignment AlignItems
397 return (Alignment)GetValue(AlignItemsProperty);
401 SetValue(AlignItemsProperty, value);
402 NotifyPropertyChanged();
407 /// Similar to "alignItems", but it aligns flex lines; so only works when there are multiple lines.
409 /// <since_tizen> 3 </since_tizen>
410 [Obsolete("Deprecated in API8, will be removed in API10. Please use FlexLayout instead!")]
411 public Alignment AlignContent
415 return (Alignment)GetValue(AlignContentProperty);
419 SetValue(AlignContentProperty, value);
420 NotifyPropertyChanged();
425 [EditorBrowsable(EditorBrowsableState.Never)]
426 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
428 Interop.FlexContainer.delete_FlexContainer(swigCPtr);
432 /// Enumeration for the instance of child properties belonging to the FlexContainer class.
434 /// <since_tizen> 3 </since_tizen>
435 [Obsolete("Deprecated in API6, Will be removed in API9, " +
436 "Please use View.Flex, View.AlignSelf, View.FlexMargin instead!")]
437 [EditorBrowsable(EditorBrowsableState.Never)]
438 public class ChildProperty
440 internal static readonly int FLEX = Interop.FlexContainer.FlexContainer_ChildProperty_FLEX_get();
441 internal static readonly int ALIGN_SELF = Interop.FlexContainer.FlexContainer_ChildProperty_ALIGN_SELF_get();
442 internal static readonly int FLEX_MARGIN = Interop.FlexContainer.FlexContainer_ChildProperty_FLEX_MARGIN_get();
445 internal new class Property
447 internal static readonly int CONTENT_DIRECTION = Interop.FlexContainer.FlexContainer_Property_CONTENT_DIRECTION_get();
448 internal static readonly int FLEX_DIRECTION = Interop.FlexContainer.FlexContainer_Property_FLEX_DIRECTION_get();
449 internal static readonly int FLEX_WRAP = Interop.FlexContainer.FlexContainer_Property_FLEX_WRAP_get();
450 internal static readonly int JUSTIFY_CONTENT = Interop.FlexContainer.FlexContainer_Property_JUSTIFY_CONTENT_get();
451 internal static readonly int ALIGN_ITEMS = Interop.FlexContainer.FlexContainer_Property_ALIGN_ITEMS_get();
452 internal static readonly int ALIGN_CONTENT = Interop.FlexContainer.FlexContainer_Property_ALIGN_CONTENT_get();