Skip to main content

SystemContextMenuController

Struct SystemContextMenuController 

Source
pub struct SystemContextMenuController {
    pub on_system_hide: Option<Listener>,
    /* private fields */
}
Expand description

Allows access to the system context menu.

The context menu is the menu that appears, for example, when doing text selection. Flutter typically draws this menu itself, but on some platforms this class calls a platform method to show the system-drawn context menu instead.

There can only be one system context menu visible at a time. Calling [show] on one instance of this class while another instance is already shown will hide the old one.

Call [dispose] when no longer needed.

Fields§

§on_system_hide: Option<Listener>

Called when the system has hidden the context menu.

Implementations§

Source§

impl SystemContextMenuController

Source

pub fn new(app: &mut App, on_system_hide: Option<Listener>) -> Handle<Self>

Creates an instance of SystemContextMenuController.

Not shown until show is called.

Source

pub fn handle_system_hide(self: Handle<Self>, app: &mut App)

Called when the system has hidden the context menu.

Source

pub fn handle_custom_context_menu_action( self: Handle<Self>, app: &mut App, callback_id: &str, )

Called when the user selects a custom menu item.

Source

pub fn show(self: Handle<Self>, app: &mut App, target_rect: Rect)

👎Deprecated:

Use show_with_items instead.

Shows the system context menu anchored on the given Rect.

Currently this system context menu is bound to text input. Using this without an active TextInputConnection will be a noop.

Source

pub fn show_with_items( self: Handle<Self>, app: &mut App, target_rect: Rect, items: Vec<IOSSystemContextMenuItemData>, )

Shows the system context menu anchored on the given Rect with the given buttons.

Source

pub fn hide(self: Handle<Self>, app: &mut App)

Hides this system context menu.

Source

pub fn dispose(self: Handle<Self>, app: &mut App)

Used to release resources when this instance will never be used again.

Source

pub fn dispatch_system_hide(app: &mut App)

Dispatch a system-hide from the host to the currently shown controller.

Source

pub fn dispatch_custom_action(app: &mut App, callback_id: &str)

Dispatch a custom action from the host to the currently shown controller.

Trait Implementations§

Source§

impl Debug for SystemContextMenuController

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>