pub struct Modal {
pub id: UiId,
pub title: String,
pub content: String,
pub buttons: Vec<(UiId, String)>,
pub is_open: bool,
pub pressed: Option<UiId>,
/* private fields */
}Expand description
A modal dialog with overlay, focus trap, title, content, and button row.
Fields§
§id: UiId§title: String§content: String§is_open: bool§pressed: Option<UiId>Implementations§
Source§impl Modal
impl Modal
pub fn new(id: UiId, title: impl Into<String>) -> Self
pub fn with_content(self, s: impl Into<String>) -> Self
Sourcepub fn confirm(
id: UiId,
title: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn confirm( id: UiId, title: impl Into<String>, message: impl Into<String>, ) -> Self
Build a simple confirmation dialog.
Sourcepub fn input_dialog(
id: UiId,
title: impl Into<String>,
prompt: impl Into<String>,
) -> Self
pub fn input_dialog( id: UiId, title: impl Into<String>, prompt: impl Into<String>, ) -> Self
Build an input dialog (caller reads content field for entered text).
pub fn open(&mut self)
pub fn close(&mut self)
pub fn update(&mut self, ctx: &mut UiContext, vw: f32, vh: f32, dt: f32)
pub fn draw(&self, ctx: &mut UiContext, vw: f32, vh: f32, style: &UiStyle)
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 UnsafeUnpin 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.