Skip to main content

PopoverTrigger

Trait PopoverTrigger 

Source
pub trait PopoverTrigger:
    Widget
    + Sized
    + 'static {
    // Required methods
    fn default_has_popup() -> HasPopup;
    fn default_show_caret() -> bool;
    fn caret_role(
        &self,
        interaction: &Signal<InteractionState>,
    ) -> Signal<TextRole>;
    fn with_shared_interaction(self, signal: Signal<InteractionState>) -> Self;
    fn with_has_popup(self, kind: HasPopup) -> Self;
    fn with_expanded_when(self, open: Signal<bool>) -> Self;
    fn with_on_activate(
        self,
        f: impl Fn(&mut EventContext<'_>) + 'static,
    ) -> Self;
    fn has_on_activate(&self) -> bool;

    // Provided method
    fn suppress_caret(&self) -> bool { ... }
}
Expand description

A trigger widget usable with PopoverWidget. Implemented for Button and IconButton. Captures the few points where the two triggers differ; everything else is handled by the generic wrapper.

Required Methods§

Source

fn default_has_popup() -> HasPopup

The has_popup kind announced by AT when the caller doesn’t override it. Button → [HasPopup::Dialog]; IconButton → [HasPopup::Menu].

Source

fn default_show_caret() -> bool

Whether the disclosure caret is painted by default. Buttonfalse (text buttons advertise via an inline trailing chevron); IconButtontrue (icon-only triggers have no label slot).

Source

fn caret_role(&self, interaction: &Signal<InteractionState>) -> Signal<TextRole>

The TextRole the disclosure caret tints with, derived from the shared interaction signal so the caret and trigger tint together across hover / press / focus / disabled. Only called when a caret is shown.

Source

fn with_shared_interaction(self, signal: Signal<InteractionState>) -> Self

Share an externally-allocated interaction signal so the caret colour tracks the trigger’s state (hover / press / focus / disabled) exactly.

Source

fn with_has_popup(self, kind: HasPopup) -> Self

Annotate the trigger with the given has_popup kind for AT.

Source

fn with_expanded_when(self, open: Signal<bool>) -> Self

Bind the trigger’s set_expanded disclosure state to open.

Source

fn with_on_activate(self, f: impl Fn(&mut EventContext<'_>) + 'static) -> Self

Install the popover’s open/close handler as the trigger’s activate callback.

Source

fn has_on_activate(&self) -> bool

Return true if the trigger already has an activate handler set by the caller — the wrapper replaces it and will warn at build time.

Provided Methods§

Source

fn suppress_caret(&self) -> bool

Whether the caret must be suppressed for this trigger regardless of the flag (e.g. IconButton at Compact has no room). Default: never suppressed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§