pub struct MessageBox<'a, C: PixelColor, M: Clone> { /* private fields */ }Expand description
A modal dialog over a dimmed scrim. The host owns visibility; the card holds a title, body, and a row of action buttons, each emitting a host-supplied message.
Implementations§
Source§impl<'a, C: PixelColor + 'a, M: Clone + 'a> MessageBox<'a, C, M>
impl<'a, C: PixelColor + 'a, M: Clone + 'a> MessageBox<'a, C, M>
Sourcepub fn new() -> Self
pub fn new() -> Self
New empty modal. Fills its parent region (the scrim covers the
screen). Configure with the builders, then it composes itself into a
Stack.
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
The card title (drawn in the heading font).
Append an action button. Repeatable — buttons are laid out left-to-right in a row at the bottom of the card. The given message is emitted when that button is tapped.
Sourcepub fn on_dismiss(self, message: M) -> Self
pub fn on_dismiss(self, message: M) -> Self
Message emitted when the scrim (the area outside the card) is tapped. Without it, taps outside the card are swallowed but emit nothing (the modal stays open until a button is pressed).
Sourcepub fn width(self, width: impl Into<Length>) -> Self
pub fn width(self, width: impl Into<Length>) -> Self
Width sizing intent of the whole modal region (default
Length::Fill).
Sourcepub fn height(self, height: impl Into<Length>) -> Self
pub fn height(self, height: impl Into<Length>) -> Self
Height sizing intent of the whole modal region (default
Length::Fill).
Trait Implementations§
Source§impl<'a, C: PixelColor + 'a, M: Clone + 'a> Default for MessageBox<'a, C, M>
impl<'a, C: PixelColor + 'a, M: Clone + 'a> Default for MessageBox<'a, C, M>
Source§impl<'a, C: PixelColor + 'a, M: Clone + 'a> Widget<C, M> for MessageBox<'a, C, M>
impl<'a, C: PixelColor + 'a, M: Clone + 'a> Widget<C, M> for MessageBox<'a, C, M>
Source§fn measure(&mut self, constraints: Constraints) -> Size
fn measure(&mut self, constraints: Constraints) -> Size
constraints.Source§fn preferred_size(&self) -> (Length, Length)
fn preferred_size(&self) -> (Length, Length)
.width(...) / .height(...).
Containers consult this during layout to allocate fixed slots,
query intrinsic sizes, and split residual space among
Fill / FillPortion children. Default is Length::Fill on
both axes.Source§fn arrange(&mut self, rect: Rectangle)
fn arrange(&mut self, rect: Rectangle)
Source§fn handle_touch(&mut self, point: Point, phase: TouchPhase) -> Option<M>
fn handle_touch(&mut self, point: Point, phase: TouchPhase) -> Option<M>
Source§fn mark_pressed(&mut self, point: Point)
fn mark_pressed(&mut self, point: Point)
point hits. No message emit.
Containers forward to children. Default no-op.Source§fn draw<'t>(
&self,
renderer: &mut dyn Renderer<C>,
theme: &Theme<'t, C>,
) -> Result<(), RenderError>
fn draw<'t>( &self, renderer: &mut dyn Renderer<C>, theme: &Theme<'t, C>, ) -> Result<(), RenderError>
renderer at rect.Source§fn widget_id(&self) -> Option<WidgetId>
fn widget_id(&self) -> Option<WidgetId>
Source§fn is_focusable(&self) -> bool
fn is_focusable(&self) -> bool
Source§fn collect_focusable(&self, out: &mut Vec<WidgetId>)
fn collect_focusable(&self, out: &mut Vec<WidgetId>)
Source§fn sync_focus(&mut self, focused: Option<WidgetId>)
fn sync_focus(&mut self, focused: Option<WidgetId>)
Source§fn handle_action(&mut self, action: UiAction) -> Option<M>
fn handle_action(&mut self, action: UiAction) -> Option<M>
Source§fn route_action(&mut self, target: WidgetId, action: UiAction) -> Option<M>
fn route_action(&mut self, target: WidgetId, action: UiAction) -> Option<M>
target.target for directional actions.Auto Trait Implementations§
impl<'a, C, M> Freeze for MessageBox<'a, C, M>where
M: Freeze,
impl<'a, C, M> !RefUnwindSafe for MessageBox<'a, C, M>
impl<'a, C, M> !Send for MessageBox<'a, C, M>
impl<'a, C, M> !Sync for MessageBox<'a, C, M>
impl<'a, C, M> Unpin for MessageBox<'a, C, M>where
M: Unpin,
impl<'a, C, M> UnsafeUnpin for MessageBox<'a, C, M>where
M: UnsafeUnpin,
impl<'a, C, M> !UnwindSafe for MessageBox<'a, C, M>
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<'a, C, M, W> IntoElement<'a, C, M> for W
impl<'a, C, M, W> IntoElement<'a, C, M> for W
Source§fn into_element(self) -> Element<'a, C, M>
fn into_element(self) -> Element<'a, C, M>
self.