1pub mod action;
5
6use iced::Limits;
7use iced::Size;
8use iced::Task;
9use std::future::Future;
10use std::sync::Arc;
11
12#[derive(Clone)]
14pub enum Action {
15 AppSubsurface(
17 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
18 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
19 ),
20 Subsurface(
22 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
23 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
24 ),
25 DestroySubsurface(iced::window::Id),
27 AppPopup(
29 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
30 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
31 ),
32 Popup(
34 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
35 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
36 ),
37 DestroyPopup(iced::window::Id),
39 DestroyTooltipPopup,
41
42 AppWindow(
44 iced::window::Id,
45 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
46 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
47 ),
48 Window(
50 iced::window::Id,
51 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
52 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
53 ),
54 DestroyWindow(iced::window::Id),
56
57 ResponsiveMenuBar {
59 menu_bar: crate::widget::Id,
61 limits: Limits,
63 size: Size,
65 },
66 Ignore,
67 Task(Arc<dyn Fn() -> Task<Action> + Send + Sync>),
68}
69
70impl std::fmt::Debug for Action {
71 #[cold]
72 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
73 match self {
74 Self::AppSubsurface(arg0, arg1) => f
75 .debug_tuple("AppSubsurface")
76 .field(arg0)
77 .field(arg1)
78 .finish(),
79 Self::Subsurface(arg0, arg1) => {
80 f.debug_tuple("Subsurface").field(arg0).field(arg1).finish()
81 }
82 Self::DestroySubsurface(arg0) => {
83 f.debug_tuple("DestroySubsurface").field(arg0).finish()
84 }
85 Self::AppPopup(arg0, arg1) => {
86 f.debug_tuple("AppPopup").field(arg0).field(arg1).finish()
87 }
88 Self::Popup(arg0, arg1) => f.debug_tuple("Popup").field(arg0).field(arg1).finish(),
89 Self::DestroyPopup(arg0) => f.debug_tuple("DestroyPopup").field(arg0).finish(),
90 Self::DestroyTooltipPopup => f.debug_tuple("DestroyTooltipPopup").finish(),
91 Self::ResponsiveMenuBar {
92 menu_bar,
93 limits,
94 size,
95 } => f
96 .debug_struct("ResponsiveMenuBar")
97 .field("menu_bar", menu_bar)
98 .field("limits", limits)
99 .field("size", size)
100 .finish(),
101 Self::Ignore => write!(f, "Ignore"),
102 Self::AppWindow(id, arg0, arg1) => f
103 .debug_tuple("AppWindow")
104 .field(id)
105 .field(arg0)
106 .field(arg1)
107 .finish(),
108 Self::Window(id, arg0, arg1) => f
109 .debug_tuple("Window")
110 .field(id)
111 .field(arg0)
112 .field(arg1)
113 .finish(),
114 Self::DestroyWindow(arg0) => f.debug_tuple("DestroyWindow").field(arg0).finish(),
115 Self::Task(_) => f.debug_tuple("Future").finish(),
116 }
117 }
118}