tray_icon::menu

Trait ContextMenu

Source
pub trait ContextMenu {
    // Required methods
    unsafe fn show_context_menu_for_nsview(
        &self,
        view: *const c_void,
        position: Option<Position>,
    );
    fn ns_menu(&self) -> *mut c_void;
}
Expand description

A helper trait with methods to help creating a context menu.

Required Methods§

Source

unsafe fn show_context_menu_for_nsview( &self, view: *const c_void, position: Option<Position>, )

Shows this menu as a context menu for the specified NSView.

  • position is relative to the window top-left corner, if None, the cursor position is used.
§Safety

The view must be a pointer to a valid NSView.

Source

fn ns_menu(&self) -> *mut c_void

Get the underlying NSMenu reserved for context menus.

The returned pointer is valid for as long as the ContextMenu is. If you need it to be alive for longer, retain it.

Implementors§