use crate::{view::element, ControlFlow};
/// A Glyph User Interface
pub trait Gui {
/// Type of message produced by [`Gui::view()`]'s [`element`]
///
/// [`Gui::view()`]: Gui::view
/// [`element`]: element
type Message;
/// Custom event type
///
/// If custom events aren't needed, this can simply be set to `()`.
type Event;
/// Produce the UI elements to be displayed
///
/// These UI elements may produce messages of type [`Self::Message`] and may
/// also receive [`Event<T>`]s where `T` is [`Self::Event`].
///
/// [`Self::Message`]: Gui::Message
/// [`Event<T>`]: crate::event::Event
/// [`Self::Event`]: Gui::Event
fn view(&mut self) -> element::View<'_, Self::Event, Self::Message>;
/// Handle messages produced by the UI elements (or custom events)
fn update(&mut self, message: Self::Message);
/// Change the [`ControlFlow`] of the event loop
///
/// With this function, it's possible to react to a message by, for example,
/// terminating the event loop and thus exiting the application.
fn control_flow(&self) -> ControlFlow;
}