pub struct Dialog { /* private fields */ }Expand description
A dialog widget built on Modal.
Invariants:
- At least one button is always present.
- Button focus wraps around (modular arithmetic).
- For Prompt dialogs, Tab cycles: input -> buttons -> input.
Failure modes:
- If area is too small, content may be truncated but dialog never panics.
- Empty title/message is allowed (renders nothing for that row).
Implementations§
Source§impl Dialog
impl Dialog
Sourcepub fn alert(title: impl Into<String>, message: impl Into<String>) -> Self
pub fn alert(title: impl Into<String>, message: impl Into<String>) -> Self
Create an alert dialog (message + OK).
Sourcepub fn confirm(title: impl Into<String>, message: impl Into<String>) -> Self
pub fn confirm(title: impl Into<String>, message: impl Into<String>) -> Self
Create a confirm dialog (message + OK/Cancel).
Sourcepub fn prompt(title: impl Into<String>, message: impl Into<String>) -> Self
pub fn prompt(title: impl Into<String>, message: impl Into<String>) -> Self
Create a prompt dialog (message + input + OK/Cancel).
Sourcepub fn custom(
title: impl Into<String>,
message: impl Into<String>,
) -> DialogBuilder
pub fn custom( title: impl Into<String>, message: impl Into<String>, ) -> DialogBuilder
Create a custom dialog with a builder.
Sourcepub fn modal_config(self, config: ModalConfig) -> Self
pub fn modal_config(self, config: ModalConfig) -> Self
Set the modal configuration.
Set button style.
Set primary button style.
Set focused button style.
Sourcepub fn handle_event(
&self,
event: &Event,
state: &mut DialogState,
hit: Option<(HitId, HitRegion, HitData)>,
) -> Option<DialogResult>
pub fn handle_event( &self, event: &Event, state: &mut DialogState, hit: Option<(HitId, HitRegion, HitData)>, ) -> Option<DialogResult>
Handle an event and potentially update state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dialog
impl RefUnwindSafe for Dialog
impl Send for Dialog
impl Sync for Dialog
impl Unpin for Dialog
impl UnwindSafe for Dialog
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