namespace Sandbox.UI;
///
/// Base event.
/// See .
///
public class PanelEvent
{
public string Name { get; init; }
public object Value { get; set; }
public float Time { get; set; }
public string Button { get; set; }
///
/// The panel on which the event is being called. For example, if you have a button with a label.. when the
/// button gets clicked the actual click event might come from the label. When the event is called on the
/// label, This will be the label. When the event propagates up to the button This will be the button - but
/// Target will be the label. This is mainly of use with Razor callbacks, where you want to get the actual
/// panel that created the event.
///
public Panel This { get; set; }
public Panel Target { get; set; }
internal bool Propagate = true;
public PanelEvent( string eventName, Panel active = null )
{
Name = eventName;
Target = active;
}
public bool Is( string name )
{
return string.Equals( name, Name, System.StringComparison.OrdinalIgnoreCase );
}
public void StopPropagation()
{
Propagate = false;
}
}