pub struct Modal { /* private fields */ }Expand description
A modal dialog widget with title, body, border, and optional dim background.
Renders as a bordered box with a title in the top border and body content
inside. Use Modal::to_overlay_config to create an overlay config for
use with crate::overlay::ScreenStack.
Implementations§
Source§impl Modal
impl Modal
Sourcepub fn new(title: impl Into<String>, width: u16, height: u16) -> Self
pub fn new(title: impl Into<String>, width: u16, height: u16) -> Self
Create a new modal with the given title and dimensions.
Sourcepub fn with_style(self, style: Style) -> Self
pub fn with_style(self, style: Style) -> Self
Set the style for the modal border and text.
Sourcepub fn with_border(self, border: BorderStyle) -> Self
pub fn with_border(self, border: BorderStyle) -> Self
Set the border style.
Sourcepub fn render_to_lines(&self) -> Vec<Vec<Segment>>
pub fn render_to_lines(&self) -> Vec<Vec<Segment>>
Render the modal to lines ready for the compositor.
Produces a bordered box with the title in the top border line and body content inside. Lines are padded to the modal’s width.
Sourcepub fn to_overlay_config(&self) -> OverlayConfig
pub fn to_overlay_config(&self) -> OverlayConfig
Create an overlay config for this modal (centered, with dim background).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Modal
impl RefUnwindSafe for Modal
impl Send for Modal
impl Sync for Modal
impl Unpin for Modal
impl UnwindSafe for Modal
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