131 lines
3.8 KiB
C#
131 lines
3.8 KiB
C#
using System.Numerics;
|
|
using Dashboard.Layout;
|
|
|
|
namespace Dashboard
|
|
{
|
|
public static class LayoutExtensions
|
|
{
|
|
extension<T>(T item)
|
|
where T : ILayoutItem
|
|
{
|
|
public DisplayMode DisplayMode
|
|
{
|
|
get => item.Layout.DisplayMode;
|
|
set => item.Layout.DisplayMode = value;
|
|
}
|
|
|
|
public OverflowMode OverflowMode
|
|
{
|
|
get => item.Layout.OverflowMode;
|
|
set => item.Layout.OverflowMode = value;
|
|
}
|
|
|
|
public Vector2 Size
|
|
{
|
|
get => item.Layout.Size;
|
|
set => item.Layout.Size = value;
|
|
}
|
|
|
|
public float Width
|
|
{
|
|
get => item.Size.X;
|
|
set => item.Size = new Vector2(value, item.Size.Y);
|
|
}
|
|
|
|
public float Height
|
|
{
|
|
get => item.Size.Y;
|
|
set => item.Size = new Vector2(item.Size.X, value);
|
|
}
|
|
|
|
public Vector2 MaximumSize
|
|
{
|
|
get => item.Layout.MaximumSize;
|
|
set => item.Layout.MaximumSize = value;
|
|
}
|
|
|
|
public float MaximumWidth
|
|
{
|
|
get => item.MaximumSize.X;
|
|
set => item.MaximumSize = new Vector2(value, item.MaximumSize.Y);
|
|
}
|
|
|
|
public float MaximumHeight
|
|
{
|
|
get => item.MaximumSize.Y;
|
|
set => item.MaximumSize = new Vector2(item.MaximumSize.X, value);
|
|
}
|
|
|
|
public Vector2 MinimumSize
|
|
{
|
|
get => item.Layout.MinimumSize;
|
|
set => item.Layout.MinimumSize = value;
|
|
}
|
|
|
|
public float MinimumWidth
|
|
{
|
|
get => item.MinimumSize.X;
|
|
set => item.MinimumSize = new Vector2(value, item.MinimumSize.Y);
|
|
}
|
|
|
|
public float MinimumHeight
|
|
{
|
|
get => item.MinimumSize.Y;
|
|
set => item.MinimumSize = new Vector2(item.MinimumSize.X, value);
|
|
}
|
|
|
|
public Extents Margin
|
|
{
|
|
get => item.Layout.Margin;
|
|
set => item.Layout.Margin = value;
|
|
}
|
|
|
|
public float MarginLeft
|
|
{
|
|
get => item.Layout.Margin.Left;
|
|
set => item.Layout.Margin = new Extents(value, item.MarginTop, item.MarginRight, item.MarginBottom);
|
|
}
|
|
|
|
public float MarginTop
|
|
{
|
|
get => item.Layout.Margin.Top;
|
|
set => item.Layout.Margin = new Extents(item.MarginLeft, value, item.MarginRight, item.MarginBottom);
|
|
}
|
|
|
|
public float MarginRight
|
|
{
|
|
get => item.Layout.Margin.Right;
|
|
set => item.Layout.Margin = new Extents(item.MarginLeft, item.MarginTop, value, item.MarginBottom);
|
|
}
|
|
|
|
public float MarginBottom
|
|
{
|
|
get => item.Layout.Margin.Bottom;
|
|
set => item.Layout.Margin = new Extents(item.MarginLeft, item.MarginTop, item.MarginRight, value);
|
|
}
|
|
|
|
public Box2d ComputedBox
|
|
{
|
|
get => item.Layout.ComputedBox;
|
|
set => item.Layout.ComputedBox = value;
|
|
}
|
|
}
|
|
|
|
extension<T> (T item)
|
|
where T : ILayoutContainer
|
|
{
|
|
public FlowDirection FlowDirection
|
|
{
|
|
get => item.ContainerLayout.FlowDirection;
|
|
set => item.ContainerLayout.FlowDirection = value;
|
|
}
|
|
|
|
public Extents Padding
|
|
{
|
|
get => item.ContainerLayout.Padding;
|
|
set => item.ContainerLayout.Padding = value;
|
|
}
|
|
}
|
|
}
|
|
}
|