/// <summary> This will find the longest/tallest widget in each row/collumn and make every other element match. </summary> public static void AutoSizeAllWidgets( WidgetList widgets, int width, int height ) { for (var x = 0; x < width; x++) { GridReader.GetColumn(widgets, width, height, x).AutoSizeWidth(); } for (var y = 0; y < height; y++) { GridReader.GetRow(widgets, width, y).AutoSizeHeight(); } }
public static void AutoSpaceAllWidgets( WidgetList widgets, int width, int height, Point2 start, Point2?spacing = null ) { if (spacing.HasValue) { start = start.WithOffset(spacing.Value); } var position = start; for (var x = 0; x < width; x++) { position.Y = start.Y; for (var y = 0; y < height; y++) { var widget = GridReader.Get(widgets, width, height, x, y); widget.Position = position; position.Y += widget.Height; if (spacing.HasValue) { position.Y += spacing.Value.Y; } } position.X += widgets[x].Width; if (spacing.HasValue) { position.X += spacing.Value.X; } } }