2022-06-18 18:04:24 +00:00
|
|
|
using PKHeX.Core;
|
2019-10-04 01:29:53 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.WinForms.Controls;
|
|
|
|
|
2023-03-26 06:23:43 +00:00
|
|
|
public sealed class SlotChangeInfo<TCursor, TImageSource> where TCursor : class where TImageSource : class
|
2019-10-04 01:29:53 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
public bool LeftMouseIsDown { get; set; }
|
|
|
|
public bool DragDropInProgress { get; set; }
|
2019-10-04 01:29:53 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public TCursor? Cursor { get; set; }
|
|
|
|
public string? CurrentPath { get; set; }
|
2019-10-04 01:29:53 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public SlotViewInfo<TImageSource>? Source { get; set; }
|
|
|
|
public SlotViewInfo<TImageSource>? Destination { get; set; }
|
2019-10-04 01:29:53 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public void Reset()
|
|
|
|
{
|
|
|
|
LeftMouseIsDown = DragDropInProgress = false;
|
|
|
|
CurrentPath = null;
|
|
|
|
Cursor = default;
|
|
|
|
}
|
2019-10-04 01:29:53 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public bool SameLocation => (Destination != null) && (Source?.Equals(Destination) ?? false);
|
2021-12-05 01:56:56 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private bool SourceIsParty => Source?.Slot is SlotInfoParty;
|
|
|
|
private bool DestinationIsParty => Destination?.Slot is SlotInfoParty;
|
2021-12-05 01:56:56 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Used to indicate if the changes will alter the player's party data state.
|
|
|
|
/// </summary>
|
|
|
|
public bool DragIsParty => SourceIsParty || DestinationIsParty;
|
2022-02-07 23:03:26 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public bool DragIsSwap => Source is not null && Destination is not null;
|
2022-02-07 23:03:26 +00:00
|
|
|
}
|