pub struct ModuleCx { /* private fields */ }Expand description
The context of a module function that is not async: the platform’s
services, applied in order right after the call (an async one uses the
free functions, dialog(..), …).
Implementations§
Source§impl ModuleCx
impl ModuleCx
Sourcepub fn dialog(&mut self, dialog: AlertDialogRequest) -> DialogAnswer
pub fn dialog(&mut self, dialog: AlertDialogRequest) -> DialogAnswer
Shows dialog; await the answer in an async function.
Sourcepub fn set_builtin_scrollbars(
&mut self,
source: ScrollbarSource,
theme: Option<AnyValue>,
)
pub fn set_builtin_scrollbars( &mut self, source: ScrollbarSource, theme: Option<AnyValue>, )
Draws the views’ bars with the built-in bar source makes of
theme, or with the platform’s indicator
(set_builtin_scrollbars).
Sourcepub fn run_on_main_thread<R: Send + 'static>(
&mut self,
f: impl FnOnce() -> R + Send + 'static,
) -> OnMainThread<R> ⓘ
pub fn run_on_main_thread<R: Send + 'static>( &mut self, f: impl FnOnce() -> R + Send + 'static, ) -> OnMainThread<R> ⓘ
Runs f on the platform’s main thread after the call, as
run_on_main_thread does: spawn a task
that awaits the result, or drop it.
Sourcepub fn dismiss_keyboard(&mut self)
pub fn dismiss_keyboard(&mut self)
Unfocuses the focused input, hiding the software keyboard.
Sourcepub fn set_status_bar(&mut self, patch: StatusBarSetting)
pub fn set_status_bar(&mut self, patch: StatusBarSetting)
Changes what functions set for the status bar (the fields patch
sets), under the settings components render.
Sourcepub fn animate_layout(&mut self, animation: LayoutAnimation)
pub fn animate_layout(&mut self, animation: LayoutAnimation)
Animates the layout changes of the next commit.
Sourcepub fn announce_for_accessibility(&mut self, message: impl Into<String>)
pub fn announce_for_accessibility(&mut self, message: impl Into<String>)
The screen reader reads message (TS:
announce).
Sourcepub fn set_clipboard(
&mut self,
text: impl Into<String>,
) -> Answer<ClipboardWrite> ⓘ
pub fn set_clipboard( &mut self, text: impl Into<String>, ) -> Answer<ClipboardWrite> ⓘ
Puts text on the system clipboard (TS: Clipboard.writeText).
The answer says whether the system clipboard took it.
Sourcepub fn set_clipboard_item(
&mut self,
item: ClipboardItem,
) -> Answer<ClipboardWrite> ⓘ
pub fn set_clipboard_item( &mut self, item: ClipboardItem, ) -> Answer<ClipboardWrite> ⓘ
Puts item, its text and its HTML, on the system clipboard (TS:
Clipboard.write).
The answer says whether the system clipboard took it.
Sourcepub fn set_clipboard_image(&mut self, uri: impl Into<String>)
pub fn set_clipboard_image(&mut self, uri: impl Into<String>)
Puts the image of a data: URI on the system clipboard (TS:
Clipboard.writeImage).
Sourcepub fn set_color_scheme(&mut self, appearance: Appearance)
pub fn set_color_scheme(&mut self, appearance: Appearance)
Shows the surface in appearance whatever the system’s (TS:
setColorScheme): crate::prelude::dark (the theme’s mode),
dark: classes and the platform’s controls follow it;
crate::platform::Appearance::System follows the system again.
Sourcepub fn set_locale(&mut self, locale: Option<Locale>)
pub fn set_locale(&mut self, locale: Option<Locale>)
Shows the app in locale whatever the user’s language (None: the
user’s again), as crate::i18n::set_locale does.