mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Add OutputCommand for copying text and opening URL:s (#5532)
Add `OutputCommand` for copying text and opening URL:s * Part of https://github.com/emilk/egui/issues/5424 * Adds `egui::OutputComm * Part of https://github.com/emilk/egui/issues/5424and` * Adds `PlatformOutput::commands` * Deprecates `PlatformOutput::open_url` * Deprecates `PlatformOutput::copied_text`
This commit is contained in:
@@ -820,9 +820,11 @@ impl State {
|
||||
window: &Window,
|
||||
platform_output: egui::PlatformOutput,
|
||||
) {
|
||||
#![allow(deprecated)]
|
||||
profiling::function_scope!();
|
||||
|
||||
let egui::PlatformOutput {
|
||||
commands,
|
||||
cursor_icon,
|
||||
open_url,
|
||||
copied_text,
|
||||
@@ -835,6 +837,17 @@ impl State {
|
||||
request_discard_reasons: _, // `egui::Context::run` handles this
|
||||
} = platform_output;
|
||||
|
||||
for command in commands {
|
||||
match command {
|
||||
egui::OutputCommand::CopyText(text) => {
|
||||
self.clipboard.set(text);
|
||||
}
|
||||
egui::OutputCommand::OpenUrl(open_url) => {
|
||||
open_url_in_browser(&open_url.url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.set_cursor_icon(window, cursor_icon);
|
||||
|
||||
if let Some(open_url) = open_url {
|
||||
|
||||
Reference in New Issue
Block a user