Trait ContextMenu

Source
pub trait ContextMenu {
    // Required methods
    fn show_context_menu_for_gtk_window(
        &self,
        w: &Window,
        position: Option<Position>,
    ) -> bool;
    fn gtk_context_menu(&self) -> Menu;
}
Expand description

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

Required Methods§

Source

fn show_context_menu_for_gtk_window( &self, w: &Window, position: Option<Position>, ) -> bool

Shows this menu as a context menu inside a gtk::Window

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

Returns true if menu tracking ended because an item was selected or clicked outside the menu to dismiss it.

Returns false if menu tracking was cancelled for any reason.

Source

fn gtk_context_menu(&self) -> Menu

Get the underlying gtk menu reserved for context menus.

The returned gtk::Menu is valid as long as the ContextMenu is.

Implementors§