-/* Copyright (c) 2020 Samsung Electronics Co., Ltd.
+/* Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
private float mPageFlickThreshold = 0.4f;
private float mScrollingEventThreshold = 0.001f;
- private class ScrollableBaseCustomLayout : LayoutGroup
+ private class ScrollableBaseCustomLayout : AbsoluteLayout
{
protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
{
scrollableBase.OnScrollingChildRelayout(null, null);
}
}
-
- protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
- {
- foreach (LayoutItem childLayout in LayoutChildren)
- {
- if (childLayout != null && childLayout.Owner.Name == "ContentContainer")
- {
- LayoutLength childWidth = childLayout.MeasuredWidth.Size;
- LayoutLength childHeight = childLayout.MeasuredHeight.Size;
-
- Position2D childPosition = childLayout.Owner.Position2D;
-
- LayoutLength childLeft = new LayoutLength(childPosition.X);
- LayoutLength childTop = new LayoutLength(childPosition.Y);
-
- childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight, true);
- }
- }
- }
} // ScrollableBaseCustomLayout
/// <summary>
ContentContainer = new View()
{
Name = "ContentContainer",
- ExcludeLayouting = false,
WidthSpecification = ScrollingDirection == Direction.Vertical ? LayoutParamPolicies.MatchParent : LayoutParamPolicies.WrapContent,
HeightSpecification = ScrollingDirection == Direction.Vertical ? LayoutParamPolicies.WrapContent : LayoutParamPolicies.MatchParent,
};
*/
using System;
+using System.Collections.Generic;
using Tizen.NUI.BaseComponents;
namespace Tizen.NUI
private int totalHorizontalExpand = 0;
private int totalVerticalExpand = 0;
- private GridChild[] gridChildren;
+ private List<GridChild> gridChildren;
/// <summary>
/// The nested class to represent a node of DAG.
private void InitChildrenData(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
{
- int gridChildCount = 0;
- for (int i = 0; i < LayoutChildren.Count; i++)
- {
- LayoutItem item = LayoutChildren[i];
- View view = item?.Owner;
- if (view == null) continue;
- if (!item.Owner.ExcludeLayouting)
- {
- gridChildCount++;
- }
- }
bool isHorizontal = (GridOrientation == Orientation.Horizontal);
int mainPivot = 0, subPivot = 0;
int[] pivotStack = new int[isHorizontal ? Columns : Rows];
vLocations = hLocations = null;
vEdgeList = hEdgeList = null;
- gridChildren = new GridChild[gridChildCount];
+ gridChildren = new List<GridChild>();
maxColumnConut = Columns;
maxRowCount = Rows;
totalVerticalExpand = 0;
totalHorizontalExpand = 0;
- for (int i = 0, gridChildIndex = 0; i < LayoutChildren.Count; i++, gridChildIndex++)
+ foreach (LayoutItem item in IterateLayoutChildren())
{
- LayoutItem item = LayoutChildren[i];
-
- View view = item?.Owner;
- if (view == null) continue;
-
- if (view.ExcludeLayouting)
- {
- MeasureChildWithoutPadding(item, widthMeasureSpec, heightMeasureSpec);
- gridChildIndex--;
- continue;
- }
-
int column, columnSpan, row, rowSpan;
StretchFlags verticalStretch, horizontalStretch;
+ View view = item.Owner;
column = GetColumn(view);
columnSpan = GetColumnSpan(view);
else
Tizen.Log.Error("NUI", "Row + RowSapn exceeds Grid Rows. Row + RowSapn (" + row + " + " + rowSpan + ") > Grid Rows(" + maxRowCount + ")");
- gridChildren[gridChildIndex] = new GridChild(null, new Node(0, 1, 0, 0), new Node(0, 1, 0, 0));
+ gridChildren.Add(new GridChild(null, new Node(0, 1, 0, 0), new Node(0, 1, 0, 0)));
continue;
}
maxRowCount = row + rowSpan;
MeasureChildWithMargins(item, widthMeasureSpec, new LayoutLength(0), heightMeasureSpec, new LayoutLength(0));
- gridChildren[gridChildIndex] = new GridChild(item,
- new Node(column, columnSpan, item.MeasuredWidth.Size.AsDecimal() + item.Owner.Margin.Start + item.Owner.Margin.End, horizontalStretch),
- new Node(row, rowSpan, item.MeasuredHeight.Size.AsDecimal() + item.Owner.Margin.Top + item.Owner.Margin.Bottom, verticalStretch));
+ gridChildren.Add(new GridChild(item,
+ new Node(column, columnSpan, item.MeasuredWidth.Size.AsDecimal() + item.Owner.Margin.Start + item.Owner.Margin.End, horizontalStretch),
+ new Node(row, rowSpan, item.MeasuredHeight.Size.AsDecimal() + item.Owner.Margin.Top + item.Owner.Margin.Bottom, verticalStretch)));
}
}
bool isHorizontal = (edgeList == hEdgeList);
int axisCount = isHorizontal ? Columns : Rows;
- edgeList = new Node[gridChildren.Length + axisCount];
+ edgeList = new Node[gridChildren.Count + axisCount];
- for (int i = 0; i < gridChildren.Length; i++)
+ for (int i = 0; i < gridChildren.Count; i++)
edgeList[i] = isHorizontal ? gridChildren[i].Column : gridChildren[i].Row;
// Add virtual edge that have no edge for connecting adjacent cells.
- for (int i = gridChildren.Length, end = gridChildren.Length + axisCount, v = 0; i < end; i++, v++)
+ for (int i = gridChildren.Count, end = gridChildren.Count + axisCount, v = 0; i < end; i++, v++)
edgeList[i] = new Node(v, 1, 0, 0);
Array.Sort(edgeList, (a, b) => a.Start.CompareTo(b.Start));
MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
- for (int i = 0; i < LayoutChildren.Count; i++)
+ foreach (LayoutItem childLayout in IterateLayoutChildren())
{
- LayoutItem childLayout = LayoutChildren[i];
- if (childLayout != null)
- {
- // Get size of child with no padding, no margin. we won't support margin, padding for AbsolutLayout.
- MeasureChildWithoutPadding(childLayout, widthMeasureSpec, heightMeasureSpec);
-
- if (childLayout.Owner.ExcludeLayouting)
- {
- continue;
- }
+ // Get size of child with no padding, no margin. we won't support margin, padding for AbsolutLayout.
+ MeasureChildWithoutPadding(childLayout, widthMeasureSpec, heightMeasureSpec);
- // Determine the width and height needed by the children using their given position and size.
- // Children could overlap so find the right most child.
- Position2D childPosition = childLayout.Owner.Position2D;
- float childRight = childLayout.MeasuredWidth.Size.AsDecimal() + childPosition.X;
- float childBottom = childLayout.MeasuredHeight.Size.AsDecimal() + childPosition.Y;
+ // Determine the width and height needed by the children using their given position and size.
+ // Children could overlap so find the right most child.
+ Position2D childPosition = childLayout.Owner.Position2D;
+ float childRight = childLayout.MeasuredWidth.Size.AsDecimal() + childPosition.X;
+ float childBottom = childLayout.MeasuredHeight.Size.AsDecimal() + childPosition.Y;
- if (maxWidth < childRight)
- maxWidth = childRight;
+ if (maxWidth < childRight)
+ maxWidth = childRight;
- if (maxHeight < childBottom)
- maxHeight = childBottom;
+ if (maxHeight < childBottom)
+ maxHeight = childBottom;
- if (childLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
- {
- childWidthState = MeasuredSize.StateType.MeasuredSizeTooSmall;
- }
- if (childLayout.MeasuredHeight.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
- {
- childHeightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
- }
+ if (childLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
+ {
+ childWidthState = MeasuredSize.StateType.MeasuredSizeTooSmall;
+ }
+ if (childLayout.MeasuredHeight.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
+ {
+ childHeightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
}
}
{
// Absolute layout positions it's children at their Actor positions.
// Children could overlap or spill outside the parent, as is the nature of absolute positions.
- for (int i = 0; i < LayoutChildren.Count; i++)
+ foreach (LayoutItem childLayout in IterateLayoutChildren())
{
- LayoutItem childLayout = LayoutChildren[i];
- if (childLayout != null)
- {
- LayoutLength childWidth = childLayout.MeasuredWidth.Size;
- LayoutLength childHeight = childLayout.MeasuredHeight.Size;
+ LayoutLength childWidth = childLayout.MeasuredWidth.Size;
+ LayoutLength childHeight = childLayout.MeasuredHeight.Size;
- Position2D childPosition = childLayout.Owner.Position2D;
+ Position2D childPosition = childLayout.Owner.Position2D;
- LayoutLength childLeft = new LayoutLength(childPosition.X);
- LayoutLength childTop = new LayoutLength(childPosition.Y);
+ LayoutLength childLeft = new LayoutLength(childPosition.X);
+ LayoutLength childTop = new LayoutLength(childPosition.Y);
- childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight, true);
- }
+ childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight, true);
}
}
}
{
// We need to measure child layout
View child = Registry.GetManagedBaseHandleFromNativePtr(childPtr) as View;
- if (child == null)
+ // independent child will be measured in LayoutGroup.OnMeasureIndependentChildren().
+ if (child?.ExcludeLayouting ?? true)
{
measureSize.width = 0;
measureSize.height = 0;
if (childHandleRef.Handle == IntPtr.Zero || Child == null)
continue;
- if (layoutItem.Owner.ExcludeLayouting)
- {
- MeasureChildWithoutPadding(layoutItem, widthMeasureSpec, heightMeasureSpec);
- continue;
- }
-
AlignmentType flexAlignemnt = GetFlexAlignmentSelf(Child);
PositionType positionType = GetFlexPositionType(Child);
float flexAspectRatio = GetFlexAspectRatio(Child);
// Call to FlexLayout implementation to calculate layout values for later retrieval.
Interop.FlexLayout.FlexLayout_CalculateLayout(swigCPtr, width.AsDecimal(), height.AsDecimal(), isLayoutRtl);
- int count = LayoutChildren.Count;
- for (int childIndex = 0; childIndex < count; childIndex++)
+ for (int childIndex = 0; childIndex < LayoutChildren.Count; childIndex++)
{
LayoutItem childLayout = LayoutChildren[childIndex];
- if (childLayout != null)
+ if (!childLayout?.Owner?.ExcludeLayouting ?? false)
{
- if (!childLayout.Owner.ExcludeLayouting)
- {
- // Get the frame for the child, start, top, end, bottom.
- Vector4 frame = new Vector4(Interop.FlexLayout.FlexLayout_GetNodeFrame(swigCPtr, childIndex), true);
- childLayout.Layout(new LayoutLength(frame.X), new LayoutLength(frame.Y), new LayoutLength(frame.Z), new LayoutLength(frame.W));
- }
+ // Get the frame for the child, start, top, end, bottom.
+ Vector4 frame = new Vector4(Interop.FlexLayout.FlexLayout_GetNodeFrame(swigCPtr, childIndex), true);
+ childLayout.Layout(new LayoutLength(frame.X), new LayoutLength(frame.Y), new LayoutLength(frame.Z), new LayoutLength(frame.W));
}
}
- LayoutForIndependentChild();
}
} // FLexlayout
} // namesspace Tizen.NUI
{
InitChildrenWithExpand(MeasuredWidth.Size - Padding.Start - Padding.End, MeasuredHeight.Size - Padding.Top - Padding.Bottom);
- for (int i = 0; i < gridChildren.Length; i++)
+ for (int i = 0; i < gridChildren.Count; i++)
{
GridChild child = gridChildren[i];
View view = child.LayoutItem?.Owner;
child.LayoutItem.Layout(new LayoutLength(l), new LayoutLength(t), new LayoutLength(l + width), new LayoutLength(t + height));
}
-
- LayoutForIndependentChild();
}
/// <summary>
}
/// <summary>
+ /// returns an enumerable collection of the child layouts that owner's <see cref="View.ExcludeLayouting"/> is false.
+ /// </summary>
+ /// <returns>An enumerable collection of the child layouts that affected by this layout.</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected IEnumerable<LayoutItem> IterateLayoutChildren()
+ {
+ for (int i = 0; i < LayoutChildren.Count; i++)
+ {
+ LayoutItem childLayout = LayoutChildren[i];
+ if (!childLayout?.Owner?.ExcludeLayouting ?? false)
+ {
+ yield return childLayout;
+ }
+ }
+ }
+
+ /// <summary>
/// From ILayoutParent.<br />
/// </summary>
/// <exception cref="ArgumentNullException"> Thrown when childLayout is null. </exception>
new MeasuredSize(measuredHeight, MeasuredSize.StateType.MeasuredSizeOK));
}
+ internal override void OnMeasureIndependentChildren(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
+ {
+ foreach (LayoutItem childLayout in LayoutChildren.Where(item => item?.Owner?.ExcludeLayouting ?? false))
+ {
+ MeasureChildWithoutPadding(childLayout, widthMeasureSpec, heightMeasureSpec);
+ }
+ }
+
/// <summary>
/// Called from Layout() when this layout should assign a size and position to each of its children.<br />
/// Derived classes with children should override this method and call Layout() on each of their children.<br />
/// Layout independent children those Owners have true ExcludeLayouting. <br />
/// These children are required not to be affected by this layout. <br />
/// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected void LayoutForIndependentChild()
+ internal override void OnLayoutIndependentChildren(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
{
- int count = LayoutChildren.Count;
- for (int childIndex = 0; childIndex < count; childIndex++)
+ foreach (LayoutItem childLayout in LayoutChildren.Where(item => item?.Owner?.ExcludeLayouting ?? false))
{
- LayoutItem childLayout = LayoutChildren[childIndex];
- if (childLayout != null)
- {
- if (childLayout.Owner.ExcludeLayouting)
- {
- LayoutLength childWidth = childLayout.MeasuredWidth.Size;
- LayoutLength childHeight = childLayout.MeasuredHeight.Size;
+ LayoutLength childWidth = childLayout.MeasuredWidth.Size;
+ LayoutLength childHeight = childLayout.MeasuredHeight.Size;
- Position2D childPosition = childLayout.Owner.Position2D;
+ Position2D childPosition = childLayout.Owner.Position2D;
- LayoutLength childPositionX = new LayoutLength(childPosition.X);
- LayoutLength childPositionY = new LayoutLength(childPosition.Y);
+ LayoutLength childPositionX = new LayoutLength(childPosition.X);
+ LayoutLength childPositionY = new LayoutLength(childPosition.Y);
- childLayout.Layout(childPositionX, childPositionY, childPositionX + childWidth, childPositionY + childHeight, true);
- }
- }
+ childLayout.Layout(childPositionX, childPositionY, childPositionX + childWidth, childPositionY + childHeight, true);
}
}
if (needsLayout)
{
OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ OnMeasureIndependentChildren(widthMeasureSpec, heightMeasureSpec);
Flags = Flags | LayoutFlags.LayoutRequired;
Flags &= ~LayoutFlags.ForceLayout;
}
if (changed || ((Flags & LayoutFlags.LayoutRequired) == LayoutFlags.LayoutRequired))
{
OnLayout(changed, left, top, right, bottom);
+ OnLayoutIndependentChildren(changed, left, top, right, bottom);
// Clear flag
Flags &= ~LayoutFlags.LayoutRequired;
}
GetDefaultSize(SuggestedMinimumHeight, heightMeasureSpec));
}
+ internal virtual void OnMeasureIndependentChildren(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) { }
+
/// <summary>
/// Called from Layout() when this layout should assign a size and position to each of its children. <br />
/// Derived classes with children should override this method and call Layout() on each of their children. <br />
/// <since_tizen> 6 </since_tizen>
protected virtual void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { }
+ internal virtual void OnLayoutIndependentChildren(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { }
+
/// <summary>
/// Virtual method to allow derived classes to remove any children before it is removed from
/// its parent.
using System;
using Tizen.NUI.BaseComponents;
using System.Collections.Generic;
+using System.Linq;
namespace Tizen.NUI
{
{
LayoutVertical(left, top, right, bottom);
}
- LayoutForIndependentChild();
}
float alternativeMaxHeight = 0.0f;
float weightedMaxHeight = 0.0f;
float totalWeight = 0.0f;
- int childrenCount = 0;
+ int childrenCount = IterateLayoutChildren().Count();
// Reset measure variables
_totalLength = 0.0f;
// Weighted children are not measured at this phase.
// Available space for weighted children will be calculated in the phase 2 based on totalLength value.
// Max height of children is stored.
- for (int i = 0; i < LayoutChildren.Count; i++)
+ foreach (LayoutItem childLayout in IterateLayoutChildren())
{
- LayoutItem childLayout = LayoutChildren[i];
- if (childLayout.Owner.ExcludeLayouting)
- {
- MeasureChildWithoutPadding(childLayout, widthMeasureSpec, heightMeasureSpec);
- continue;
- }
-
- childrenCount++;
int childDesiredHeight = childLayout.Owner.HeightSpecification;
float childWeight = childLayout.Owner.Weight;
Extents childMargin = childLayout.Margin;
maxHeight = 0;
_totalLength = 0;
- int numberOfChildren = LayoutChildren.Count;
- for (int i = 0; i < numberOfChildren; ++i)
+ foreach (LayoutItem childLayout in IterateLayoutChildren())
{
- LayoutItem childLayout = LayoutChildren[i];
- if (childLayout.Owner.ExcludeLayouting)
- {
- continue;
- }
-
float desiredChildHeight = childLayout.Owner.HeightSpecification;
float childWeight = childLayout.Owner.Weight;
float alternativeMaxWidth = 0.0f;
float weightedMaxWidth = 0.0f;
float totalWeight = 0.0f;
- int childrenCount = 0;
+ int childrenCount = IterateLayoutChildren().Count();
// Reset total length
_totalLength = 0.0f;
// to accumulate total used space in _totalLength.
// Weighted children are not measured in this phase.
// Available space for weighted children will be calculated in the phase 2 based on _totalLength value.
- for (int i = 0; i < LayoutChildren.Count; i++)
+ foreach (LayoutItem childLayout in IterateLayoutChildren())
{
- LayoutItem childLayout = LayoutChildren[i];
- if (childLayout.Owner.ExcludeLayouting)
- {
- MeasureChildWithoutPadding(childLayout, widthMeasureSpec, heightMeasureSpec);
- continue;
- }
-
childrenCount++;
int childDesiredWidth = childLayout.Owner.WidthSpecification;
float childWeight = childLayout.Owner.Weight;
maxWidth = 0;
_totalLength = 0;
- int numberOfChildren = LayoutChildren.Count;
- for (int i = 0; i < numberOfChildren; ++i)
+ foreach (LayoutItem childLayout in IterateLayoutChildren())
{
- LayoutItem childLayout = LayoutChildren[i];
- if (childLayout.Owner.ExcludeLayouting)
- {
- continue;
- }
-
float desiredChildWidth = childLayout.Owner.WidthSpecification;
float childWeight = childLayout.Owner.Weight;
// Space available for child
LayoutLength childSpace = new LayoutLength(height - Padding.Top - Padding.Bottom);
- int count = LayoutChildren.Count;
+ List<LayoutItem> LinearChildren = IterateLayoutChildren().ToList();
+ int count = LinearChildren.Count;
switch (LinearAlignment)
{
{
int childIndex = start + dir * i;
// Get a reference to the childLayout at the given index
- LayoutItem childLayout = LayoutChildren[childIndex];
- if (childLayout != null)
- {
- if (!childLayout.Owner.ExcludeLayouting)
- {
- LayoutLength childWidth = childLayout.MeasuredWidth.Size;
- LayoutLength childHeight = childLayout.MeasuredHeight.Size;
- Extents childMargin = childLayout.Margin;
+ LayoutItem childLayout = LinearChildren[childIndex];
- switch (LinearAlignment)
- {
- case Alignment.Bottom:
- childTop = new LayoutLength(height - Padding.Bottom - childHeight - childMargin.Bottom);
- break;
- case Alignment.CenterVertical:
- case Alignment.Center: // FALLTHROUGH
- childTop = new LayoutLength(Padding.Top + ((childSpace - childHeight).AsDecimal() / 2.0f) + childMargin.Top - childMargin.Bottom);
- break;
- case Alignment.Top: // FALLTHROUGH default
- default:
- childTop = new LayoutLength(Padding.Top + childMargin.Top);
- break;
- }
- childLeft += childMargin.Start;
- childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
- childLeft += childWidth + childMargin.End + ((i < count - 1) ? CellPadding.Width : 0);
- }
+ LayoutLength childWidth = childLayout.MeasuredWidth.Size;
+ LayoutLength childHeight = childLayout.MeasuredHeight.Size;
+ Extents childMargin = childLayout.Margin;
+
+ switch (LinearAlignment)
+ {
+ case Alignment.Bottom:
+ childTop = new LayoutLength(height - Padding.Bottom - childHeight - childMargin.Bottom);
+ break;
+ case Alignment.CenterVertical:
+ case Alignment.Center: // FALLTHROUGH
+ childTop = new LayoutLength(Padding.Top + ((childSpace - childHeight).AsDecimal() / 2.0f) + childMargin.Top - childMargin.Bottom);
+ break;
+ case Alignment.Top: // FALLTHROUGH default
+ default:
+ childTop = new LayoutLength(Padding.Top + childMargin.Top);
+ break;
}
+ childLeft += childMargin.Start;
+ childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
+ childLeft += childWidth + childMargin.End + ((i < count - 1) ? CellPadding.Width : 0);
}
} // LayoutHorizontally
// Space available for child
LayoutLength childSpace = new LayoutLength(width - Padding.Start - Padding.End);
- int count = LayoutChildren.Count;
+ List<LayoutItem> LinearChildren = IterateLayoutChildren().ToList();
+ int count = LinearChildren.Count;
switch (LinearAlignment)
{
for (int i = 0; i < count; i++)
{
- LayoutItem childLayout = LayoutChildren[i];
- if (childLayout != null)
- {
- if (!childLayout.Owner.ExcludeLayouting)
- {
- LayoutLength childWidth = childLayout.MeasuredWidth.Size;
- LayoutLength childHeight = childLayout.MeasuredHeight.Size;
- Extents childMargin = childLayout.Margin;
+ LayoutItem childLayout = LinearChildren[i];
- childTop += childMargin.Top;
- switch (LinearAlignment)
+ LayoutLength childWidth = childLayout.MeasuredWidth.Size;
+ LayoutLength childHeight = childLayout.MeasuredHeight.Size;
+ Extents childMargin = childLayout.Margin;
+
+ childTop += childMargin.Top;
+ switch (LinearAlignment)
+ {
+ case Alignment.Begin:
+ default:
{
- case Alignment.Begin:
- default:
- {
- childLeft = new LayoutLength(Padding.Start + childMargin.Start);
- break;
- }
- case Alignment.End:
- {
- childLeft = new LayoutLength(width - Padding.End - childWidth - childMargin.End);
- break;
- }
- case Alignment.CenterHorizontal:
- case Alignment.Center: // FALL THROUGH
- {
- childLeft = new LayoutLength(Padding.Start + ((childSpace - childWidth).AsDecimal() / 2.0f) + childMargin.Start - childMargin.End);
- break;
- }
+ childLeft = new LayoutLength(Padding.Start + childMargin.Start);
+ break;
+ }
+ case Alignment.End:
+ {
+ childLeft = new LayoutLength(width - Padding.End - childWidth - childMargin.End);
+ break;
+ }
+ case Alignment.CenterHorizontal:
+ case Alignment.Center: // FALL THROUGH
+ {
+ childLeft = new LayoutLength(Padding.Start + ((childSpace - childWidth).AsDecimal() / 2.0f) + childMargin.Start - childMargin.End);
+ break;
}
- childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
- childTop += childHeight + childMargin.Bottom + ((i < count - 1) ? CellPadding.Height : 0);
- }
}
+ childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
+ childTop += childHeight + childMargin.Bottom + ((i < count - 1) ? CellPadding.Height : 0);
}
} // LayoutVertical
// ourselves. The measured height should be the max height of the children, changed
// to accommodate the heightMeasureSpec from the parent
MeasureSpecification uniformMeasureSpec = new MeasureSpecification(MeasuredHeight.Size, MeasureSpecification.ModeType.Exactly);
- foreach (LayoutItem childLayout in LayoutChildren)
+ foreach (LayoutItem childLayout in IterateLayoutChildren())
{
- if (childLayout.Owner.ExcludeLayouting)
- {
- continue;
- }
int desiredChildHeight = childLayout.Owner.HeightSpecification;
int desiredChildWidth = childLayout.Owner.WidthSpecification;
{
// Pretend that the linear layout has an exact size.
MeasureSpecification uniformMeasureSpec = new MeasureSpecification(MeasuredWidth.Size, MeasureSpecification.ModeType.Exactly);
- foreach (LayoutItem childLayout in LayoutChildren)
+ foreach (LayoutItem childLayout in IterateLayoutChildren())
{
- if (childLayout.Owner.ExcludeLayouting)
- {
- continue;
- }
-
int desiredChildWidth = childLayout.Owner.WidthSpecification;
int desiredChildHeight = childLayout.Owner.WidthSpecification;