mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 20:31:27 +00:00
Merge remote-tracking branch 'origin/master' into wip/rename
Conflicts: api/cpp/cbindgen.rs api/cpp/include/slint.h examples/CMakeLists.txt examples/imagefilter/Cargo.toml examples/plotter/main.rs internal/backends/mcu/lib.rs
This commit is contained in:
commit
125b90a64b
44 changed files with 1476 additions and 144 deletions
|
|
@ -141,6 +141,25 @@ public:
|
|||
cbindgen_private::slint_windowrc_show_popup(&inner, &popup, p, &parent_item);
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
std::optional<SetRenderingNotifierError> set_rendering_notifier(F callback) const
|
||||
{
|
||||
auto actual_cb = [](RenderingState state, void *data) {
|
||||
(*reinterpret_cast<F *>(data))(state);
|
||||
};
|
||||
SetRenderingNotifierError err;
|
||||
if (cbindgen_private::sixtyfps_windowrc_set_rendering_notifier(
|
||||
&inner, actual_cb,
|
||||
[](void *user_data) { delete reinterpret_cast<F *>(user_data); },
|
||||
new F(std::move(callback)), &err)) {
|
||||
return {};
|
||||
} else {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
void request_redraw() const { cbindgen_private::sixtyfps_windowrc_request_redraw(&inner); }
|
||||
|
||||
private:
|
||||
cbindgen_private::WindowRcOpaque inner;
|
||||
};
|
||||
|
|
@ -314,6 +333,19 @@ public:
|
|||
/// De-registers the window from the windowing system, therefore hiding it.
|
||||
void hide() { inner.hide(); }
|
||||
|
||||
/// This function allows registering a callback that's invoked during the different phases of
|
||||
/// rendering. This allows custom rendering on top or below of the scene.
|
||||
/// On success, the function returns a std::optional without value. On error, the function
|
||||
/// returns the error code as value in the std::optional.
|
||||
template<typename F>
|
||||
std::optional<SetRenderingNotifierError> set_rendering_notifier(F &&callback) const
|
||||
{
|
||||
return inner.set_rendering_notifier(std::forward<F>(callback));
|
||||
}
|
||||
|
||||
/// This function issues a request to the windowing system to redraw the contents of the window.
|
||||
void request_redraw() const { inner.request_redraw(); }
|
||||
|
||||
/// \private
|
||||
private_api::WindowRc &window_handle() { return inner; }
|
||||
/// \private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue