#if UNITY_2019_4_OR_NEWER using com.zibra.liquid.Foundation.Editor; using JetBrains.Annotations; using UnityEngine.UIElements; namespace com.zibra.liquid.Foundation.UIElements { /// /// A selectable label field. /// The same feature as we use to have with IMGUI /// /// internal class SelectableLabel : Label { /// [UsedImplicitly] public new class UxmlFactory : UxmlFactory { } /// public new class UxmlTraits : Label.UxmlTraits {} /// /// The text associated with the element. /// public override string text { get => TextField.value; set => TextField.value = value; } /// /// SelectableLabel Uss class name. /// public const string USSClassName = "zibraai-selectable-label"; /// /// SelectableLabel input Uss class name. /// public const string InputUSSClassName = "zibraai-selectable-label__input"; TextField m_TextField; TextField TextField { get { if (m_TextField == null) { m_TextField = new TextField { isReadOnly = true }; m_TextField.Q("unity-text-input").AddToClassList(InputUSSClassName); Add(m_TextField); } return m_TextField; } } /// /// Creates new settings block. /// public SelectableLabel() { AddToClassList(USSClassName); UIToolkitEditorUtility.ApplyStyleForInternalControl(this); } } } #endif