#if UNITY_EDITOR
using System;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine.UIElements;
namespace UnityEngine.InputSystem.Editor
{
///
/// A visual element that supports renaming of items.
///
internal class InputActionsTreeViewItem : VisualElement
{
public EventCallback EditTextFinishedCallback;
private const string kRenameTextField = "rename-text-field";
public event EventCallback EditTextFinished;
public Action OnContextualMenuPopulateEvent;
// for testing purposes to know if the item is focused to accept input
internal bool IsFocused { get; private set; } = false;
private bool m_IsEditing;
private static InputActionsTreeViewItem s_EditingItem = null;
internal bool isCut { get; set; }
public InputActionsTreeViewItem()
{
var template = AssetDatabase.LoadAssetAtPath(
InputActionsEditorConstants.PackagePath +
InputActionsEditorConstants.ResourcesPath +
InputActionsEditorConstants.InputActionsTreeViewItemUxml);
template.CloneTree(this);
focusable = true;
delegatesFocus = false;
renameTextfield.selectAllOnMouseUp = false;
RegisterInputField();
_ = new ContextualMenuManipulator(menuBuilder =>
{
OnContextualMenuPopulateEvent?.Invoke(menuBuilder);
})
{ target = this };
}
public Label label => this.Q