// UITK TreeView is not supported in earlier versions
// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either.
#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_UI_TK_ASSET_EDITOR
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine.InputSystem.Editor;
using UnityEngine.UIElements;
namespace UnityEngine.InputSystem.Editor
{
///
/// A visual element that supports renaming of items.
///
internal class InputActionsTreeViewItem : VisualElement
{
public EventCallback EditTextFinishedCallback;
public EventCallback DeleteCallback;
public EventCallback DuplicateCallback;
private const string kRenameTextField = "rename-text-field";
public event EventCallback EditTextFinished;
public event EventCallback OnDeleteItem;
public event EventCallback OnDuplicateItem;
private bool m_IsEditing;
public InputActionsTreeViewItem()
{
var template = AssetDatabase.LoadAssetAtPath(
InputActionsEditorConstants.PackagePath +
InputActionsEditorConstants.ResourcesPath +
InputActionsEditorConstants.InputActionsTreeViewItemUxml);
template.CloneTree(this);
focusable = true;
delegatesFocus = false;
renameTextfield.selectAllOnFocus = true;
renameTextfield.selectAllOnMouseUp = false;
RegisterCallback(OnMouseDownEventForRename);
renameTextfield.RegisterCallback(e => OnEditTextFinished());
}
public Label label => this.Q