pub trait PlatformMenuDelegate {
// Required methods
fn set_menus(&self, app: &mut App, top_level_menus: &[PlatformMenuItemRef]);
fn clear_menus(&self, app: &mut App);
fn debug_lock_delegate(&self, context: BuildContext) -> bool;
fn debug_unlock_delegate(&self, context: BuildContext) -> bool;
}Expand description
An abstract delegate that can be used to set WidgetsBinding::set_platform_menu_delegate
to provide for managing platform menus.
This can be implemented to provide a different menu plugin than the default system-provided
plugin for managing PlatformMenuBar menus.
The set_menus method allows for setting of the menu hierarchy when the
PlatformMenuBar menu hierarchy changes.
This delegate doesn’t handle the results of clicking on a menu item, which is left to the implementor to handle for their implementation.
Required Methods§
Sets the entire menu hierarchy for a platform-rendered menu bar.
The top_level_menus argument is the list of menus that appear in the menu bar, which
themselves can have children.
To update the menu hierarchy or menu item state, call set_menus with
the modified hierarchy, and it will overwrite the previous menu state.
Clears any existing platform-rendered menus and leaves the application with no menus.
It is not necessary to call this before updating the menu with
set_menus.
Sourcefn debug_lock_delegate(&self, context: BuildContext) -> bool
fn debug_lock_delegate(&self, context: BuildContext) -> bool
This is called by PlatformMenuBar when it is initialized, to be sure that only one is
active at a time.
If the lock is successfully acquired, it will return true.
Sourcefn debug_unlock_delegate(&self, context: BuildContext) -> bool
fn debug_unlock_delegate(&self, context: BuildContext) -> bool
This is called by PlatformMenuBar when it is disposed, so that another one can take
over.
If it successfully unlocks the delegate, it will return true.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".