Skip to main content

NativeMenuBackend

Trait NativeMenuBackend 

Source
pub trait NativeMenuBackend {
    // Required methods
    fn set_window_menu(
        &mut self,
        window_id: TeksiloWindowId,
        menu: NativeMenuSnapshot,
        poster: Arc<dyn AppEventPoster>,
    );
    fn activate_window(&mut self, window_id: TeksiloWindowId);
    fn clear_window(&mut self, window_id: TeksiloWindowId);
    fn update_item(&mut self, id: MenuItemId, delta: MenuItemDelta);
}
Expand description

Swappable native-menu backend. One instance serves the whole app.

Required Methods§

Source

fn set_window_menu( &mut self, window_id: TeksiloWindowId, menu: NativeMenuSnapshot, poster: Arc<dyn AppEventPoster>, )

Build (or replace) the native menu for window_id from menu. For every item the user later chooses, the backend MUST post a NativeMenuEventPayload — with window_id_owner == window_id — through poster. If window_id is (or becomes) the active window, the backend should also make this menu the visible one.

Source

fn activate_window(&mut self, window_id: TeksiloWindowId)

Make window_id’s previously-set menu the active/visible one (focus follows window). No-op if that window never set a menu.

Source

fn clear_window(&mut self, window_id: TeksiloWindowId)

Forget window_id’s menu (window closed).

Source

fn update_item(&mut self, id: MenuItemId, delta: MenuItemDelta)

Apply a reactive delta to a single already-installed item.

Trait Implementations§

Source§

impl NativeMenuBackend for Box<dyn NativeMenuBackend>

Forward through a boxed backend so NativeMenuHandle::new(default_backend()) type-checks.

Source§

fn set_window_menu( &mut self, window_id: TeksiloWindowId, menu: NativeMenuSnapshot, poster: Arc<dyn AppEventPoster>, )

Build (or replace) the native menu for window_id from menu. For every item the user later chooses, the backend MUST post a NativeMenuEventPayload — with window_id_owner == window_id — through poster. If window_id is (or becomes) the active window, the backend should also make this menu the visible one.
Source§

fn activate_window(&mut self, window_id: TeksiloWindowId)

Make window_id’s previously-set menu the active/visible one (focus follows window). No-op if that window never set a menu.
Source§

fn clear_window(&mut self, window_id: TeksiloWindowId)

Forget window_id’s menu (window closed).
Source§

fn update_item(&mut self, id: MenuItemId, delta: MenuItemDelta)

Apply a reactive delta to a single already-installed item.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl NativeMenuBackend for Box<dyn NativeMenuBackend>

Forward through a boxed backend so NativeMenuHandle::new(default_backend()) type-checks.

Source§

fn set_window_menu( &mut self, window_id: TeksiloWindowId, menu: NativeMenuSnapshot, poster: Arc<dyn AppEventPoster>, )

Source§

fn activate_window(&mut self, window_id: TeksiloWindowId)

Source§

fn clear_window(&mut self, window_id: TeksiloWindowId)

Source§

fn update_item(&mut self, id: MenuItemId, delta: MenuItemDelta)

Implementors§