Skip to main content

inset_embedder/
system_context_menu.rs

1//! Flutter counterpart: the `ContextMenu.showSystemContextMenu` /
2//! `hideSystemContextMenu` payloads on `SystemChannels.platform`.
3//!
4//! Lives here because [`crate::Platform`] names these types.
5
6/// A button to show in the system-rendered context menu.
7///
8/// Flutter serializes this as the `items` list of `ContextMenu.showSystemContextMenu`.
9/// Built-in kinds have no callback: the platform performs the action (on iOS, against
10/// the active text input). [`Custom`](Self::Custom) is invoked through
11/// [`crate::EmbedderClient::custom_context_menu_action`].
12#[derive(Clone, Debug, PartialEq, Eq)]
13pub enum SystemContextMenuItem {
14    /// The system's built-in copy button.
15    Copy,
16    /// The system's built-in cut button.
17    Cut,
18    /// The system's built-in paste button.
19    Paste,
20    /// The system's built-in select-all button.
21    SelectAll,
22    /// The system's built-in look-up button.
23    LookUp {
24        /// Localized title.
25        title: String,
26    },
27    /// The system's built-in search-web button.
28    SearchWeb {
29        /// Localized title.
30        title: String,
31    },
32    /// The system's built-in share button.
33    Share {
34        /// Localized title.
35        title: String,
36    },
37    /// The system's built-in Live Text (OCR) button.
38    LiveText,
39    /// A developer-defined button.
40    Custom {
41        /// Id the host sends back on [`crate::EmbedderClient::custom_context_menu_action`].
42        id: String,
43        /// Title shown in the menu.
44        title: String,
45    },
46}