pub struct Popup { /* private fields */ }Expand description
A styled dropdown popup anchored to an arbitrary caller rectangle (e.g. a
toolbar button), rather than the tray icon or a bare point. It reuses the exact
place_popup math the tray uses; Tray, ContextMenu, and Popup differ
only in how the anchor rectangle is obtained, and all funnel into one shared
PopupSession (spec 01 §5.3, spec 20 §3).
Implementations§
Source§impl Popup
impl Popup
Sourcepub fn options(self, options: MenuOptions) -> Self
pub fn options(self, options: MenuOptions) -> Self
Set popup options (width bounds, theme source).
Sourcepub fn on_click(self, handler: impl Fn(&MenuId) + Send + 'static) -> Self
pub fn on_click(self, handler: impl Fn(&MenuId) + Send + 'static) -> Self
Register a click handler invoked with the activated row’s MenuId.
Borrow the menu.
Borrow the options.
Sourcepub fn accessibility_tree(&self) -> AxTree
pub fn accessibility_tree(&self) -> AxTree
Build the AxTree the platform screen reader walks over this menu.
Sourcepub fn dispatch(&self, id: &MenuId)
pub fn dispatch(&self, id: &MenuId)
Dispatch a click to the registered handler, if any. Fires the on_click
closure first, then projects the activation onto the global
MenuEvent channel (spec 03 §3) — so a Popup is a first-class event
source alongside Tray and ContextMenu, as
MenuEvent::receiver promises. An inert
MenuId::none fires neither.
Sourcepub fn anchored_to(&self, anchor: LogicalRect, edge: Edge) -> Result<()>
pub fn anchored_to(&self, anchor: LogicalRect, edge: Edge) -> Result<()>
Show the popup anchored to anchor (a caller rectangle in screen logical
coordinates), growing from edge, and block until it is dismissed.
This is the tray’s session anchored to an arbitrary rect instead of the
tray icon (spec 20 §3). On platforms whose styled popup loop is not
implemented yet this returns Error::Platform.