mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Fix up some examples (#3614)
This commit is contained in:
@@ -149,25 +149,10 @@ pub trait App {
|
||||
/// On native the path is picked using [`crate::storage_dir`].
|
||||
fn save(&mut self, _storage: &mut dyn Storage) {}
|
||||
|
||||
/// Called when the user attempts to close the desktop window and/or quit the application.
|
||||
///
|
||||
/// By returning `false` the closing will be aborted. To continue the closing return `true`.
|
||||
///
|
||||
/// A scenario where this method will be run is after pressing the close button on a native
|
||||
/// window, which allows you to ask the user whether they want to do something before exiting.
|
||||
/// See the example at <https://github.com/emilk/egui/blob/master/examples/confirm_exit/> for practical usage.
|
||||
///
|
||||
/// It will _not_ be called on the web or when the window is forcefully closed.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[doc(alias = "exit")]
|
||||
#[doc(alias = "quit")]
|
||||
fn on_close_event(&mut self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Called once on shutdown, after [`Self::save`].
|
||||
///
|
||||
/// If you need to abort an exit use [`Self::on_close_event`].
|
||||
/// If you need to abort an exit check `ctx.input(|i| i.viewport().close_requested())`
|
||||
/// and respond with [`egui::ViewportCommand::CancelClose`].
|
||||
///
|
||||
/// To get a [`glow`] context you need to compile with the `glow` feature flag,
|
||||
/// and run eframe with the glow backend.
|
||||
|
||||
Reference in New Issue
Block a user