pub trait GtkMenuExt: 'static {
Show 50 methods fn attach(
        &self,
        child: &impl IsA<Widget>,
        left_attach: u32,
        right_attach: u32,
        top_attach: u32,
        bottom_attach: u32
    ); fn detach(&self); fn accel_group(&self) -> Option<AccelGroup>; fn accel_path(&self) -> Option<GString>; fn active(&self) -> Option<Widget>; fn attach_widget(&self) -> Option<Widget>; fn monitor(&self) -> i32; fn must_reserve_toggle_size(&self) -> bool; fn place_on_monitor(&self, monitor: &Monitor); fn popdown(&self); fn popup_at_pointer(&self, trigger_event: Option<&Event>); fn popup_at_rect(
        &self,
        rect_window: &Window,
        rect: &Rectangle,
        rect_anchor: Gravity,
        menu_anchor: Gravity,
        trigger_event: Option<&Event>
    ); fn popup_at_widget(
        &self,
        widget: &impl IsA<Widget>,
        widget_anchor: Gravity,
        menu_anchor: Gravity,
        trigger_event: Option<&Event>
    ); fn reorder_child(&self, child: &impl IsA<Widget>, position: i32); fn reposition(&self); fn set_accel_group(&self, accel_group: Option<&impl IsA<AccelGroup>>); fn set_accel_path(&self, accel_path: Option<&str>); fn set_active(&self, index: u32); fn set_monitor(&self, monitor_num: i32); fn set_reserve_toggle_size(&self, reserve_toggle_size: bool); fn set_screen(&self, screen: Option<&Screen>); fn anchor_hints(&self) -> AnchorHints; fn set_anchor_hints(&self, anchor_hints: AnchorHints); fn set_attach_widget<P: IsA<Widget>>(&self, attach_widget: Option<&P>); fn menu_type_hint(&self) -> WindowTypeHint; fn set_menu_type_hint(&self, menu_type_hint: WindowTypeHint); fn rect_anchor_dx(&self) -> i32; fn set_rect_anchor_dx(&self, rect_anchor_dx: i32); fn rect_anchor_dy(&self) -> i32; fn set_rect_anchor_dy(&self, rect_anchor_dy: i32); fn item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32; fn set_item_bottom_attach<T: IsA<MenuItem>>(
        &self,
        item: &T,
        bottom_attach: i32
    ); fn item_left_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32; fn set_item_left_attach<T: IsA<MenuItem>>(&self, item: &T, left_attach: i32); fn item_right_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32; fn set_item_right_attach<T: IsA<MenuItem>>(
        &self,
        item: &T,
        right_attach: i32
    ); fn item_top_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32; fn set_item_top_attach<T: IsA<MenuItem>>(&self, item: &T, top_attach: i32); fn connect_move_scroll<F: Fn(&Self, ScrollType) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn emit_move_scroll(&self, scroll_type: ScrollType); fn connect_accel_group_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_accel_path_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_active_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_anchor_hints_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_attach_widget_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_menu_type_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_monitor_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_rect_anchor_dx_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_rect_anchor_dy_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_reserve_toggle_size_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}
Expand description

Trait containing all Menu methods.

Implementors

Menu, RecentChooserMenu

Required Methods

Adds a new MenuItem to a (table) menu. The number of “cells” that an item will occupy is specified by left_attach, right_attach, top_attach and bottom_attach. These each represent the leftmost, rightmost, uppermost and lower column and row numbers of the table. (Columns and rows are indexed from zero).

Note that this function is not related to detach().

child

a MenuItem

left_attach

The column number to attach the left side of the item to

right_attach

The column number to attach the right side of the item to

top_attach

The row number to attach the top of the item to

bottom_attach

The row number to attach the bottom of the item to

Detaches the menu from the widget to which it had been attached. This function will call the callback function, detacher, provided when the gtk_menu_attach_to_widget() function was called.

Gets the AccelGroup which holds global accelerators for the menu. See set_accel_group().

Returns

the AccelGroup associated with the menu

Retrieves the accelerator path set on the menu.

Returns

the accelerator path set on the menu.

Returns the selected menu item from the menu. This is used by the ComboBox.

Returns

the MenuItem that was last selected in the menu. If a selection has not yet been made, the first menu item is selected.

Returns the Widget that the menu is attached to.

Returns

the Widget that the menu is attached to

Retrieves the number of the monitor on which to show the menu.

Returns

the number of the monitor on which the menu should be popped up or -1, if no monitor has been set

Returns whether the menu reserves space for toggles and icons, regardless of their actual presence.

Returns

Whether the menu reserves toggle space

Available on crate feature v3_22 only.

Places self on the given monitor.

monitor

the monitor to place the menu on

Removes the menu from the screen.

Available on crate feature v3_22 only.

Displays self and makes it available for selection.

See gtk_menu_popup_at_widget () to pop up a menu at a widget. gtk_menu_popup_at_rect () also allows you to position a menu at an arbitrary rectangle.

self will be positioned at the pointer associated with trigger_event.

Properties that influence the behaviour of this function are property::Menu::anchor-hints, property::Menu::rect-anchor-dx, property::Menu::rect-anchor-dy, and property::Menu::menu-type-hint. Connect to the signal::Menu::popped-up signal to find out how it was actually positioned.

trigger_event

the GdkEvent that initiated this request or None if it’s the current event

Available on crate feature v3_22 only.

Displays self and makes it available for selection.

See gtk_menu_popup_at_widget () and gtk_menu_popup_at_pointer (), which handle more common cases for popping up menus.

self will be positioned at rect, aligning their anchor points. rect is relative to the top-left corner of rect_window. rect_anchor and menu_anchor determine anchor points on rect and self to pin together. self can optionally be offset by property::Menu::rect-anchor-dx and property::Menu::rect-anchor-dy.

Anchors should be specified under the assumption that the text direction is left-to-right; they will be flipped horizontally automatically if the text direction is right-to-left.

Other properties that influence the behaviour of this function are property::Menu::anchor-hints and property::Menu::menu-type-hint. Connect to the signal::Menu::popped-up signal to find out how it was actually positioned.

rect_window

the gdk::Window rect is relative to

rect

the gdk::Rectangle to align self with

rect_anchor

the point on rect to align with self’s anchor point

the point on self to align with rect’s anchor point

trigger_event

the GdkEvent that initiated this request or None if it’s the current event

Available on crate feature v3_22 only.

Displays self and makes it available for selection.

See gtk_menu_popup_at_pointer () to pop up a menu at the master pointer. gtk_menu_popup_at_rect () also allows you to position a menu at an arbitrary rectangle.

self will be positioned at widget, aligning their anchor points. widget_anchor and menu_anchor determine anchor points on widget and self to pin together. self can optionally be offset by property::Menu::rect-anchor-dx and property::Menu::rect-anchor-dy.

Anchors should be specified under the assumption that the text direction is left-to-right; they will be flipped horizontally automatically if the text direction is right-to-left.

Other properties that influence the behaviour of this function are property::Menu::anchor-hints and property::Menu::menu-type-hint. Connect to the signal::Menu::popped-up signal to find out how it was actually positioned.

widget

the Widget to align self with

widget_anchor

the point on widget to align with self’s anchor point

the point on self to align with widget’s anchor point

trigger_event

the GdkEvent that initiated this request or None if it’s the current event

Moves child to a new position in the list of self children.

child

the MenuItem to move

position

the new position to place child. Positions are numbered from 0 to n - 1

Repositions the menu according to its position function.

Set the AccelGroup which holds global accelerators for the menu. This accelerator group needs to also be added to all windows that this menu is being used in with GtkWindowExt::add_accel_group(), in order for those windows to support all the accelerators contained in this group.

accel_group

the AccelGroup to be associated with the menu.

Sets an accelerator path for this menu from which accelerator paths for its immediate children, its menu items, can be constructed. The main purpose of this function is to spare the programmer the inconvenience of having to call GtkMenuItemExt::set_accel_path() on each menu item that should support runtime user changable accelerators. Instead, by just calling set_accel_path() on their parent, each menu item of this menu, that contains a label describing its purpose, automatically gets an accel path assigned.

For example, a menu containing menu items “New” and “Exit”, will, after gtk_menu_set_accel_path (menu, "/File"); has been called, assign its items the accel paths: "/File/New" and "/File/Exit".

Assigning accel paths to menu items then enables the user to change their accelerators at runtime. More details about accelerator paths and their default setups can be found at gtk_accel_map_add_entry().

Note that accel_path string will be stored in a GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string().

accel_path

a valid accelerator path, or None to unset the path

Selects the specified menu item within the menu. This is used by the ComboBox and should not be used by anyone else.

index

the index of the menu item to select. Index values are from 0 to n-1

Informs GTK+ on which monitor a menu should be popped up. See Monitor::geometry().

This function should be called from a GtkMenuPositionFunc if the menu should not appear on the same monitor as the pointer. This information can’t be reliably inferred from the coordinates returned by a GtkMenuPositionFunc, since, for very long menus, these coordinates may extend beyond the monitor boundaries or even the screen boundaries.

monitor_num

the number of the monitor on which the menu should be popped up

Sets whether the menu should reserve space for drawing toggles or icons, regardless of their actual presence.

reserve_toggle_size

whether to reserve size for toggles

Sets the gdk::Screen on which the menu will be displayed.

screen

a gdk::Screen, or None if the screen should be determined by the widget the menu is attached to

Available on crate feature v3_22 only.

Positioning hints for aligning the menu relative to a rectangle.

These hints determine how the menu should be positioned in the case that the menu would fall off-screen if placed in its ideal position.

For example, gdk::AnchorHints::FLIP_Y will replace gdk::Gravity::NorthWest with gdk::Gravity::SouthWest and vice versa if the menu extends beyond the bottom edge of the monitor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), property::Menu::rect-anchor-dx, property::Menu::rect-anchor-dy, property::Menu::menu-type-hint, and signal::Menu::popped-up.

Available on crate feature v3_22 only.

Positioning hints for aligning the menu relative to a rectangle.

These hints determine how the menu should be positioned in the case that the menu would fall off-screen if placed in its ideal position.

For example, gdk::AnchorHints::FLIP_Y will replace gdk::Gravity::NorthWest with gdk::Gravity::SouthWest and vice versa if the menu extends beyond the bottom edge of the monitor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), property::Menu::rect-anchor-dx, property::Menu::rect-anchor-dy, property::Menu::menu-type-hint, and signal::Menu::popped-up.

The widget the menu is attached to. Setting this property attaches the menu without a GtkMenuDetachFunc. If you need to use a detacher, use gtk_menu_attach_to_widget() directly.

Available on crate feature v3_22 only.

The gdk::WindowTypeHint to use for the menu’s gdk::Window.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), property::Menu::anchor-hints, property::Menu::rect-anchor-dx, property::Menu::rect-anchor-dy, and signal::Menu::popped-up.

Available on crate feature v3_22 only.

The gdk::WindowTypeHint to use for the menu’s gdk::Window.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), property::Menu::anchor-hints, property::Menu::rect-anchor-dx, property::Menu::rect-anchor-dy, and signal::Menu::popped-up.

Available on crate feature v3_22 only.

Horizontal offset to apply to the menu, i.e. the rectangle or widget anchor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), property::Menu::anchor-hints, property::Menu::rect-anchor-dy, property::Menu::menu-type-hint, and signal::Menu::popped-up.

Available on crate feature v3_22 only.

Horizontal offset to apply to the menu, i.e. the rectangle or widget anchor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), property::Menu::anchor-hints, property::Menu::rect-anchor-dy, property::Menu::menu-type-hint, and signal::Menu::popped-up.

Available on crate feature v3_22 only.

Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), property::Menu::anchor-hints, property::Menu::rect-anchor-dx, property::Menu::menu-type-hint, and signal::Menu::popped-up.

Available on crate feature v3_22 only.

Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), property::Menu::anchor-hints, property::Menu::rect-anchor-dx, property::Menu::menu-type-hint, and signal::Menu::popped-up.

Available on crate feature v3_22 only.
Available on crate feature v3_22 only.
Available on crate feature v3_22 only.
Available on crate feature v3_22 only.

Implementors