74 lines
1.8 KiB
C#
74 lines
1.8 KiB
C#
using System.Collections.Specialized;
|
|
using System.ComponentModel;
|
|
using System.Numerics;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace Dashboard.Layout
|
|
{
|
|
public class LayoutInfo : INotifyPropertyChanged
|
|
{
|
|
/// <summary>
|
|
/// Changes the control display.
|
|
/// </summary>
|
|
public DisplayMode DisplayMode
|
|
{
|
|
get;
|
|
set => SetField(ref field, value);
|
|
} = DisplayMode.Fit;
|
|
|
|
/// <summary>
|
|
/// Changes how overflows are handled.
|
|
/// </summary>
|
|
public OverflowMode OverflowMode
|
|
{
|
|
get;
|
|
set => SetField(ref field, value);
|
|
} = OverflowMode.Hidden;
|
|
|
|
public Vector2 Size
|
|
{
|
|
get;
|
|
set => SetField(ref field, value);
|
|
}
|
|
|
|
public Vector2 MaximumSize
|
|
{
|
|
get;
|
|
set => SetField(ref field, value);
|
|
}
|
|
|
|
public Vector2 MinimumSize
|
|
{
|
|
get;
|
|
set => SetField(ref field, value);
|
|
}
|
|
|
|
public Extents Margin
|
|
{
|
|
get;
|
|
set => SetField(ref field, value);
|
|
}
|
|
|
|
public Box2d ComputedBox
|
|
{
|
|
get;
|
|
set => SetField(ref field, value);
|
|
}
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
|
|
protected bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
|
{
|
|
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
|
|
field = value;
|
|
OnPropertyChanged(propertyName);
|
|
return true;
|
|
}
|
|
}
|
|
}
|