package ocelot.desktop.ui.event

sealed trait Dispatchable {
  def consume(): Unit

  def consumed: Boolean
}

trait Event extends Dispatchable {
  private var _consumed: Boolean = false

  def consume(): Unit = {
    _consumed = true
  }

  def consumed: Boolean = _consumed
}

/**
  * A wrapper for an event that is dispatched during the capture phase.
  */
case class Capturing[A <: CapturingEvent](event: A) extends Dispatchable {
  override def consume(): Unit = {
    event.consume()
  }

  override def consumed: Boolean = event.consumed
}
