[][src]Trait gtk::GtkMenuExt

pub trait GtkMenuExt: 'static {
    fn attach<P: IsA<Widget>>(
        &self,
        child: &P,
        left_attach: u32,
        right_attach: u32,
        top_attach: u32,
        bottom_attach: u32
    );
fn detach(&self);
fn get_accel_group(&self) -> Option<AccelGroup>;
fn get_accel_path(&self) -> Option<GString>;
fn get_active(&self) -> Option<Widget>;
fn get_attach_widget(&self) -> Option<Widget>;
fn get_monitor(&self) -> i32;
fn get_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<P: IsA<Window>>(
        &self,
        rect_window: &P,
        rect: &Rectangle,
        rect_anchor: Gravity,
        menu_anchor: Gravity,
        trigger_event: Option<&Event>
    );
fn popup_at_widget<P: IsA<Widget>>(
        &self,
        widget: &P,
        widget_anchor: Gravity,
        menu_anchor: Gravity,
        trigger_event: Option<&Event>
    );
fn reorder_child<P: IsA<Widget>>(&self, child: &P, position: i32);
fn reposition(&self);
fn set_accel_group<P: IsA<AccelGroup>>(&self, accel_group: Option<&P>);
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 get_property_anchor_hints(&self) -> AnchorHints;
fn set_property_anchor_hints(&self, anchor_hints: AnchorHints);
fn set_property_attach_widget<P: IsA<Widget> + SetValueOptional>(
        &self,
        attach_widget: Option<&P>
    );
fn get_property_menu_type_hint(&self) -> WindowTypeHint;
fn set_property_menu_type_hint(&self, menu_type_hint: WindowTypeHint);
fn get_property_rect_anchor_dx(&self) -> i32;
fn set_property_rect_anchor_dx(&self, rect_anchor_dx: i32);
fn get_property_rect_anchor_dy(&self) -> i32;
fn set_property_rect_anchor_dy(&self, rect_anchor_dy: i32);
fn get_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 get_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 get_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 get_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_property_accel_group_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_accel_path_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_active_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_anchor_hints_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_attach_widget_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_menu_type_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_monitor_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_rect_anchor_dx_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_rect_anchor_dy_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_reserve_toggle_size_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Menu methods.

Implementors

Menu, RecentChooserMenu

Required methods

fn attach<P: IsA<Widget>>(
    &self,
    child: &P,
    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 GtkMenuExt::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

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 GtkMenuExt::attach_to_widget function was called.

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

Gets the AccelGroup which holds global accelerators for the menu. See GtkMenuExt::set_accel_group.

Returns

the AccelGroup associated with the menu

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

Retrieves the accelerator path set on the menu.

Returns

the accelerator path set on the menu.

fn get_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.

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

Returns the Widget that the menu is attached to.

Returns

the Widget that the menu is attached to

fn get_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

fn get_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

fn place_on_monitor(&self, monitor: &Monitor)

Places self on the given monitor.

Feature: v3_22

monitor

the monitor to place the menu on

fn popdown(&self)

Removes the menu from the screen.

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 Menu:anchor-hints, Menu:rect-anchor-dx, Menu:rect-anchor-dy, and Menu:menu-type-hint. Connect to the Menu::popped-up signal to find out how it was actually positioned.

Feature: v3_22

trigger_event

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

fn popup_at_rect<P: IsA<Window>>(
    &self,
    rect_window: &P,
    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 Menu:rect-anchor-dx and 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 Menu:anchor-hints and Menu:menu-type-hint. Connect to the Menu::popped-up signal to find out how it was actually positioned.

Feature: v3_22

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

fn popup_at_widget<P: IsA<Widget>>(
    &self,
    widget: &P,
    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 Menu:rect-anchor-dx and 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 Menu:anchor-hints and Menu:menu-type-hint. Connect to the Menu::popped-up signal to find out how it was actually positioned.

Feature: v3_22

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

fn reorder_child<P: IsA<Widget>>(&self, child: &P, 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

fn reposition(&self)

Repositions the menu according to its position function.

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

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.

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

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 GtkMenuExt::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, "<Gnumeric-Sheet>/File"); has been called, assign its items the accel paths: "<Gnumeric-Sheet>/File/New" and "<Gnumeric-Sheet>/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 AccelMap::add_entry.

Note that accel_path string will be stored in a glib::Quark. 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

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

fn set_monitor(&self, monitor_num: i32)

Informs GTK+ on which monitor a menu should be popped up. See gdk::Monitor::get_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

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

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

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

Feature: v3_22

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

Feature: v3_22

fn set_property_attach_widget<P: IsA<Widget> + SetValueOptional>(
    &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 GtkMenuExt::attach_to_widget directly.

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

Feature: v3_22

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

Feature: v3_22

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

Feature: v3_22

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

Feature: v3_22

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

Feature: v3_22

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

Feature: v3_22

fn get_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 get_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 get_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 get_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

scroll_type

a ScrollType

fn emit_move_scroll(&self, scroll_type: ScrollType)

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

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

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

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

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

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

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

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

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

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

Loading content...

Implementors

impl<O: IsA<Menu>> GtkMenuExt for O[src]

Loading content...