pub trait ContextMenuExt: 'static {
Show 13 methods fn append(&self, item: &impl IsA<ContextMenuItem>); fn first(&self) -> Option<ContextMenuItem>; fn item_at_position(&self, position: u32) -> Option<ContextMenuItem>; fn items(&self) -> Vec<ContextMenuItem>; fn n_items(&self) -> u32; fn user_data(&self) -> Option<Variant>; fn insert(&self, item: &impl IsA<ContextMenuItem>, position: i32); fn last(&self) -> Option<ContextMenuItem>; fn move_item(&self, item: &impl IsA<ContextMenuItem>, position: i32); fn prepend(&self, item: &impl IsA<ContextMenuItem>); fn remove(&self, item: &impl IsA<ContextMenuItem>); fn remove_all(&self); fn set_user_data(&self, user_data: &Variant);
}
Expand description

Trait containing all ContextMenu methods.

Implementors

ContextMenu

Required Methods

Adds item at the end of the self.

item

the ContextMenuItem to add

Gets the first item in the self.

Returns

the first ContextMenuItem of self, or None if the ContextMenu is empty.

Gets the item at the given position in the self.

position

the position of the item, counting from 0

Returns

the ContextMenuItem at position position in self, or None if the position is off the end of the self.

Returns the item list of self.

Returns

a GList of ContextMenuItems

Gets the length of the self.

Returns

the number of ContextMenuItems in self

Available on crate feature v2_8 only.

Gets the user data of self.

This function can be used from the UI Process to get user data previously set from the Web Process with set_user_data().

Returns

the user data of self, or None if self doesn’t have user data

Inserts item into the self at the given position.

If position is negative, or is larger than the number of items in the ContextMenu, the item is added on to the end of the self. The first position is 0.

item

the ContextMenuItem to add

position

the position to insert the item

Gets the last item in the self.

Returns

the last ContextMenuItem of self, or None if the ContextMenu is empty.

Moves item to the given position in the self.

If position is negative, or is larger than the number of items in the ContextMenu, the item is added on to the end of the self. The first position is 0.

item

the ContextMenuItem to add

position

the new position to move the item

Adds item at the beginning of the self.

item

the ContextMenuItem to add

Removes item from the self.

See also remove_all() to remove all items.

item

the ContextMenuItem to remove

Removes all items of the self.

Available on crate feature v2_8 only.

Sets user data to self.

This function can be used from a Web Process extension to set user data that can be retrieved from the UI Process using user_data(). If the user_data glib::Variant is floating, it is consumed.

Implementors