euv_ui/component/context_menu/view/
struct.rs1use super::*;
2
3#[derive(Data, Default)]
5pub(crate) struct ContextMenuLongPress {
6 #[get(pub(crate), type(copy))]
8 #[get_mut(pub(crate))]
9 #[set(pub(crate))]
10 pub(crate) origin: Option<(i32, i32, f64)>,
11 #[get(pub(crate))]
13 #[get_mut(pub(crate))]
14 #[set(pub(crate))]
15 pub(crate) timer: Option<i32>,
16 #[get(skip)]
18 #[get_mut(pub(crate))]
19 #[set(pub(crate))]
20 pub(crate) callback: Option<Closure<dyn FnMut()>>,
21}
22
23#[derive(Clone, CustomDebug, Default)]
25pub struct EuvContextMenuProps {
26 pub open: Signal<bool>,
28}
29
30#[derive(Clone, CustomDebug, Default)]
32pub struct EuvContextMenuTriggerProps {
33 pub open: Signal<bool>,
35 pub disabled: bool,
37 pub label: &'static str,
39}
40
41#[derive(Clone, CustomDebug, Default)]
43pub struct EuvContextMenuContentProps {
44 pub open: Signal<bool>,
46}
47
48#[derive(Clone, Copy, CustomDebug, Default)]
52pub struct EuvContextMenuGroupProps {
53 pub label: &'static str,
55}
56
57#[derive(Clone, CustomDebug, Default)]
61pub struct EuvContextMenuRadioGroupProps {
62 pub label: &'static str,
64 pub selection: EuvContextMenuRadioGroupState,
66}
67
68#[derive(Clone, CustomDebug, Default)]
73pub struct EuvContextMenuRadioGroupState {
74 pub value: Signal<String>,
76 pub controlled: bool,
78 #[debug(skip)]
80 pub on_value_change: Option<Rc<dyn Fn(String)>>,
81}
82
83#[derive(Clone, Copy, CustomDebug, Default)]
87pub struct EuvContextMenuSubProps {
88 pub open: Signal<bool>,
90 pub parent_open: Signal<bool>,
94}
95
96#[derive(Data)]
98pub(crate) struct ContextMenuSubBindingScope {
99 #[get(pub(crate))]
100 pub(crate) slot: Rc<RefCell<Option<ContextMenuSubBinding>>>,
101}
102
103#[derive(Data)]
105pub(crate) struct ContextMenuSubBinding {
106 #[get(pub(crate), type(copy))]
108 pub(crate) parent_open: Signal<bool>,
109 #[get(pub(crate), type(copy))]
111 pub(crate) open: Signal<bool>,
112 #[get(pub(crate), type(copy))]
114 pub(crate) parent_subscription: usize,
115 #[get(pub(crate), type(copy))]
117 pub(crate) open_subscription: usize,
118 #[cfg(target_arch = "wasm32")]
120 #[get(pub(crate))]
121 pub(crate) hover_owner: Rc<ContextMenuHoverOwner>,
122}
123
124#[derive(Clone, Copy, CustomDebug)]
126pub struct EuvContextMenuSubTriggerProps {
127 pub label: &'static str,
129 pub open: Signal<bool>,
131 pub disabled: bool,
133 pub open_on_hover: bool,
135 pub delay_ms: u32,
137 pub close_delay_ms: u32,
139}
140
141#[derive(Clone, Copy, CustomDebug, Default)]
143pub struct EuvContextMenuSubContentProps {
144 pub open: Signal<bool>,
146}
147
148#[derive(Clone, CustomDebug)]
150pub struct EuvContextMenuItemProps {
151 pub open: Signal<bool>,
153 pub value: &'static str,
155 pub label: &'static str,
157 pub disabled: bool,
159 pub close_on_click: bool,
161 #[debug(skip)]
163 pub on_select: Option<Rc<dyn Fn(&'static str)>>,
164}
165
166#[derive(Clone, CustomDebug, Default)]
168pub struct EuvContextMenuCheckboxItemProps {
169 pub open: Signal<bool>,
171 pub close_on_click: bool,
173 pub label: &'static str,
175 pub checked: Signal<bool>,
177 #[debug(skip)]
179 pub on_select: Option<Rc<dyn Fn(bool)>>,
180}
181
182#[derive(Clone, CustomDebug, Default)]
184pub struct EuvContextMenuRadioItemProps {
185 pub label: &'static str,
187 pub value: &'static str,
189 pub selection: EuvContextMenuRadioGroupState,
191 pub disabled: bool,
193 pub open: Signal<bool>,
195 pub close_on_click: bool,
198}
199
200#[derive(Clone, Copy, CustomDebug, Default)]
202pub struct EuvContextMenuLabelProps {
203 pub text: &'static str,
205}
206
207#[derive(Clone, Copy, CustomDebug, Default)]
209pub struct EuvContextMenuSeparatorProps {
210 pub label: &'static str,
212}
213
214#[derive(Clone, Copy, CustomDebug, Default)]
216pub struct EuvContextMenuShortcutProps {
217 pub text: &'static str,
219}
220
221#[cfg(target_arch = "wasm32")]
223#[derive(Data)]
224pub(crate) struct ContextMenuSubHover {
225 #[get(pub(super))]
226 #[set(pub(super))]
227 #[get_mut(pub(super))]
228 pub(super) open: Signal<bool>,
229 #[get(pub(super))]
230 #[set(pub(super))]
231 #[get_mut(pub(super))]
232 pub(super) parent: Rc<ContextMenuHoverOwner>,
233 #[get(pub(super))]
234 #[set(pub(super))]
235 #[get_mut(pub(super))]
236 pub(super) target: NodeRef<Element>,
237 #[get(pub(super))]
238 #[set(pub(super))]
239 #[get_mut(pub(super))]
240 pub(super) options: Cell<(bool, bool, u32, u32)>,
241 #[get(pub(super))]
242 #[set(pub(super))]
243 #[get_mut(pub(super))]
244 pub(super) mounted: Cell<bool>,
245 #[get(pub(super))]
246 #[set(pub(super))]
247 #[get_mut(pub(super))]
248 pub(super) timer: Cell<Option<i32>>,
249 #[get(pub(super))]
250 #[set(pub(super))]
251 #[get_mut(pub(super))]
252 pub(super) intent: Cell<Option<bool>>,
253 #[get(pub(super))]
254 #[set(pub(super))]
255 #[get_mut(pub(super))]
256 pub(super) anchor: Cell<Option<(f64, f64)>>,
257 #[get(pub(super))]
258 #[set(pub(super))]
259 #[get_mut(pub(super))]
260 pub(super) callback: RefCell<Option<Closure<dyn FnMut()>>>,
261 #[get(pub(super))]
263 pub(super) cleanup: RefCell<Option<Box<dyn FnOnce()>>>,
264}
265
266#[cfg(target_arch = "wasm32")]
268#[derive(Data)]
269pub(crate) struct ContextMenuHoverOwner {
270 #[get(pub(crate), type(copy))]
271 pub(crate) parent: Signal<bool>,
272 #[get(pub(crate))]
273 pub(crate) controller: RefCell<Option<Weak<ContextMenuSubHover>>>,
274}