Consolidated classes for Row and Grid elements

This commit is contained in:
MarcinZiabek
2021-04-17 21:55:19 +02:00
parent e4203838cb
commit 950d971119
4 changed files with 32 additions and 40 deletions
+6
View File
@@ -6,6 +6,12 @@ using static QuestPDF.Infrastructure.HorizontalAlignment;
namespace QuestPDF.Elements
{
internal class GridElement
{
public int Columns { get; set; } = 1;
public Element? Child { get; set; }
}
internal class Grid : IComponent
{
public const int DefaultColumnsCount = 12;
-10
View File
@@ -1,10 +0,0 @@
using QuestPDF.Infrastructure;
namespace QuestPDF.Elements
{
internal class GridElement
{
public int Columns { get; set; } = 1;
public Element? Child { get; set; }
}
}
+26
View File
@@ -5,6 +5,32 @@ using QuestPDF.Infrastructure;
namespace QuestPDF.Elements
{
internal abstract class RowElement : ContainerElement
{
public float Width { get; set; } = 1;
internal override void Draw(ICanvas canvas, Size availableSpace)
{
Child?.Draw(canvas, availableSpace);
}
}
internal class ConstantRowElement : RowElement
{
public ConstantRowElement(float width)
{
Width = width;
}
}
internal class RelativeRowElement : RowElement
{
public RelativeRowElement(float width)
{
Width = width;
}
}
internal class Row : Element
{
public List<RowElement> Children { get; set; } = new List<RowElement>();
-30
View File
@@ -1,30 +0,0 @@
using QuestPDF.Infrastructure;
namespace QuestPDF.Elements
{
internal abstract class RowElement : ContainerElement
{
public float Width { get; set; } = 1;
internal override void Draw(ICanvas canvas, Size availableSpace)
{
Child?.Draw(canvas, availableSpace);
}
}
internal class ConstantRowElement : RowElement
{
public ConstantRowElement(float width)
{
Width = width;
}
}
internal class RelativeRowElement : RowElement
{
public RelativeRowElement(float width)
{
Width = width;
}
}
}