Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
VerticalCells.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
3using Waher.Script;
4
6{
11 {
12 private readonly List<Padding> measured = new List<Padding>();
13 private readonly Variables session;
14 private float y = 0;
15 private float maxWidth = 0;
16
21 public VerticalCells(Variables Session)
22 {
23 this.session = Session;
24 }
25
30 public Task Add(ILayoutElement Element)
31 {
32 this.measured.Add(new Padding(Element, 0, this.y));
33 this.y += Element.Height ?? 0;
34
35 float Width = Element.Width ?? 0;
36 if (Width > this.maxWidth)
37 this.maxWidth = Width;
38
39 return Task.CompletedTask;
40 }
41
45 public void Flush()
46 {
47 }
48
53 public void MeasurePositions(DrawingState State)
54 {
55 ILayoutElement Element;
56
57 foreach (Padding P in this.measured)
58 {
59 Element = P.Element;
60
61 Element.MeasurePositions(State);
62 P.OffsetX -= Element.Left ?? 0;
63 P.OffsetY -= Element.Top ?? 0;
64 }
65 }
66
70 public float TotWidth => this.maxWidth;
71
75 public float TotHeight => this.y;
76
81 public void Distribute(bool SetPosition)
82 {
83 foreach (Padding P in this.measured)
84 P.Distribute(this.maxWidth, null, this.session, SetPosition);
85 }
86
91 public Padding[] Align()
92 {
93 return this.measured.ToArray();
94 }
95 }
96}
Provides padding for a layout element in a group contruct.
Definition: Padding.cs:11
Task Distribute(float? MaxWidth, float? MaxHeight, Variables Session, bool SetPosition)
Aligns a measured cell
Definition: Padding.cs:73
ILayoutElement Element
Embedded element
Definition: Padding.cs:36
void Flush()
Flushes any waiting elements int he layout pipeline.
void Distribute(bool SetPosition)
Distributes cells in layout.
Padding[] Align()
Aligns cells and returns an array of padded cells.
void MeasurePositions(DrawingState State)
Measures layout entities and defines unassigned properties, related to positions.
VerticalCells(Variables Session)
Lays ut cells vertically
Task Add(ILayoutElement Element)
Adds a cell to the layout.
Collection of variables.
Definition: Variables.cs:25
Basic interface for cell layout objects.
Definition: ICellLayout.cs:9
Base interface for all layout elements.
void MeasurePositions(DrawingState State)
Measures layout entities and defines unassigned properties, related to positions.