Reintroduce menu-related platform callbacks

This commit is contained in:
Nathan Sobo 2023-12-05 09:23:24 -07:00
parent 30725d6a17
commit dffe0ea058
3 changed files with 73 additions and 59 deletions

View file

@ -5,7 +5,7 @@ mod mac;
mod test;
use crate::{
point, size, AnyWindowHandle, BackgroundExecutor, Bounds, DevicePixels, Font, FontId,
point, size, Action, AnyWindowHandle, BackgroundExecutor, Bounds, DevicePixels, Font, FontId,
FontMetrics, FontRun, ForegroundExecutor, GlobalPixels, GlyphId, InputEvent, LineLayout,
Pixels, Point, RenderGlyphParams, RenderImageParams, RenderSvgParams, Result, Scene,
SharedString, Size, TaskLabel,
@ -90,6 +90,10 @@ pub trait Platform: 'static {
fn on_reopen(&self, callback: Box<dyn FnMut()>);
fn on_event(&self, callback: Box<dyn FnMut(InputEvent) -> bool>);
fn on_menu_command(&self, callback: Box<dyn FnMut(&dyn Action)>);
fn on_will_open_menu(&self, callback: Box<dyn FnMut()>);
fn on_validate_menu_command(&self, callback: Box<dyn FnMut(&dyn Action) -> bool>);
fn os_name(&self) -> &'static str;
fn os_version(&self) -> Result<SemanticVersion>;
fn app_version(&self) -> Result<SemanticVersion>;