1using System.Threading.Tasks;
24 : base(Document, Parent)
39 set => this.left = value;
48 set => this.right = value;
57 set => this.top = value;
66 set => this.bottom = value;
73 public override Task
FromXml(XmlElement Input)
80 return base.FromXml(Input);
89 base.ExportAttributes(Output);
92 this.right?.
Export(Output);
94 this.bottom?.
Export(Output);
105 return new Margins(Document, Parent);
114 base.CopyContents(Destination);
116 if (Destination is
Margins Dest)
142 this.rightMargin = 0;
154 this.bottomMargin = 0;
160 InnerWidth - this.leftMargin - this.rightMargin,
161 InnerHeight - this.topMargin - this.bottomMargin));
163 await base.DoMeasureDimensions(State);
174 await base.AfterMeasureDimensions(State);
176 this.innerWidth = this.
Width;
177 this.Width = this.innerWidth + this.leftMargin + this.rightMargin;
179 this.innerHeight = this.
Height;
180 this.Height = this.innerHeight + this.topMargin + this.bottomMargin;
201 float? f = base.PotentialWidth;
204 return f.Value - this.leftMargin - this.rightMargin;
217 float? f = base.PotentialHeight;
220 return f.Value - this.topMargin - this.bottomMargin;
236 InnerWidth - this.leftMargin - this.rightMargin,
237 InnerHeight - this.topMargin - this.bottomMargin));
239 base.MeasurePositions(State);
244 private float? innerWidth;
245 private float? innerHeight;
246 private float leftMargin;
247 private float rightMargin;
248 private float topMargin;
249 private float bottomMargin;
257 SKMatrix M = State.
Canvas.TotalMatrix;
258 State.
Canvas.Translate(this.leftMargin, this.topMargin);
260 await base.Draw(State);
262 State.
Canvas.SetMatrix(M);
271 base.ExportStateAttributes(Output);
Contains a 2D layout document.
void Export(XmlWriter Output)
Exports the attribute.
void ExportState(XmlWriter Output)
Exports the state of the attribute.
static async Task< EvaluationResult< T > > TryEvaluate(Attribute< T > Attribute, Variables Session)
Tries to evaluate the attribute value.
Result of asynchronous evaluation.
T Result
Evaluated result, if successful.
bool Ok
If evaluation was successful.
LengthAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
SKCanvas Canvas
Current drawing canvas.
float AreaWidth
Width of current area
float AreaHeight
Height of current area
SKSize SetAreaSize(SKSize AreaSize)
Sets the current area size.
Variables Session
Current session.
void CalcDrawingSize(Length L, ref float Size, bool Horizontal, ILayoutElement Element)
Converts a defined length to drawing size.
override async Task Draw(DrawingState State)
Draws layout entities.
override? float PotentialHeight
Potential Height of element
override? float InnerWidth
Inner Width of element
override Task FromXml(XmlElement Input)
Populates the element (including children) with information from its XML definition.
override void CopyContents(ILayoutElement Destination)
Copies contents (attributes and children) to the destination element.
override ILayoutElement Create(Layout2DDocument Document, ILayoutElement Parent)
Creates a new instance of the layout element.
override string LocalName
Local name of type of element.
LengthAttribute LeftAttribute
Left
override void ExportStateAttributes(XmlWriter Output)
Exports the local attributes of the current element.
LengthAttribute TopAttribute
Top
override void MeasurePositions(DrawingState State)
Measures layout entities and defines unassigned properties, related to positions.
override async Task DoMeasureDimensions(DrawingState State)
Measures layout entities and defines unassigned properties, related to dimensions.
override? float InnerHeight
Inner Height of element
override void ExportAttributes(XmlWriter Output)
Exports attributes to XML.
Margins(Layout2DDocument Document, ILayoutElement Parent)
A translation transform
LengthAttribute BottomAttribute
Bottom
override? float PotentialWidth
Potential Width of element
override async Task AfterMeasureDimensions(DrawingState State)
Called when dimensions have been measured.
LengthAttribute RightAttribute
Right
Abstract base class for layout containers (area elements containing embedded layout elements).
float? Height
Height of element
Layout2DDocument Document
Layout document.
float? Width
Width of element
ILayoutElement Parent
Parent element.
Base interface for all layout elements.
float? InnerWidth
Inner Width of element
Layout2DDocument Document
Layout document.
float? InnerHeight
Inner Height of element