using System.Diagnostics.CodeAnalysis; using UnityEngine; namespace Phantom.XRMOD.UnityFusion.Editor { /// /// A method that is called before or after the header GUI of a component is drawn. /// /// The component whose header is being drawn. /// The position and dimensions of the header GUI. /// Is the header currently selected in the Inspector or not? /// Does the header that is being drawn support rich text tags or not? /// The height of the element that this method has drawn before or after the header GUI. public delegate float HeaderGUIHandler([DisallowNull] Component component, Rect headerRect, bool headerIsSelected, bool supportsRichText); /// /// A class that contains callbacks /// public static class ComponentHeader { /// /// Callback invoked right before component header GUI is drawn. /// public static event HeaderGUIHandler BeforeHeaderGUI; /// /// Callback invoked right after component header GUI has been drawn. /// public static event HeaderGUIHandler AfterHeaderGUI; internal static float InvokeBeforeHeaderGUI([DisallowNull] Component component, Rect headerRect, bool headerIsSelected, bool supportsRichText) => BeforeHeaderGUI?.Invoke(component, headerRect, headerIsSelected, supportsRichText) ?? 0f; internal static float InvokeAfterHeaderGUI([DisallowNull] Component component, Rect headerRect, bool headerIsSelected, bool supportsRichText) => AfterHeaderGUI?.Invoke(component, headerRect, headerIsSelected, supportsRichText) ?? 0f; } }