using System.Collections.Specialized; using System.ComponentModel; using System.Numerics; using System.Runtime.CompilerServices; namespace Dashboard.Layout { public class LayoutInfo : INotifyPropertyChanged { /// /// Changes the control display. /// public DisplayMode DisplayMode { get; set => SetField(ref field, value); } = DisplayMode.Fit; /// /// Changes how overflows are handled. /// 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(ref T field, T value, [CallerMemberName] string? propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) return false; field = value; OnPropertyChanged(propertyName); return true; } } }