mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 20:31:27 +00:00
Experimental support for MenuBar
Introduces `MenuBar{ ... }` that can be put in a Window
This commit is contained in:
parent
20443ec0df
commit
5bd20def0e
38 changed files with 1023 additions and 69 deletions
|
|
@ -43,6 +43,7 @@ inline void assert_main_thread()
|
|||
}
|
||||
|
||||
using ItemTreeRc = vtable::VRc<cbindgen_private::ItemTreeVTable>;
|
||||
using slint::LogicalPosition;
|
||||
|
||||
class WindowAdapterRc
|
||||
{
|
||||
|
|
@ -111,7 +112,7 @@ public:
|
|||
cbindgen_private::ItemRc parent_item) const
|
||||
{
|
||||
auto popup = Component::create(parent_component);
|
||||
cbindgen_private::Point p = pos(popup);
|
||||
auto p = pos(popup);
|
||||
auto popup_dyn = popup.into_dyn();
|
||||
return cbindgen_private::slint_windowrc_show_popup(&inner, &popup_dyn, p, close_policy,
|
||||
&parent_item);
|
||||
|
|
@ -124,6 +125,20 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template<typename Component, typename SharedGlobals, typename InitFn>
|
||||
uint32_t show_popup_menu(SharedGlobals *globals, LogicalPosition pos,
|
||||
cbindgen_private::ItemRc context_menu_rc, InitFn init) const
|
||||
{
|
||||
// if (cbindgen_private::slint_windowrc_show_native_context_menu(....)) { return }
|
||||
|
||||
auto popup = Component::create(globals);
|
||||
init(&*popup);
|
||||
auto popup_dyn = popup.into_dyn();
|
||||
return cbindgen_private::slint_windowrc_show_popup(
|
||||
&inner, &popup_dyn, pos, cbindgen_private::PopupClosePolicy::CloseOnClickOutside,
|
||||
&context_menu_rc);
|
||||
}
|
||||
|
||||
template<std::invocable<RenderingState, GraphicsAPI> F>
|
||||
std::optional<SetRenderingNotifierError> set_rendering_notifier(F callback) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue