public FlowLayoutRows(Point availableSize, FlowLayoutStyle flowLayoutStyle, Orientation orientation) { Orientation = orientation; AvailableAlongSize = availableSize.AxisValue(orientation.ToAxis()); AvailablePerpendicularSize = availableSize.OppositeAxisValue(orientation.ToAxis()); Style = flowLayoutStyle; CurrentRow = new FlowLayoutRow(AvailableAlongSize, Style, Orientation); Content.Add(CurrentRow); }
public FlowLayoutRow(int availableAlongSize, FlowLayoutStyle style, Orientation orientation) { Orientation = orientation; AvailableAlongSize = availableAlongSize; FlowLayoutStyle = style; }
private static RawFlowLayout OrientedFlowParent(Orientation orientation, string name, LayoutSize size, FlowLayoutStyle style, params LayoutNodeOrInstruction[] children) { var workableAreaStyle = new LayoutStyle(margin: style.Margin, alignment: style.Alignment); var workableArea = LayoutNode.NamelessOneOffParent(size, workableAreaStyle, LayoutNode.Leaf("workableArea", LayoutSize.StretchedBoth())).Bake().GetNode("workableArea"); var rows = new FlowLayoutRows(workableArea.Size, style, orientation); foreach (var item in children) { if (item.IsLayoutNode) { if (!rows.CanFitItemPerpendicular(item)) { break; } if (rows.CanFitItemAlongCurrentRow(item)) { rows.AddItemToCurrentRow(item); } else { rows.CreateNextRowAndAdd(item); } } else if (item.IsInstruction) { rows.ConsumeInstruction(item); } } return(new RawFlowLayout(name, size, workableAreaStyle, orientation, style, rows)); }
public static RawFlowLayout VerticalFlowParent(string name, LayoutSize size, FlowLayoutStyle style, params LayoutNodeOrInstruction[] children) { return(OrientedFlowParent(Orientation.Vertical, name, size, style, children)); }
internal RawFlowLayout(string name, LayoutSize size, LayoutStyle workableAreaStyle, Orientation orientation, FlowLayoutStyle style, FlowLayoutRows rows) : base( LayoutNode.OneOffParent(name, size, workableAreaStyle, LayoutNode.OrientedParent(orientation.Opposite(), "rows", LayoutSize.Pixels(rows.UsedSize), new LayoutStyle(padding: style.PaddingBetweenRows), rows.GetLayoutNodesOfEachRow() ) )) { this.orientation = orientation; this.rowNodes = rows.GetLayoutNodesOfEachRow(); this.rowUsedSpace = rows.GetUsedSpaceOfEachRow(); }