mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
add actions for window controls
This commit is contained in:
@@ -711,6 +711,18 @@ impl Frame {
|
||||
self.output.close = true;
|
||||
}
|
||||
|
||||
/// Minimize or unminimize window. (native only)
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn set_minimized(&mut self, minimized: bool) {
|
||||
self.output.minimized = Some(minimized);
|
||||
}
|
||||
|
||||
/// Maximize or unmaximize window. (native only)
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn set_maximized(&mut self, maximized: bool) {
|
||||
self.output.maximized = Some(maximized);
|
||||
}
|
||||
|
||||
/// Tell `eframe` to close the desktop window.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[deprecated = "Renamed `close`"]
|
||||
@@ -1001,5 +1013,13 @@ pub(crate) mod backend {
|
||||
/// Set to some bool to tell the window always on top.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub always_on_top: Option<bool>,
|
||||
|
||||
/// Set to some bool to minimize or unminimize window.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub minimized: Option<bool>,
|
||||
|
||||
/// Set to some bool to maximize or unmaximize window.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub maximized: Option<bool>,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,8 @@ pub fn handle_app_output(
|
||||
window_pos,
|
||||
visible,
|
||||
always_on_top,
|
||||
minimized,
|
||||
maximized,
|
||||
} = app_output;
|
||||
|
||||
if let Some(decorated) = decorated {
|
||||
@@ -190,6 +192,14 @@ pub fn handle_app_output(
|
||||
if let Some(always_on_top) = always_on_top {
|
||||
window.set_always_on_top(always_on_top);
|
||||
}
|
||||
|
||||
if let Some(minimized) = minimized {
|
||||
window.set_minimized(minimized)
|
||||
}
|
||||
|
||||
if let Some(maximized) = maximized {
|
||||
window.set_maximized(maximized);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user