(eframe) add Frame.set_visible (#1808)
This commit is contained in:
parent
cbe22a0371
commit
0338843950
3 changed files with 14 additions and 0 deletions
|
@ -565,6 +565,11 @@ impl Frame {
|
|||
self.output.drag_window = true;
|
||||
}
|
||||
|
||||
/// Set the visibility of the window.
|
||||
pub fn set_visible(&mut self, visible: bool) {
|
||||
self.output.visible = Some(visible);
|
||||
}
|
||||
|
||||
/// for integrations only: call once per frame
|
||||
#[doc(hidden)]
|
||||
pub fn take_app_output(&mut self) -> backend::AppOutput {
|
||||
|
@ -740,5 +745,8 @@ pub mod backend {
|
|||
|
||||
/// Set to some position to move the outer window (e.g. glium window) to this position
|
||||
pub window_pos: Option<egui::Pos2>,
|
||||
|
||||
/// Set to some bool to change window visibility.
|
||||
pub visible: Option<bool>,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@ pub fn handle_app_output(
|
|||
decorated,
|
||||
drag_window,
|
||||
window_pos,
|
||||
visible,
|
||||
} = app_output;
|
||||
|
||||
if let Some(decorated) = decorated {
|
||||
|
@ -150,6 +151,10 @@ pub fn handle_app_output(
|
|||
if drag_window {
|
||||
let _ = window.drag_window();
|
||||
}
|
||||
|
||||
if let Some(visible) = visible {
|
||||
window.set_visible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -300,6 +300,7 @@ impl AppRunner {
|
|||
decorated: _, // Can't toggle decorations
|
||||
drag_window: _, // Can't be dragged
|
||||
window_pos: _, // Can't set position of a web page
|
||||
visible: _, // Can't hide a web page
|
||||
} = app_output;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue