namespace WallstopStudios.DataVisualizer.Editor.Extensions
{
using System;
using System.Collections.Generic;
using UnityEngine.UIElements;
///
/// Version-compat shim for selection callbacks. The 2021.3-era
/// onSelectionChange member was renamed to selectionChanged in 2022.3 and the old
/// name was removed in Unity 6, so package code subscribes through this shim instead of
/// referencing either name directly.
///
internal static class ListViewCompatExtensions
{
/// Subscribes to the list's selection-changed event across Unity versions.
internal static void RegisterSelectionChangedCompat(
this ListView listView,
Action> callback
)
{
#if UNITY_2022_3_OR_NEWER
listView.selectionChanged += callback;
#else
listView.onSelectionChange += callback;
#endif
}
}
}