using PKHeX.Core;
namespace PKHeX.WinForms.Controls;
///
/// Represents information about a slot change during drag-and-drop operations.
///
/// The type of the cursor object.
/// The type of the image source object.
public sealed class SlotChangeInfo
where TCursor : class
where TImageSource : class
{
///
/// Gets or sets a value indicating whether the left mouse button is down.
///
public bool IsLeftMouseDown { get; set; }
///
/// Gets or sets a value indicating whether a drag-and-drop operation is in progress.
///
public bool IsDragDropInProgress { get; set; }
///
/// Gets or sets the current cursor.
///
public TCursor? Cursor { get; set; }
///
/// Gets or sets the current file path involved in the drag-and-drop operation.
///
public string? CurrentPath { get; set; }
///
/// Slot that is being dragged from.
///
public SlotViewInfo? Source { get; set; }
///
/// Slot that is being dragged to.
///
public SlotViewInfo? Destination { get; set; }
///
/// Resets the slot change information to its default state.
///
public void Reset()
{
IsLeftMouseDown = IsDragDropInProgress = false;
CurrentPath = null;
Cursor = null;
}
private bool IsSourceParty => Source?.Slot is SlotInfoParty;
private bool IsDestinationParty => Destination?.Slot is SlotInfoParty;
///
/// Used to indicate if the changes will alter the player's party data state.
///
public bool IsDragParty => IsSourceParty || IsDestinationParty;
///
/// Used to indicate if the changes will involve two slots within the program.
///
public bool IsDragSwap => Source is not null && Destination is not null;
///
/// Used to indicate if the changes will involve two slots within the same location.
///
public bool IsDragSameLocation => (Destination is not null) && (Source?.Equals(Destination) ?? false);
}