use super::*;
#[derive(Data, Default)]
pub(crate) struct ContextMenuLongPress {
#[get(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) origin: Option<(i32, i32, f64)>,
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) timer: Option<i32>,
#[get(skip)]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) callback: Option<Closure<dyn FnMut()>>,
}
#[derive(Clone, CustomDebug, Default)]
pub struct EuvContextMenuProps {
pub open: Signal<bool>,
}
#[derive(Clone, CustomDebug, Default)]
pub struct EuvContextMenuTriggerProps {
pub open: Signal<bool>,
pub disabled: bool,
pub label: &'static str,
}
#[derive(Clone, CustomDebug, Default)]
pub struct EuvContextMenuContentProps {
pub open: Signal<bool>,
}
#[derive(Clone, Copy, CustomDebug, Default)]
pub struct EuvContextMenuGroupProps {
pub label: &'static str,
}
#[derive(Clone, CustomDebug, Default)]
pub struct EuvContextMenuRadioGroupProps {
pub label: &'static str,
pub selection: EuvContextMenuRadioGroupState,
}
#[derive(Clone, CustomDebug, Default)]
pub struct EuvContextMenuRadioGroupState {
pub value: Signal<String>,
pub controlled: bool,
#[debug(skip)]
pub on_value_change: Option<Rc<dyn Fn(String)>>,
}
#[derive(Clone, Copy, CustomDebug, Default)]
pub struct EuvContextMenuSubProps {
pub open: Signal<bool>,
pub parent_open: Signal<bool>,
}
#[derive(Data)]
pub(crate) struct ContextMenuSubBindingScope {
#[get(pub(crate))]
pub(crate) slot: Rc<RefCell<Option<ContextMenuSubBinding>>>,
}
#[derive(Data)]
pub(crate) struct ContextMenuSubBinding {
#[get(pub(crate), type(copy))]
pub(crate) parent_open: Signal<bool>,
#[get(pub(crate), type(copy))]
pub(crate) open: Signal<bool>,
#[get(pub(crate), type(copy))]
pub(crate) parent_subscription: usize,
#[get(pub(crate), type(copy))]
pub(crate) open_subscription: usize,
#[cfg(target_arch = "wasm32")]
#[get(pub(crate))]
pub(crate) hover_owner: Rc<ContextMenuHoverOwner>,
}
#[derive(Clone, Copy, CustomDebug)]
pub struct EuvContextMenuSubTriggerProps {
pub label: &'static str,
pub open: Signal<bool>,
pub disabled: bool,
pub open_on_hover: bool,
pub delay_ms: u32,
pub close_delay_ms: u32,
}
#[derive(Clone, Copy, CustomDebug, Default)]
pub struct EuvContextMenuSubContentProps {
pub open: Signal<bool>,
}
#[derive(Clone, CustomDebug)]
pub struct EuvContextMenuItemProps {
pub open: Signal<bool>,
pub value: &'static str,
pub label: &'static str,
pub disabled: bool,
pub close_on_click: bool,
#[debug(skip)]
pub on_select: Option<Rc<dyn Fn(&'static str)>>,
}
#[derive(Clone, CustomDebug, Default)]
pub struct EuvContextMenuCheckboxItemProps {
pub open: Signal<bool>,
pub close_on_click: bool,
pub label: &'static str,
pub checked: Signal<bool>,
#[debug(skip)]
pub on_select: Option<Rc<dyn Fn(bool)>>,
}
#[derive(Clone, CustomDebug, Default)]
pub struct EuvContextMenuRadioItemProps {
pub label: &'static str,
pub value: &'static str,
pub selection: EuvContextMenuRadioGroupState,
pub disabled: bool,
pub open: Signal<bool>,
pub close_on_click: bool,
}
#[derive(Clone, Copy, CustomDebug, Default)]
pub struct EuvContextMenuLabelProps {
pub text: &'static str,
}
#[derive(Clone, Copy, CustomDebug, Default)]
pub struct EuvContextMenuSeparatorProps {
pub label: &'static str,
}
#[derive(Clone, Copy, CustomDebug, Default)]
pub struct EuvContextMenuShortcutProps {
pub text: &'static str,
}
#[cfg(target_arch = "wasm32")]
#[derive(Data)]
pub(crate) struct ContextMenuSubHover {
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) open: Signal<bool>,
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) parent: Rc<ContextMenuHoverOwner>,
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) target: NodeRef<Element>,
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) options: Cell<(bool, bool, u32, u32)>,
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) mounted: Cell<bool>,
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) timer: Cell<Option<i32>>,
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) intent: Cell<Option<bool>>,
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) anchor: Cell<Option<(f64, f64)>>,
#[get(pub(super))]
#[set(pub(super))]
#[get_mut(pub(super))]
pub(super) callback: RefCell<Option<Closure<dyn FnMut()>>>,
#[get(pub(super))]
pub(super) cleanup: RefCell<Option<Box<dyn FnOnce()>>>,
}
#[cfg(target_arch = "wasm32")]
#[derive(Data)]
pub(crate) struct ContextMenuHoverOwner {
#[get(pub(crate), type(copy))]
pub(crate) parent: Signal<bool>,
#[get(pub(crate))]
pub(crate) controller: RefCell<Option<Weak<ContextMenuSubHover>>>,
}