pub struct Dialog<'a, Message, Theme = Theme, Renderer = Renderer>where
Renderer: 'a + Renderer,
Theme: 'a + Catalog,{ /* private fields */ }Expand description
A message dialog.
Only the content is required, buttons and the title are optional.
The sizing strategy used depends on whether you add any buttons: if you don’t, the dialog will
be sized to fit the content similarly to a container. If you do add buttons, max_width
& max_height (or width & height when set to a fixed pixel value) are used. If
these aren’t set, DEFAULT_MAX_WIDTH and/or DEFAULT_MAX_HEIGHT are used.
Implementations§
Source§impl<'a, Message, Theme, Renderer> Dialog<'a, Message, Theme, Renderer>
impl<'a, Message, Theme, Renderer> Dialog<'a, Message, Theme, Renderer>
Sourcepub fn new(
is_open: bool,
base: impl Into<Element<'a, Message, Theme, Renderer>>,
content: impl Into<Element<'a, Message, Theme, Renderer>>,
palette: &'a Palette,
) -> Self
pub fn new( is_open: bool, base: impl Into<Element<'a, Message, Theme, Renderer>>, content: impl Into<Element<'a, Message, Theme, Renderer>>, palette: &'a Palette, ) -> Self
Creates a new Dialog with the given base and dialog content.
Creates a new Dialog with the given base, dialog content and buttons.
Sourcepub fn on_press(self, on_press: Message) -> Selfwhere
Message: Clone,
pub fn on_press(self, on_press: Message) -> Selfwhere
Message: Clone,
Sets the message that will be produced when the Dialog’s backdrop is pressed.
Sourcepub fn on_press_with(self, on_press: impl Fn() -> Message + 'a) -> Self
pub fn on_press_with(self, on_press: impl Fn() -> Message + 'a) -> Self
Sets the message that will be produced when the Dialog’s backdrop is pressed.
This is analogous to Dialog::on_press, but using a closure to produce
the message.
Sourcepub fn on_press_maybe(self, on_press: Option<Message>) -> Selfwhere
Message: Clone,
pub fn on_press_maybe(self, on_press: Option<Message>) -> Selfwhere
Message: Clone,
Sets the message that will be produced when the Dialog’s backdrop is pressed, if Some.
Sourcepub fn max_height(self, max_height: impl Into<Pixels>) -> Self
pub fn max_height(self, max_height: impl Into<Pixels>) -> Self
Sets the Dialog’s maximum height.
Sourcepub fn align_left(self) -> Self
pub fn align_left(self) -> Self
Aligns the Dialog to the left.
Sourcepub fn align_right(self) -> Self
pub fn align_right(self) -> Self
Aligns the Dialog to the right.
Sourcepub fn align_bottom(self) -> Self
pub fn align_bottom(self) -> Self
Aligns the Dialog to the bottom.
Sourcepub fn padding_inner(self, padding: impl Into<Padding>) -> Self
pub fn padding_inner(self, padding: impl Into<Padding>) -> Self
Sets the Dialog’s inner padding.
Sourcepub fn padding_outer(self, padding: impl Into<Padding>) -> Self
pub fn padding_outer(self, padding: impl Into<Padding>) -> Self
Sets the Dialog’s outer padding (sometimes called “margin”).
Sets the vertical alignment of the Dialog’s buttons.
Adds a button to the Dialog.
Adds a button to the Dialog, if Some.
Extends the Dialog with the given buttons.
Trait Implementations§
Auto Trait Implementations§
impl<'a, Message, Theme = Theme, Renderer = Renderer<Renderer, Renderer>> !RefUnwindSafe for Dialog<'a, Message, Theme, Renderer>
impl<'a, Message, Theme = Theme, Renderer = Renderer<Renderer, Renderer>> !Send for Dialog<'a, Message, Theme, Renderer>
impl<'a, Message, Theme = Theme, Renderer = Renderer<Renderer, Renderer>> !Sync for Dialog<'a, Message, Theme, Renderer>
impl<'a, Message, Theme = Theme, Renderer = Renderer<Renderer, Renderer>> !UnwindSafe for Dialog<'a, Message, Theme, Renderer>
impl<'a, Message, Theme, Renderer> Freeze for Dialog<'a, Message, Theme, Renderer>
impl<'a, Message, Theme, Renderer> Unpin for Dialog<'a, Message, Theme, Renderer>
impl<'a, Message, Theme, Renderer> UnsafeUnpin for Dialog<'a, Message, Theme, Renderer>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.