mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 13:51:13 +00:00
Get rid of abi::datastructures::WindowProperties
Instead, pass a reference to the root item when mapping the window, at which point we can downcast to the new Window item. If we have one, then we'll read its width/height (for initial values) and install bindings to keep them up-to-date.
This commit is contained in:
parent
3d5d112deb
commit
aafb96cb93
14 changed files with 150 additions and 116 deletions
|
@ -642,24 +642,16 @@ fn generate_component(
|
|||
}),
|
||||
));
|
||||
|
||||
let window_props = |name| {
|
||||
let root_elem = component.root_element.borrow();
|
||||
|
||||
if root_elem.lookup_property(name) == Type::Length {
|
||||
format!("&this->{}.{}", root_elem.id, name)
|
||||
} else {
|
||||
"nullptr".to_owned()
|
||||
}
|
||||
};
|
||||
let root_elem = component.root_element.borrow();
|
||||
component_struct.members.push((
|
||||
Access::Public,
|
||||
Declaration::Function(Function {
|
||||
name: "window_properties".into(),
|
||||
signature: "() -> sixtyfps::WindowProperties".into(),
|
||||
name: "root_item".into(),
|
||||
signature: "() -> VRef<sixtyfps::internal::ItemVTable>".into(),
|
||||
statements: Some(vec![format!(
|
||||
"return {{ {} , {} }};",
|
||||
window_props("width"),
|
||||
window_props("height")
|
||||
"return {{ &sixtyfps::{vt}, &this->{id} }};",
|
||||
vt = root_elem.base_type.as_native().vtable_symbol,
|
||||
id = root_elem.id
|
||||
)]),
|
||||
..Default::default()
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue