1#![allow(clippy::question_mark)]
2#![allow(clippy::type_complexity)]
3
4use rat_event::{ConsumedEvent, Outcome};
5
6mod dialog_control;
7mod window_control;
8
9pub use dialog_control::DialogStack;
10pub use dialog_control::handle_dialog_stack;
11pub use window_control::Window;
12pub use window_control::WindowFrameOutcome;
13pub use window_control::WindowList;
14pub use window_control::handle_window_list;
15pub use window_control::mac_frame::MacFrame;
16pub use window_control::mac_frame::MacFrameState;
17pub use window_control::mac_frame::MacFrameStyle;
18pub use window_control::window_frame::WindowFrame;
19pub use window_control::window_frame::WindowFrameState;
20pub use window_control::window_frame::WindowFrameStyle;
21
22#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
24#[must_use]
25pub enum WindowControl<Event> {
26 Continue,
29 Unchanged,
32 Changed,
35 Event(Event),
37 Close(Event),
39}
40
41impl<Event> ConsumedEvent for WindowControl<Event> {
42 fn is_consumed(&self) -> bool {
43 !matches!(self, WindowControl::Continue)
44 }
45}
46
47impl<Event, T: Into<Outcome>> From<T> for WindowControl<Event> {
48 fn from(value: T) -> Self {
49 let r = value.into();
50 match r {
51 Outcome::Continue => WindowControl::Continue,
52 Outcome::Unchanged => WindowControl::Unchanged,
53 Outcome::Changed => WindowControl::Changed,
54 }
55 }
56}
57
58mod _private {
59 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
60 pub struct NonExhaustive;
61}