Trait webkit2gtk::prelude::ContextMenuExt
source · [−]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
Required Methods
sourcefn append(&self, item: &impl IsA<ContextMenuItem>)
fn append(&self, item: &impl IsA<ContextMenuItem>)
sourcefn first(&self) -> Option<ContextMenuItem>
fn first(&self) -> Option<ContextMenuItem>
Gets the first item in the self
.
Returns
the first ContextMenuItem
of self
,
or None
if the ContextMenu
is empty.
sourcefn item_at_position(&self, position: u32) -> Option<ContextMenuItem>
fn item_at_position(&self, position: u32) -> Option<ContextMenuItem>
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
.
sourcefn items(&self) -> Vec<ContextMenuItem>
fn items(&self) -> Vec<ContextMenuItem>
sourcefn user_data(&self) -> Option<Variant>
fn user_data(&self) -> Option<Variant>
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
sourcefn insert(&self, item: &impl IsA<ContextMenuItem>, position: i32)
fn insert(&self, item: &impl IsA<ContextMenuItem>, position: i32)
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
sourcefn last(&self) -> Option<ContextMenuItem>
fn last(&self) -> Option<ContextMenuItem>
Gets the last item in the self
.
Returns
the last ContextMenuItem
of self
,
or None
if the ContextMenu
is empty.
sourcefn move_item(&self, item: &impl IsA<ContextMenuItem>, position: i32)
fn move_item(&self, item: &impl IsA<ContextMenuItem>, position: i32)
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
sourcefn prepend(&self, item: &impl IsA<ContextMenuItem>)
fn prepend(&self, item: &impl IsA<ContextMenuItem>)
sourcefn remove(&self, item: &impl IsA<ContextMenuItem>)
fn remove(&self, item: &impl IsA<ContextMenuItem>)
Removes item
from the self
.
See also remove_all()
to remove all items.
item
the ContextMenuItem
to remove
sourcefn remove_all(&self)
fn remove_all(&self)
Removes all items of the self
.
sourcefn set_user_data(&self, user_data: &Variant)
fn set_user_data(&self, user_data: &Variant)
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.