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;
// Provided methods
fn as_menu(&self) -> Option<&Menu> { ... }
fn as_menu_unchecked(&self) -> &Menu { ... }
fn as_submenu(&self) -> Option<&Submenu> { ... }
fn as_submenu_unchecked(&self) -> &Menu { ... }
}
Expand description
A helper trait with methods to help creating a context menu.
Required Methods§
Shows this menu as a context menu inside a gtk::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 or clicked outside the menu to dismiss it.
Returns false
if menu tracking was cancelled for any reason.
Get the underlying gtk menu reserved for context menus.
The returned gtk::Menu
is valid as long as the ContextMenu
is.
Provided Methods§
Cast this context menu to a Menu
, and returns None
if it wasn’t.
Casts this context menu to a Menu
, and panics if it wasn’t.
Cast this context menu to a Submenu
, and returns None
if it wasn’t.
Casts this context menu to a Submenu
, and panics if it wasn’t.