Add unit test for ViewContext::observe_window_activation
This commit is contained in:
parent
885172f4dd
commit
d43e8b270a
2 changed files with 116 additions and 3 deletions
|
@ -37,6 +37,7 @@ pub struct Window {
|
|||
event_handlers: Vec<Box<dyn FnMut(super::Event) -> bool>>,
|
||||
resize_handlers: Vec<Box<dyn FnMut()>>,
|
||||
close_handlers: Vec<Box<dyn FnOnce()>>,
|
||||
pub(crate) active_status_change_handlers: Vec<Box<dyn FnMut(bool)>>,
|
||||
pub(crate) should_close_handler: Option<Box<dyn FnMut() -> bool>>,
|
||||
pub(crate) title: Option<String>,
|
||||
pub(crate) edited: bool,
|
||||
|
@ -191,6 +192,7 @@ impl Window {
|
|||
resize_handlers: Default::default(),
|
||||
close_handlers: Default::default(),
|
||||
should_close_handler: Default::default(),
|
||||
active_status_change_handlers: Default::default(),
|
||||
scale_factor: 1.0,
|
||||
current_scene: None,
|
||||
title: None,
|
||||
|
@ -241,7 +243,9 @@ impl super::Window for Window {
|
|||
self.event_handlers.push(callback);
|
||||
}
|
||||
|
||||
fn on_active_status_change(&mut self, _: Box<dyn FnMut(bool)>) {}
|
||||
fn on_active_status_change(&mut self, callback: Box<dyn FnMut(bool)>) {
|
||||
self.active_status_change_handlers.push(callback);
|
||||
}
|
||||
|
||||
fn on_resize(&mut self, callback: Box<dyn FnMut()>) {
|
||||
self.resize_handlers.push(callback);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue