Skip to main content

GtkMenuExt

Trait GtkMenuExt 

Source
pub trait GtkMenuExt: IsA<Menu> + 'static {
Show 50 methods // Provided 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

Provided Methods§

Source

fn attach( &self, child: &impl IsA<Widget>, left_attach: u32, right_attach: u32, top_attach: u32, bottom_attach: u32, )

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

Source

fn detach(&self)

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.

Source

fn accel_group(&self) -> Option<AccelGroup>

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

§Returns

the AccelGroup associated with the menu

Source

fn accel_path(&self) -> Option<GString>

Retrieves the accelerator path set on the menu.

§Returns

the accelerator path set on the menu.

Source

fn active(&self) -> Option<Widget>

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.

Source

fn attach_widget(&self) -> Option<Widget>

Returns the Widget that the menu is attached to.

§Returns

the Widget that the menu is attached to

Source

fn monitor(&self) -> i32

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

Source

fn must_reserve_toggle_size(&self) -> bool

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

§Returns

Whether the menu reserves toggle space

Source

fn place_on_monitor(&self, monitor: &Monitor)

Places self on the given monitor.

§monitor

the monitor to place the menu on

Source

fn popdown(&self)

Removes the menu from the screen.

Source

fn popup_at_pointer(&self, trigger_event: Option<&Event>)

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 anchor-hints, rect-anchor-dx, rect-anchor-dy, and menu-type-hint. Connect to the 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

Source

fn popup_at_rect( &self, rect_window: &Window, rect: &Rectangle, rect_anchor: Gravity, menu_anchor: Gravity, trigger_event: Option<&Event>, )

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 rect-anchor-dx and 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 anchor-hints and menu-type-hint. Connect to the 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

Source

fn popup_at_widget( &self, widget: &impl IsA<Widget>, widget_anchor: Gravity, menu_anchor: Gravity, trigger_event: Option<&Event>, )

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 rect-anchor-dx and 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 anchor-hints and menu-type-hint. Connect to the 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

Source

fn reorder_child(&self, child: &impl IsA<Widget>, position: i32)

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

Source

fn reposition(&self)

Repositions the menu according to its position function.

Source

fn set_accel_group(&self, accel_group: Option<&impl IsA<AccelGroup>>)

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.

Source

fn set_accel_path(&self, accel_path: Option<&str>)

/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

Source

fn set_active(&self, index: u32)

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

Source

fn set_monitor(&self, monitor_num: i32)

Informs GTK+ on which monitor a menu should be popped up. See [Monitor::geometry()][crate::gdk::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

Source

fn set_reserve_toggle_size(&self, reserve_toggle_size: bool)

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

Source

fn set_screen(&self, screen: Option<&Screen>)

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

Source

fn anchor_hints(&self) -> AnchorHints

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 (), rect-anchor-dx, rect-anchor-dy, menu-type-hint, and popped-up.

Source

fn set_anchor_hints(&self, anchor_hints: AnchorHints)

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 (), rect-anchor-dx, rect-anchor-dy, menu-type-hint, and popped-up.

Source

fn set_attach_widget<P: IsA<Widget>>(&self, attach_widget: Option<&P>)

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.

Source

fn menu_type_hint(&self) -> WindowTypeHint

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 (), anchor-hints, rect-anchor-dx, rect-anchor-dy, and popped-up.

Source

fn set_menu_type_hint(&self, menu_type_hint: WindowTypeHint)

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 (), anchor-hints, rect-anchor-dx, rect-anchor-dy, and popped-up.

Source

fn rect_anchor_dx(&self) -> i32

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 (), anchor-hints, rect-anchor-dy, menu-type-hint, and popped-up.

Source

fn set_rect_anchor_dx(&self, rect_anchor_dx: i32)

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 (), anchor-hints, rect-anchor-dy, menu-type-hint, and popped-up.

Source

fn rect_anchor_dy(&self) -> i32

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 (), anchor-hints, rect-anchor-dx, menu-type-hint, and popped-up.

Source

fn set_rect_anchor_dy(&self, rect_anchor_dy: i32)

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 (), anchor-hints, rect-anchor-dx, menu-type-hint, and popped-up.

Source

fn item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32

Source

fn set_item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T, bottom_attach: i32)

Source

fn item_left_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32

Source

fn set_item_left_attach<T: IsA<MenuItem>>(&self, item: &T, left_attach: i32)

Source

fn item_right_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32

Source

fn set_item_right_attach<T: IsA<MenuItem>>(&self, item: &T, right_attach: i32)

Source

fn item_top_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32

Source

fn set_item_top_attach<T: IsA<MenuItem>>(&self, item: &T, top_attach: i32)

Source

fn connect_move_scroll<F: Fn(&Self, ScrollType) + 'static>( &self, f: F, ) -> SignalHandlerId

§scroll_type

a ScrollType

Source

fn emit_move_scroll(&self, scroll_type: ScrollType)

Source

fn connect_accel_group_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_accel_path_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_anchor_hints_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_attach_widget_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_menu_type_hint_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_monitor_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_rect_anchor_dx_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_rect_anchor_dy_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_reserve_toggle_size_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<O: IsA<Menu>> GtkMenuExt for O