Experimental support for MenuBar

Introduces `MenuBar{ ... }` that can be put in a Window
This commit is contained in:
Olivier Goffart 2024-10-08 18:24:52 +02:00
parent 20443ec0df
commit 5bd20def0e
38 changed files with 1023 additions and 69 deletions

View file

@ -261,6 +261,9 @@ impl Snapshotter {
document.inner_components.iter().for_each(|ic| {
let _ = self.create_component(ic);
});
if let Some(popup_menu_impl) = &document.popup_menu_impl {
let _ = self.create_component(popup_menu_impl);
}
}
fn snapshot_document(&mut self, document: &object_tree::Document) -> object_tree::Document {
@ -284,6 +287,10 @@ impl Snapshotter {
exports,
embedded_file_resources: document.embedded_file_resources.clone(),
used_types: RefCell::new(self.snapshot_used_sub_types(&document.used_types.borrow())),
popup_menu_impl: document.popup_menu_impl.as_ref().map(|p| {
Weak::upgrade(&self.use_component(p))
.expect("Components can get upgraded at this point")
}),
}
}