#[repr(C)]pub struct Modal {
pub modal_state: ModalStateWrapper,
pub title: AzString,
pub content: Dom,
pub show_close_button: bool,
pub backdrop_style: CssPropertyWithConditionsVec,
}Expand description
An in-app overlay dialog holding arbitrary content, with an optional title and close button.
Fields§
§modal_state: ModalStateWrapperRuntime state (open) plus the optional close callback.
title: AzStringThe dialog title (empty = no title bar).
content: DomThe arbitrary content shown inside the panel.
Whether to render the “x” close button.
backdrop_style: CssPropertyWithConditionsVecStyle of the full-area backdrop (includes its current display).
Implementations§
Source§impl Modal
impl Modal
Sourcepub fn create(content: Dom) -> Self
pub fn create(content: Dom) -> Self
Creates a new (closed) modal holding content, with a “x” close button and
no title.
Sourcepub fn with_title(self, title: AzString) -> Self
pub fn with_title(self, title: AzString) -> Self
Builder-style setter for the title.
Sourcepub fn set_content(&mut self, content: Dom)
pub fn set_content(&mut self, content: Dom)
Replaces the content shown inside the panel.
Sourcepub fn with_content(self, content: Dom) -> Self
pub fn with_content(self, content: Dom) -> Self
Builder-style setter for the content.
Sourcepub fn set_open(&mut self, open: bool)
pub fn set_open(&mut self, open: bool)
Sets whether the dialog is currently open, recomputing the backdrop style.
Sets whether the “x” close button is shown.
Builder-style setter for the close-button flag.
Sourcepub fn set_on_close<C: Into<ModalOnCloseCallback>>(
&mut self,
data: RefAny,
on_close: C,
)
pub fn set_on_close<C: Into<ModalOnCloseCallback>>( &mut self, data: RefAny, on_close: C, )
Sets the close callback (invoked with the new state when “x” is clicked).
Sourcepub fn with_on_close<C: Into<ModalOnCloseCallback>>(
self,
data: RefAny,
on_close: C,
) -> Self
pub fn with_on_close<C: Into<ModalOnCloseCallback>>( self, data: RefAny, on_close: C, ) -> Self
Builder-style setter for the close callback.
Sourcepub fn swap_with_default(&mut self) -> Self
pub fn swap_with_default(&mut self) -> Self
Replaces self with a default (empty, closed) modal and returns the original.
Trait Implementations§
impl Eq for Modal
impl StructuralPartialEq for Modal
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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