pub struct ContextMenu {
pub col: usize,
pub anchor: Point<Pixels>,
pub items: Vec<MenuItem>,
pub hovered: Option<usize>,
pub request: Option<ContextMenuRequest>,
}Fields§
§col: usize§anchor: Point<Pixels>§items: Vec<MenuItem>§hovered: Option<usize>§request: Option<ContextMenuRequest>Implementations§
Source§impl ContextMenu
impl ContextMenu
Sourcepub fn standard(col: usize, anchor: Point<Pixels>) -> Self
pub fn standard(col: usize, anchor: Point<Pixels>) -> Self
Standard column-header menu. Constructed by state when the user right-clicks a column header or sort button.
Sourcepub fn custom(
col: usize,
anchor: Point<Pixels>,
items: Vec<MenuItem>,
request: ContextMenuRequest,
) -> Self
pub fn custom( col: usize, anchor: Point<Pixels>, items: Vec<MenuItem>, request: ContextMenuRequest, ) -> Self
Construct a custom menu from provider-supplied items plus the
captured request snapshot. col is used for built-in action
dispatch when the provider composes BuiltIn items.
Sourcepub fn width_for(&self, char_width: f32) -> f32
pub fn width_for(&self, char_width: f32) -> f32
Width needed to fit the longest label, with padding, bounded below by
MENU_MIN_WIDTH.
Sourcepub fn total_height(&self) -> f32
pub fn total_height(&self) -> f32
Total height including inner padding.
Sourcepub fn resolved_position(
&self,
grid_ox: f32,
grid_oy: f32,
vw: f32,
vh: f32,
char_width: f32,
) -> Point<Pixels>
pub fn resolved_position( &self, grid_ox: f32, grid_oy: f32, vw: f32, vh: f32, char_width: f32, ) -> Point<Pixels>
Resolve the menu’s final top-left corner in grid-relative space,
given the grid origin in window space (grid_ox, grid_oy) and the
window viewport size (vw, vh).
The menu must never be clipped by the grid area — only the window edge constrains it. Vertically it always opens downward from the anchor unless the full menu would not fit below the anchor within the window, in which case it flips to open upward (anchored so its bottom sits at the anchor). Horizontally it shifts left to stay on-screen.
Returned in grid-relative coordinates so it composes directly with
hover_at and the widget’s grid-relative pointer math. Paint adds the
grid origin back to reach absolute window space.
Trait Implementations§
Source§impl Clone for ContextMenu
impl Clone for ContextMenu
Source§fn clone(&self) -> ContextMenu
fn clone(&self) -> ContextMenu
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ContextMenu
impl RefUnwindSafe for ContextMenu
impl Send for ContextMenu
impl Sync for ContextMenu
impl Unpin for ContextMenu
impl UnsafeUnpin for ContextMenu
impl UnwindSafe for ContextMenu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more