using System.Text.Json.Serialization;
|
using Moli.Desktop.Plugins;
|
|
namespace Moli.Desktop.Layout;
|
|
/// <summary>Monitor identifier used by persisted layouts.</summary>
|
public readonly record struct MonitorId(string Value)
|
{
|
public override string ToString() => Value;
|
}
|
|
public readonly record struct PointD(double X, double Y);
|
|
public readonly record struct SizeD(double Width, double Height);
|
|
public readonly record struct RectD(double X, double Y, double Width, double Height)
|
{
|
public double Right => X + Width;
|
public double Bottom => Y + Height;
|
}
|
|
public readonly record struct WidgetInstanceId(string Value)
|
{
|
public override string ToString() => Value;
|
}
|
|
public enum DisplayLayer
|
{
|
[JsonStringEnumMemberName("desktop")]
|
Desktop,
|
|
[JsonStringEnumMemberName("normal")]
|
Normal,
|
|
[JsonStringEnumMemberName("app-top")]
|
AppTop,
|
|
[JsonStringEnumMemberName("global-top")]
|
GlobalTop
|
}
|
|
public sealed record WidgetRuntimeState
|
{
|
public required WidgetInstanceId InstanceId { get; init; }
|
public required PluginId PluginId { get; init; }
|
public required RectD Bounds { get; init; }
|
public required MonitorId MonitorId { get; init; }
|
public bool IsVisible { get; init; } = true;
|
public bool IsLocked { get; init; }
|
public double Opacity { get; init; } = 1;
|
public bool ClickThrough { get; init; } = true;
|
public DisplayLayer DisplayLayer { get; init; } = DisplayLayer.Desktop;
|
}
|
|
public sealed record WidgetLayoutPatch
|
{
|
public RectD? Bounds { get; init; }
|
public MonitorId? MonitorId { get; init; }
|
public bool? IsVisible { get; init; }
|
public bool? IsLocked { get; init; }
|
public double? Opacity { get; init; }
|
public bool? ClickThrough { get; init; }
|
public double? Scale { get; init; }
|
public DisplayLayer? DisplayLayer { get; init; }
|
}
|