pub struct DialogWidget {
pub dialog_type: DialogType,
pub title: String,
pub message: String,
pub input: String,
pub cursor: usize,
pub result: DialogResult,
pub validator: Option<fn(&str) -> bool>,
pub error_message: Option<String>,
pub confirmed: Option<bool>,
}Expand description
Dialog widget
Fields§
§dialog_type: DialogTypeDialog type
title: StringDialog title
message: StringDialog message
input: StringInput value (for input dialogs)
cursor: usizeCursor position
result: DialogResultDialog result
validator: Option<fn(&str) -> bool>Validation function (for input dialogs)
error_message: Option<String>Error message (if validation fails)
confirmed: Option<bool>Confirmation state (for confirm dialogs)
Implementations§
Source§impl DialogWidget
impl DialogWidget
Sourcepub fn new(
dialog_type: DialogType,
title: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn new( dialog_type: DialogType, title: impl Into<String>, message: impl Into<String>, ) -> Self
Create a new dialog widget
Sourcepub fn with_validator(self, validator: fn(&str) -> bool) -> Self
pub fn with_validator(self, validator: fn(&str) -> bool) -> Self
Set a validator function
Sourcepub fn insert_char(&mut self, ch: char)
pub fn insert_char(&mut self, ch: char)
Insert character
Sourcepub fn cursor_left(&mut self)
pub fn cursor_left(&mut self)
Move cursor left
Sourcepub fn cursor_right(&mut self)
pub fn cursor_right(&mut self)
Move cursor right
Sourcepub fn cursor_start(&mut self)
pub fn cursor_start(&mut self)
Move cursor to start
Sourcepub fn cursor_end(&mut self)
pub fn cursor_end(&mut self)
Move cursor to end
Sourcepub fn is_confirmed(&self) -> bool
pub fn is_confirmed(&self) -> bool
Check if dialog is confirmed
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Check if dialog is cancelled
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Check if dialog is pending
Sourcepub fn clear_input(&mut self)
pub fn clear_input(&mut self)
Clear input
Auto Trait Implementations§
impl Freeze for DialogWidget
impl RefUnwindSafe for DialogWidget
impl Send for DialogWidget
impl Sync for DialogWidget
impl Unpin for DialogWidget
impl UnwindSafe for DialogWidget
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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