term_model/
event.rs

1use std::borrow::Cow;
2use std::path::PathBuf;
3
4use crate::message_bar::Message;
5use crate::term::SizeInfo;
6
7#[derive(Clone, Debug, PartialEq)]
8pub enum Event {
9    DPRChanged(f64, (u32, u32)),
10    ConfigReload(PathBuf),
11    MouseCursorDirty,
12    Message(Message),
13    Title(String),
14    Wakeup,
15    Urgent,
16    Exit,
17}
18
19/// Byte sequences are sent to a `Notify` in response to some events
20pub trait Notify {
21    /// Notify that an escape sequence should be written to the pty
22    ///
23    /// TODO this needs to be able to error somehow
24    fn notify<B: Into<Cow<'static, [u8]>>>(&mut self, _: B);
25}
26
27/// Types that are interested in when the display is resized
28pub trait OnResize {
29    fn on_resize(&mut self, size: &SizeInfo);
30}
31
32/// Event Loop for notifying the renderer about terminal events
33pub trait EventListener {
34    fn send_event(&self, event: Event);
35}