pub trait ContextMenu {
// Required methods
fn hpopupmenu(&self) -> isize;
unsafe fn show_context_menu_for_hwnd(
&self,
hwnd: isize,
position: Option<Position>,
) -> bool;
unsafe fn attach_menu_subclass_for_hwnd(&self, hwnd: isize);
unsafe fn detach_menu_subclass_from_hwnd(&self, hwnd: isize);
}
Expand description
A helper trait with methods to help creating a context menu.
Required Methods§
Shows this menu as a context menu inside a win32 window.
position
is relative to the window top-left corner, ifNone
, the cursor position is used.
Returns true
if menu tracking ended because an item was selected, and false
if menu tracking was cancelled for any reason.
§Safety
The hwnd
must be a valid window HWND.
Attach the menu subclass handler to the given hwnd so you can recieve events from that window using MenuEvent::receiver
This can be used along with ContextMenu::hpopupmenu
when implementing a tray icon menu.
§Safety
The hwnd
must be a valid window HWND.
Remove the menu subclass handler from the given hwnd
The view must be a pointer to a valid NSView
.
§Safety
The hwnd
must be a valid window HWND.