*/
using System;
+using System.ComponentModel;
using Tizen.NUI.BaseComponents;
using System.Collections.Generic;
using System.Linq;
/// </summary>
public class LinearLayout : LayoutGroup
{
+ private Alignment linearAlignment = Alignment.Top;
+
/// <summary>
/// [Draft] Enumeration for the direction in which the content is laid out
/// </summary>
/// [Draft] Get/Set the alignment in the layout
/// </summary>
/// <since_tizen> 6 </since_tizen>
- public LinearLayout.Alignment LinearAlignment { get; set; } = Alignment.Top;
+ public LinearLayout.Alignment LinearAlignment
+ {
+ get
+ {
+ return linearAlignment;
+ }
+
+ set
+ {
+ if (linearAlignment == value)
+ {
+ return;
+ }
+
+ linearAlignment = value;
+
+ switch (linearAlignment)
+ {
+ case Alignment.Begin:
+ HorizontalAlignment = HorizontalAlignment.Begin;
+ break;
+ case Alignment.End:
+ HorizontalAlignment = HorizontalAlignment.End;
+ break;
+ case Alignment.CenterHorizontal:
+ HorizontalAlignment = HorizontalAlignment.Center;
+ break;
+ case Alignment.Top:
+ VerticalAlignment = VerticalAlignment.Top;
+ break;
+ case Alignment.Bottom:
+ VerticalAlignment = VerticalAlignment.Bottom;
+ break;
+ case Alignment.CenterVertical:
+ VerticalAlignment = VerticalAlignment.Center;
+ break;
+ case Alignment.Center:
+ HorizontalAlignment = HorizontalAlignment.Center;
+ VerticalAlignment = VerticalAlignment.Center;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Get/Set the horizontal alignment in the layout
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public HorizontalAlignment HorizontalAlignment { get; set; } = HorizontalAlignment.Begin;
+
+ /// <summary>
+ /// Get/Set the vertical alignment in the layout
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public VerticalAlignment VerticalAlignment { get; set; } = VerticalAlignment.Top;
private float totalLength = 0.0f;
private Size2D cellPadding = new Size2D(0, 0);
var LinearChildren = IterateLayoutChildren();
int count = LinearChildren.Count<LayoutItem>();
- switch (LinearAlignment)
+ switch (HorizontalAlignment)
{
- case Alignment.End:
+ case HorizontalAlignment.End:
// totalLength contains the padding already
// In case of RTL map END alignment to the left edge
if (isLayoutRtl)
childLeft = new LayoutLength(Padding.Start + right.AsDecimal() - left.AsDecimal() - totalLength);
}
break;
- case Alignment.CenterHorizontal: // FALL THROUGH
- case Alignment.Center:
+ case HorizontalAlignment.Center:
// totalLength contains the padding already
childLeft = new LayoutLength(Padding.Start + (right.AsDecimal() - left.AsDecimal() - totalLength) / 2.0f);
break;
- case Alignment.Begin: // FALL THROUGH (default)
+ case HorizontalAlignment.Begin: // FALL THROUGH (default)
default:
// totalLength contains the padding already
// In case of RTL map BEGIN alignment to the right edge
LayoutLength childHeight = childLayout.MeasuredHeight.Size;
Extents childMargin = childLayout.Margin;
- switch (LinearAlignment)
+ switch (VerticalAlignment)
{
- case Alignment.Bottom:
+ case VerticalAlignment.Bottom:
childTop = new LayoutLength(height - Padding.Bottom - childHeight - childMargin.Bottom);
break;
- case Alignment.CenterVertical:
- case Alignment.Center: // FALLTHROUGH
+ case VerticalAlignment.Center:
childTop = new LayoutLength(Padding.Top + ((childSpace - childHeight).AsDecimal() / 2.0f) + childMargin.Top - childMargin.Bottom);
break;
- case Alignment.Top: // FALLTHROUGH default
+ case VerticalAlignment.Top: // FALLTHROUGH default
default:
childTop = new LayoutLength(Padding.Top + childMargin.Top);
break;
var LinearChildren = IterateLayoutChildren();
int count = LinearChildren.Count<LayoutItem>();
- switch (LinearAlignment)
+ switch (VerticalAlignment)
{
- case Alignment.Bottom:
+ case VerticalAlignment.Bottom:
// totalLength contains the padding already
childTop = new LayoutLength(Padding.Top + bottom.AsDecimal() - top.AsDecimal() - totalLength);
break;
- case Alignment.CenterVertical: // FALL THROUGH
- case Alignment.Center:
+ case VerticalAlignment.Center:
// totalLength contains the padding already
childTop = new LayoutLength(Padding.Top + (bottom.AsDecimal() - top.AsDecimal() - totalLength) / 2.0f);
break;
- case Alignment.Top: // FALL THROUGH (default)
+ case VerticalAlignment.Top: // FALL THROUGH (default)
default:
// totalLength contains the padding already
childTop = new LayoutLength(Padding.Top);
Extents childMargin = childLayout.Margin;
childTop += childMargin.Top;
- switch (LinearAlignment)
+ switch (HorizontalAlignment)
{
- case Alignment.Begin:
+ case HorizontalAlignment.Begin:
default:
{
childLeft = new LayoutLength(Padding.Start + childMargin.Start);
break;
}
- case Alignment.End:
+ case HorizontalAlignment.End:
{
childLeft = new LayoutLength(width - Padding.End - childWidth - childMargin.End);
break;
}
- case Alignment.CenterHorizontal:
- case Alignment.Center: // FALL THROUGH
+ case HorizontalAlignment.Center:
{
childLeft = new LayoutLength(Padding.Start + ((childSpace - childWidth).AsDecimal() / 2.0f) + childMargin.Start - childMargin.End);
break;
}
/// <summary>
- /// Enumeration for the text horizontal aligning.
+ /// Enumeration for the horizontal alignment of objects such as texts and layout items.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum HorizontalAlignment
{
/// <summary>
- /// Texts place at the begin of horizontal direction.
+ /// Objects are placed at the beginning of the horizontal direction.
/// </summary>
[Description("BEGIN")]
Begin,
/// <summary>
- /// Texts place at the center of horizontal direction.
+ /// Objects are placed at the center of the horizontal direction.
/// </summary>
[Description("CENTER")]
Center,
/// <summary>
- /// Texts place at the end of horizontal direction.
+ /// Objects are placed at the end of the horizontal direction.
/// </summary>
[Description("END")]
End
}
/// <summary>
- /// Enumeration for the text horizontal aligning.
+ /// Enumeration for the vertical alignment of objects such as texts and layout items.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum VerticalAlignment
{
/// <summary>
- /// Texts place at the top of vertical direction.
+ /// Objects are placed at the top of the vertical direction.
/// </summary>
[Description("TOP")]
Top,
/// <summary>
- /// Texts place at the center of vertical direction.
+ /// Objects are placed at the center of the vertical direction.
/// </summary>
[Description("CENTER")]
Center,
/// <summary>
- /// Texts place at the bottom of vertical direction.
+ /// Objects are placed at the bottom of the vertical direction.
/// </summary>
[Description("BOTTOM")]
Bottom