Set window's edited = true when there are unsaved changes

This commit is contained in:
Antonio Scandurra 2022-06-23 10:59:50 +02:00
parent a6262b97ff
commit ca8ddcdeec
5 changed files with 38 additions and 0 deletions

View file

@ -38,6 +38,7 @@ pub struct Window {
resize_handlers: Vec<Box<dyn FnMut()>>,
close_handlers: Vec<Box<dyn FnOnce()>>,
pub(crate) title: Option<String>,
pub(crate) edited: bool,
pub(crate) pending_prompts: RefCell<VecDeque<oneshot::Sender<usize>>>,
}
@ -191,6 +192,7 @@ impl Window {
scale_factor: 1.0,
current_scene: None,
title: None,
edited: false,
pending_prompts: Default::default(),
}
}
@ -258,6 +260,10 @@ impl super::Window for Window {
fn set_title(&mut self, title: &str) {
self.title = Some(title.to_string())
}
fn set_edited(&mut self, edited: bool) {
self.edited = edited;
}
}
pub fn platform() -> Platform {