#[non_exhaustive]pub struct PopupSemantics { /* private fields */ }Expand description
Provider-neutral interaction and accessibility contract for a popup.
Defaults describe an interactive generic popup: outside press/Escape close it, pointer input is consumed, and focus is restored on close, but opening does not move focus. Builder booleans mean exactly whether each behavior is requested; the portal does not infer a role-specific override.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
let semantics = PopupSemantics::new();
assert!(semantics.dismisses_on_escape() && semantics.consumes_pointer_input());Implementations§
Source§impl PopupSemantics
Constructors, accessors, and immutable-style semantic builders.
impl PopupSemantics
Constructors, accessors, and immutable-style semantic builders.
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates the interactive generic defaults.
§Examples
use ailloli_ui_runtime::popup::{PopupFocusPolicy, PopupRole, PopupSemantics};
let value = PopupSemantics::new();
assert_eq!((value.role(), value.focus_policy()), (PopupRole::Generic, PopupFocusPolicy::None));
assert!(value.dismisses_on_outside_press() && value.dismisses_on_escape() && value.consumes_pointer_input() && value.restores_focus_on_close());Sourcepub const fn role(&self) -> PopupRole
pub const fn role(&self) -> PopupRole
Returns the semantic category.
§Examples
use ailloli_ui_runtime::popup::{PopupRole, PopupSemantics};
assert_eq!(PopupSemantics::new().with_role(PopupRole::Menu).role(), PopupRole::Menu);Sourcepub const fn focus_policy(&self) -> PopupFocusPolicy
pub const fn focus_policy(&self) -> PopupFocusPolicy
Returns requested focus behavior on open.
§Examples
use ailloli_ui_runtime::popup::{PopupFocusPolicy, PopupSemantics};
assert_eq!(PopupSemantics::new().with_focus_policy(PopupFocusPolicy::MoveIntoPopup).focus_policy(), PopupFocusPolicy::MoveIntoPopup);Sourcepub const fn dismisses_on_outside_press(&self) -> bool
pub const fn dismisses_on_outside_press(&self) -> bool
Reports whether an outside press requests dismissal.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
assert!(!PopupSemantics::new().dismiss_on_outside_press(false).dismisses_on_outside_press());Sourcepub const fn dismisses_on_escape(&self) -> bool
pub const fn dismisses_on_escape(&self) -> bool
Reports whether Escape requests dismissal.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
assert!(!PopupSemantics::new().dismiss_on_escape(false).dismisses_on_escape());Sourcepub const fn consumes_pointer_input(&self) -> bool
pub const fn consumes_pointer_input(&self) -> bool
Reports whether routed pointer input is considered handled.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
assert!(!PopupSemantics::new().consume_pointer_input(false).consumes_pointer_input());Sourcepub const fn restores_focus_on_close(&self) -> bool
pub const fn restores_focus_on_close(&self) -> bool
Reports whether close emits owner focus restoration.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
assert!(!PopupSemantics::new().restore_focus_on_close(false).restores_focus_on_close());Sourcepub const fn with_role(self, role: PopupRole) -> Self
pub const fn with_role(self, role: PopupRole) -> Self
Replaces the semantic category without changing other behavior.
§Examples
use ailloli_ui_runtime::popup::{PopupRole, PopupSemantics};
assert_eq!(PopupSemantics::new().with_role(PopupRole::Listbox).role(), PopupRole::Listbox);Sourcepub const fn with_focus_policy(self, focus_policy: PopupFocusPolicy) -> Self
pub const fn with_focus_policy(self, focus_policy: PopupFocusPolicy) -> Self
Replaces focus-on-open behavior.
§Examples
use ailloli_ui_runtime::popup::{PopupFocusPolicy, PopupSemantics};
assert_eq!(PopupSemantics::new().with_focus_policy(PopupFocusPolicy::TrapWithinPopup).focus_policy(), PopupFocusPolicy::TrapWithinPopup);Sourcepub const fn dismiss_on_outside_press(self, dismiss: bool) -> Self
pub const fn dismiss_on_outside_press(self, dismiss: bool) -> Self
Sets outside-press dismissal exactly to dismiss.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
assert!(!PopupSemantics::new().dismiss_on_outside_press(false).dismisses_on_outside_press());Sourcepub const fn dismiss_on_escape(self, dismiss: bool) -> Self
pub const fn dismiss_on_escape(self, dismiss: bool) -> Self
Sets Escape dismissal exactly to dismiss.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
assert!(!PopupSemantics::new().dismiss_on_escape(false).dismisses_on_escape());Sourcepub const fn consume_pointer_input(self, consume: bool) -> Self
pub const fn consume_pointer_input(self, consume: bool) -> Self
Sets pointer-input consumption exactly to consume.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
assert!(!PopupSemantics::new().consume_pointer_input(false).consumes_pointer_input());Sourcepub const fn restore_focus_on_close(self, restore: bool) -> Self
pub const fn restore_focus_on_close(self, restore: bool) -> Self
Sets owner focus restoration exactly to restore.
§Examples
use ailloli_ui_runtime::popup::PopupSemantics;
assert!(!PopupSemantics::new().restore_focus_on_close(false).restores_focus_on_close());Sourcepub const fn tooltip() -> Self
pub const fn tooltip() -> Self
Non-interactive semantics suitable for a tooltip.
Role is tooltip; Escape dismissal stays enabled, while outside press, pointer consumption, and focus restoration are disabled.
§Examples
use ailloli_ui_runtime::popup::{PopupRole, PopupSemantics};
let value = PopupSemantics::tooltip();
assert_eq!(value.role(), PopupRole::Tooltip);
assert!(value.dismisses_on_escape());
assert!(!value.dismisses_on_outside_press() && !value.consumes_pointer_input());
assert!(!value.restores_focus_on_close());Trait Implementations§
Source§impl Clone for PopupSemantics
impl Clone for PopupSemantics
Source§fn clone(&self) -> PopupSemantics
fn clone(&self) -> PopupSemantics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PopupSemantics
impl Debug for PopupSemantics
Source§impl Default for PopupSemantics
Uses the interactive defaults from PopupSemantics::new.
impl Default for PopupSemantics
Uses the interactive defaults from PopupSemantics::new.
Source§fn default() -> Self
fn default() -> Self
Returns PopupSemantics::new.
Source§impl PartialEq for PopupSemantics
impl PartialEq for PopupSemantics
impl Eq for PopupSemantics
impl StructuralPartialEq for PopupSemantics
Auto Trait Implementations§
impl Freeze for PopupSemantics
impl RefUnwindSafe for PopupSemantics
impl Send for PopupSemantics
impl Sync for PopupSemantics
impl Unpin for PopupSemantics
impl UnwindSafe for PopupSemantics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.