Add support for manually closing PopupWindows

This patch adds a `close()` function that can be called to close a popup
window, and a `close-to-click` boolean that can be set to false to
disable the default behavior.
This commit is contained in:
Simon Hausmann 2023-06-02 08:12:39 +02:00 committed by Simon Hausmann
parent a0a5294e49
commit 0f54b9599b
20 changed files with 349 additions and 24 deletions

View file

@ -161,13 +161,16 @@ public:
}
template<typename Component, typename Parent>
void show_popup(const Parent *parent_component, cbindgen_private::Point p,
void show_popup(const Parent *parent_component, cbindgen_private::Point p, bool close_on_click,
cbindgen_private::ItemRc parent_item) const
{
auto popup = Component::create(parent_component).into_dyn();
cbindgen_private::slint_windowrc_show_popup(&inner, &popup, p, &parent_item);
cbindgen_private::slint_windowrc_show_popup(&inner, &popup, p, close_on_click,
&parent_item);
}
void close_popup() const { cbindgen_private::slint_windowrc_close_popup(&inner); }
template<std::invocable<RenderingState, GraphicsAPI> F>
std::optional<SetRenderingNotifierError> set_rendering_notifier(F callback) const
{