pub struct ContextMenu {
pub items: Vec<ContextMenuEntry>,
pub width: Option<f32>,
pub min_width: f32,
pub max_width: Option<f32>,
pub padding: [f32; 4],
pub gap: f32,
pub border_radius: f32,
pub background: Option<Color>,
pub border_color: Option<Color>,
pub border_width: f32,
pub shadow: Option<BoxShadow>,
}Expand description
A popup menu shown for a secondary click or other contextual activation.
Menu items accept arbitrary child widgets, so applications can provide plain translated text, icons, shortcuts, badges, or richer branded rows without hard-coding menu strings in the framework.
Fields§
§items: Vec<ContextMenuEntry>Entries rendered in order from top to bottom.
width: Option<f32>Fixed popup width. When omitted, ContextMenu::min_width is used.
min_width: f32Minimum popup width used by the default layout.
max_width: Option<f32>Maximum popup width before child content wraps or clips according to its own layout.
padding: [f32; 4]Popup interior padding [left, right, top, bottom].
gap: f32Gap between menu rows.
border_radius: f32Popup corner radius.
background: Option<Color>Optional popup background colour. Defaults to the framework surface colour.
border_color: Option<Color>Optional border colour. Defaults to a subtle neutral border.
border_width: f32Border width in logical pixels.
shadow: Option<BoxShadow>Optional popup shadow.
Implementations§
Source§impl ContextMenu
impl ContextMenu
pub fn with_items(items: impl IntoIterator<Item = ContextMenuEntry>) -> Self
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 moreSource§impl Debug for ContextMenu
impl Debug for ContextMenu
Source§impl Default for ContextMenu
impl Default for ContextMenu
Source§impl<'de> Deserialize<'de> for ContextMenu
impl<'de> Deserialize<'de> for ContextMenu
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !RefUnwindSafe for ContextMenu
impl !UnwindSafe for ContextMenu
impl Freeze for ContextMenu
impl Send for ContextMenu
impl Sync for ContextMenu
impl Unpin for ContextMenu
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.