namespace Mox.Shared.UI
{
	public delegate void NuiEventHandler(SEventProperties _eventProperties);

	public struct SEventProperties
	{
		public EEventType EventType;
		public Control Source;
		public Control Target;
		public object Data;
	}

	public enum EEventPropagation
	{
		Tunnel,
		Bubble,
		Both
	}

	public enum EEventType
	{
		//*************************
		//* Low-level events (system):

		// Mouse
		MouseButtonDown = 0x000,
		MouseButtonUp,
		MouseButtonClick,
		MouseButtonDoubleClick,
		MouseMove,
		MouseWheelUp,
		MouseWheelDown,

		//*************************
		//* Higher-level events (generic):

		// Drag
		BeginDrag = 0x040,
		Dragged,
		EndDrag,

		//*************************
		//* High-level events (specific):

		// Control
		ControlFocus = 0x100,
		ControlBlur,
		ControlActivated,
		ControlDeactivated,
		ControlEnabled,
		ControlDisabled,
		ControlDisabledActivated,
		ControlDisabledDeactivated,
		ControlDisabledFocus,
		ControlDisabledBlur,

		// Button
		ButtonPressed = 0x110,
		ButtonReleased,
		ButtonClicked,
		ButtonDragged,
		ButtonDisabledPressed,
		ButtonDisabledReleased,
		ButtonDisabledClicked,

		// CheckBox
		CheckBoxCheckChanged = 0x120,
	}

	internal class EventTypeHelper
	{
		internal static bool IsMouseEvent(EEventType type)
		{
			return type == EEventType.MouseButtonDown ||
			       type == EEventType.MouseButtonUp ||
			       type == EEventType.MouseButtonClick ||
			       type == EEventType.MouseButtonDoubleClick ||
			       type == EEventType.MouseMove ||
			       type == EEventType.MouseWheelUp ||
			       type == EEventType.MouseWheelDown;
		}

		internal static bool IsFocusStateEvent(EEventType type)
		{
			return type == EEventType.MouseButtonDown;
		}

		internal static bool IsActiveStateEvent(EEventType type)
		{
			return IsMouseEvent(type);
		}

		internal static bool IsInputEvent(EEventType type)
		{
			return type == EEventType.MouseButtonDown ||
			       type == EEventType.MouseButtonUp ||
			       type == EEventType.MouseButtonClick ||
			       type == EEventType.MouseButtonDoubleClick ||
			       type == EEventType.MouseWheelUp ||
			       type == EEventType.MouseWheelDown ||
			       type == EEventType.BeginDrag ||
			       type == EEventType.Dragged ||
			       type == EEventType.EndDrag;
		}
	}
}
