pub trait MenuItemStyle: 'static {
// Required method
fn make_body(
&self,
cfg: &MenuItemStyleConfig,
ctx: &mut BuildContext<'_>,
) -> WidgetId;
// Provided method
fn highlighted_label_role(&self) -> Option<TextRole> { ... }
}Required Methods§
fn make_body( &self, cfg: &MenuItemStyleConfig, ctx: &mut BuildContext<'_>, ) -> WidgetId
Provided Methods§
Sourcefn highlighted_label_role(&self) -> Option<TextRole>
fn highlighted_label_role(&self) -> Option<TextRole>
The text role a menu row’s label and shortcut take while the row is
highlighted — hovered, or reached by keyboard navigation.
None (the default) keeps the row’s own mapping.
The row builds its label before a style ever sees it, so a style
that fills the highlight with a saturated colour cannot recolour
the text on top of it. macOS fills a highlighted menu row with the
accent and flips its label to selectedMenuItemTextColor (white),
so its style returns TextRole::OnAccent; IntUI and Fluent both
use a neutral wash and leave this None.
Same shape as
ButtonStyle::label_text_role,
and defaulted for the same reason: an existing style needs no
change.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".