pub struct SubmenuBuilder<'a> { /* private fields */ }Expand description
Builder for creating dropdown submenus with consistent styling.
This builder provides a fluent API for constructing submenus with icons,
text items, separators, and toggles. show draws the rows into the Ui it
was created with; the drawing toolbar calls it inside its flyout.
Implementations§
Sourcepub fn with_width(self, width: f32) -> Self
pub fn with_width(self, width: f32) -> Self
Set the minimum submenu width; a longer row widens it.
Sourcepub fn add_icon_item(
self,
icon: &'static Icon,
label: impl Into<String>,
tooltip: impl Into<String>,
) -> Self
pub fn add_icon_item( self, icon: &'static Icon, label: impl Into<String>, tooltip: impl Into<String>, ) -> Self
Add an item with icon, label, and tooltip
Sourcepub fn add_text_item(
self,
label: impl Into<String>,
tooltip: impl Into<String>,
) -> Self
pub fn add_text_item( self, label: impl Into<String>, tooltip: impl Into<String>, ) -> Self
Add a text-only item (no icon)
Sourcepub fn add_text_item_with_action<F>(
self,
label: impl Into<String>,
tooltip: impl Into<String>,
action: F,
) -> Self
pub fn add_text_item_with_action<F>( self, label: impl Into<String>, tooltip: impl Into<String>, action: F, ) -> Self
Add a text-only item with an action callback
Sourcepub fn checked(self, checked: bool) -> Self
pub fn checked(self, checked: bool) -> Self
Show a check mark on the item added last when checked.
Sourcepub fn danger(self, icon: &'static Icon) -> Self
pub fn danger(self, icon: &'static Icon) -> Self
Draw the item added last with icon, in the error colour.
Sourcepub fn add_toggle(self, config: ToggleConfig<'a>) -> Self
pub fn add_toggle(self, config: ToggleConfig<'a>) -> Self
Add a toggle checkbox at the bottom of the submenu
Sourcepub fn show(self) -> Option<DrawingToolbarAction>
pub fn show(self) -> Option<DrawingToolbarAction>
Draw the rows and return the action of the one clicked
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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