1#![allow(clippy::question_mark)]
17#![allow(clippy::type_complexity)]
18
19use rat_event::{ConsumedEvent, Outcome};
20
21pub mod decorations;
22
23mod dialog_stack;
24mod window_list;
25
26pub use dialog_stack::DialogStack;
27pub use dialog_stack::handle_dialog_stack;
28pub use window_list::Window;
29pub use window_list::WindowFrameOutcome;
30pub use window_list::WindowList;
31pub use window_list::handle_window_list;
32
33#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
35#[must_use]
36pub enum WindowControl<Event> {
37 Continue,
40 Unchanged,
43 Changed,
46 Event(Event),
48 Close(Event),
50}
51
52impl<Event> ConsumedEvent for WindowControl<Event> {
59 fn is_consumed(&self) -> bool {
60 !matches!(self, WindowControl::Continue)
61 }
62}
63
64impl<Event, T: Into<Outcome>> From<T> for WindowControl<Event> {
65 fn from(value: T) -> Self {
66 let r = value.into();
67 match r {
68 Outcome::Continue => WindowControl::Continue,
69 Outcome::Unchanged => WindowControl::Unchanged,
70 Outcome::Changed => WindowControl::Changed,
71 }
72 }
73}
74
75mod _private {
76 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
77 pub struct NonExhaustive;
78}