pub struct ContextMenuStyle {
pub popup: SelectStyle,
pub shortcut_text: TextStyle,
pub separator: Color,
pub row_height: f32,
pub separator_height: f32,
pub width: f32,
pub submenu_width: f32,
pub submenu_gap: f32,
pub icon_size: f32,
pub icon_gap: f32,
pub padding_x: f32,
pub disabled_opacity: f32,
}Expand description
Resolved colors, typography, and logical-pixel geometry for context menus.
Menus are clipped to popup.popup_max_height; this control does not add a
scrollbar, so callers should keep the complete entry stack within that cap.
Custom non-positive or non-finite geometry is not normalized.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::ContextMenuStyle;
let style = ContextMenuStyle::from_theme(Theme::dark());
assert_eq!((style.width, style.row_height), (252.0, 28.0));
assert_eq!(style.popup.popup_max_height, 420.0);Fields§
§popup: SelectStyleShared popup shell, active-row, item-text, and height-cap style.
shortcut_text: TextStyleRight-aligned shortcut hint typography.
separator: ColorOne-pixel separator-line color.
row_height: f32Item row height in logical pixels.
separator_height: f32Vertical space reserved for a separator in logical pixels.
width: f32Root menu width in logical pixels.
First-level submenu width in logical pixels.
Horizontal distance between root menu and submenu in logical pixels.
icon_size: f32Leading and submenu-chevron icon size in logical pixels.
icon_gap: f32Gap after icons and around shortcut/chevron regions in logical pixels.
padding_x: f32Horizontal content inset in logical pixels.
disabled_opacity: f32Alpha multiplier applied to disabled item visuals.
Implementations§
Source§impl ContextMenuStyle
impl ContextMenuStyle
Sourcepub fn from_theme(theme: Theme) -> Self
pub fn from_theme(theme: Theme) -> Self
Resolves compact menu styling from a theme.
The root defaults to 252 logical pixels wide, submenus to 228, item rows to 28, and the clipped height cap to 420.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::ContextMenuStyle;
let style = ContextMenuStyle::from_theme(Theme::default());
assert_eq!((style.submenu_width, style.submenu_gap), (228.0, 4.0));
assert_eq!((style.icon_size, style.padding_x), (14.0, 10.0));Trait Implementations§
Source§impl Clone for ContextMenuStyle
impl Clone for ContextMenuStyle
Source§fn clone(&self) -> ContextMenuStyle
fn clone(&self) -> ContextMenuStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContextMenuStyle
impl Debug for ContextMenuStyle
Source§impl Default for ContextMenuStyle
impl Default for ContextMenuStyle
Source§impl PartialEq for ContextMenuStyle
impl PartialEq for ContextMenuStyle
impl StructuralPartialEq for ContextMenuStyle
Auto Trait Implementations§
impl Freeze for ContextMenuStyle
impl RefUnwindSafe for ContextMenuStyle
impl Send for ContextMenuStyle
impl Sync for ContextMenuStyle
impl Unpin for ContextMenuStyle
impl UnwindSafe for ContextMenuStyle
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.