Reduce WindowAdapter API slightly (#4304)

Move the set_fullscreen function added to the WindowAdapter trait in 779aff0b39
to be a function in WindowProperties instead.
That way it'll be easier in the future to extend this with other window states without
having to modify or break the WindowAdapter trait API.
This commit is contained in:
Simon Hausmann 2024-01-09 18:55:06 +01:00 committed by GitHub
parent 1ff1c68b20
commit 438b9afeaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 38 deletions

View file

@ -243,6 +243,12 @@ public:
return out;
}
/// Returns true if the window should be shown fullscreen; false otherwise.
bool fullscreen() const
{
return cbindgen_private::slint_window_properties_get_fullscreen(inner());
}
/// This struct describes the layout constraints of a window.
///
/// It is the return value of WindowProperties::layout_constraints().

View file

@ -111,6 +111,11 @@ pub extern "C" fn slint_window_properties_get_background(
*out = wp.background();
}
#[no_mangle]
pub extern "C" fn slint_window_properties_get_fullscreen(wp: &WindowProperties) -> bool {
wp.fullscreen()
}
#[repr(C)]
#[derive(Clone, Copy)]
/// a Repr(C) variant of slint::platform::LayoutConstraints