Create an API for assigning the menubar contents
This commit is contained in:
@@ -15,7 +15,7 @@ use crate::{
|
||||
vector::Vector2F,
|
||||
},
|
||||
text_layout::Line,
|
||||
Scene,
|
||||
Menu, Scene,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use async_task::Runnable;
|
||||
@@ -23,11 +23,13 @@ pub use event::Event;
|
||||
use std::{ops::Range, path::PathBuf, rc::Rc, sync::Arc};
|
||||
|
||||
pub trait Runner {
|
||||
fn on_finish_launching<F: 'static + FnOnce()>(self, callback: F) -> Self where;
|
||||
fn on_finish_launching<F: 'static + FnOnce()>(self, callback: F) -> Self;
|
||||
fn on_menu_command<F: 'static + FnMut(&str)>(self, callback: F) -> Self;
|
||||
fn on_become_active<F: 'static + FnMut()>(self, callback: F) -> Self;
|
||||
fn on_resign_active<F: 'static + FnMut()>(self, callback: F) -> Self;
|
||||
fn on_event<F: 'static + FnMut(Event) -> bool>(self, callback: F) -> Self;
|
||||
fn on_open_files<F: 'static + FnMut(Vec<PathBuf>)>(self, callback: F) -> Self;
|
||||
fn set_menus(self, menus: &[Menu]) -> Self;
|
||||
fn run(self);
|
||||
}
|
||||
|
||||
@@ -40,6 +42,7 @@ pub trait App {
|
||||
executor: Rc<executor::Foreground>,
|
||||
) -> Result<Box<dyn Window>>;
|
||||
fn fonts(&self) -> Arc<dyn FontSystem>;
|
||||
fn quit(&self);
|
||||
}
|
||||
|
||||
pub trait Dispatcher: Send + Sync {
|
||||
|
||||
Reference in New Issue
Block a user