using System; using UnityEditor.Overlays; using UnityEngine.UIElements; namespace UnityEditor.U2D.Sprites.Overlay { internal abstract class SpriteFrameModeToolStripBase { Action m_ModeToolStripToggled; public event Action onToolStripToggled { add => m_ModeToolStripToggled += value; remove => m_ModeToolStripToggled -= value; } /// /// Call to inform the rest of the tool strips that this tool strip has been toggled. /// protected void OnToolStripToggled() { m_ModeToolStripToggled?.Invoke(this); } /// /// Notify this toolstrip when a toolstrip SpriteFrameModeToolStripBase has been toggled. /// /// The tool strip that is toggled. public abstract void NotifyModeToolStripToggled(SpriteFrameModeToolStripBase value); /// /// Get the UI content for the tool strip. /// /// Desired overlay layout. /// VisualElements to be added to the tool strip. public abstract VisualElement[] GetUIContent(Layout overlayLayout); /// /// Order of the visual element should be placed. /// public abstract int order { get; } /// /// Called when the SpriteFrame overlay tool strip is ready. /// /// The mode that is associated to this toolstrip as indicated in GetSpriteFrameModeType. /// Returns true if the overlay can be activated. False otherwise. public abstract bool OverlayActivated(ISpriteEditorModuleMode spriteEditorModule); /// /// Called when the SpriteFrame overlay toolstrip is deactivated. /// public abstract void OverlayDeactivated(); /// /// The type of the SpriteFrame mode that is associated with this toolstrip. /// /// Type of the mode. public abstract Type GetSpriteFrameModeType(); } }