pub struct Dialog<'a, Message, Base, Content, Theme = Theme, Renderer = Renderer>where
Theme: 'a + Catalog,{ /* private fields */ }Expand description
A message dialog.
Only the content is required, controls and the title are optional.
The dialog box’s maximum size is limited by default (see DEFAULT_MAX_WIDTH and
DEFAULT_MAX_HEIGHT). This is so that controls can Fill (which the crate’s button
helper does by default) without making the dialog cover everything.
Implementations§
Source§impl<'a, Message, Base, Content, Theme, Renderer> Dialog<'a, Message, Base, Content, Theme, Renderer>
impl<'a, Message, Base, Content, Theme, Renderer> Dialog<'a, Message, Base, Content, Theme, Renderer>
Sourcepub fn new(is_open: bool, base: Base, content: Content) -> Self
pub fn new(is_open: bool, base: Base, content: Content) -> Self
Creates a new Dialog with the given base and dialog content.
Sourcepub fn with_controls(
is_open: bool,
base: Base,
content: Content,
controls: Vec<Element<'a, Message, Theme, Renderer>>,
) -> Self
pub fn with_controls( is_open: bool, base: Base, content: Content, controls: Vec<Element<'a, Message, Theme, Renderer>>, ) -> Self
Creates a new Dialog with the given base, dialog content and controls.
Sourcepub fn title(self, title: impl IntoFragment<'a>) -> Self
pub fn title(self, title: impl IntoFragment<'a>) -> Self
Sets the Dialog’s title.
Sourcepub fn on_press(self, on_press: Message) -> Self
pub fn on_press(self, on_press: Message) -> Self
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>) -> Self
pub fn on_press_maybe(self, on_press: Option<Message>) -> Self
Sets the message that will be produced when the Dialog’s backdrop is pressed, if Some.
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 align_x(self, alignment: impl Into<Horizontal>) -> Self
pub fn align_x(self, alignment: impl Into<Horizontal>) -> Self
Sourcepub fn box_padding(self, padding: impl Into<Padding>) -> Self
pub fn box_padding(self, padding: impl Into<Padding>) -> Self
Sets the Dialog’s inner padding.
Sourcepub fn backdrop_padding(self, padding: impl Into<Padding>) -> Self
pub fn backdrop_padding(self, padding: impl Into<Padding>) -> Self
Sets the padding between the Dialog and its backdrop.
Sourcepub fn align_controls(self, align: impl Into<Vertical>) -> Self
pub fn align_controls(self, align: impl Into<Vertical>) -> Self
Sets the vertical alignment of the Dialog’s controls.
Sourcepub fn push_control(
self,
control: Element<'a, Message, Theme, Renderer>,
) -> Self
pub fn push_control( self, control: Element<'a, Message, Theme, Renderer>, ) -> Self
Adds a control to the Dialog.
Sourcepub fn push_control_maybe(
self,
control: Option<Element<'a, Message, Theme, Renderer>>,
) -> Self
pub fn push_control_maybe( self, control: Option<Element<'a, Message, Theme, Renderer>>, ) -> Self
Adds a control to the Dialog, if Some.
Sourcepub fn extend_controls(
self,
controls: impl IntoIterator<Item = Element<'a, Message, Theme, Renderer>>,
) -> Self
pub fn extend_controls( self, controls: impl IntoIterator<Item = Element<'a, Message, Theme, Renderer>>, ) -> Self
Extends the Dialog with the given controls.
Sourcepub fn title_style(self, style: impl Fn(&Theme) -> Style + 'a) -> Self
pub fn title_style(self, style: impl Fn(&Theme) -> Style + 'a) -> Self
Sets the style of the Dialog’s title.
Sourcepub fn container_style(self, style: impl Fn(&Theme) -> Style + 'a) -> Self
pub fn container_style(self, style: impl Fn(&Theme) -> Style + 'a) -> Self
Sets the style of the Dialog’s container.
Sourcepub fn class(self, class: impl Into<<Theme as Catalog>::Class<'a>>) -> Self
pub fn class(self, class: impl Into<<Theme as Catalog>::Class<'a>>) -> Self
Sets the style class of the Dialog.
Sourcepub fn title_class(
self,
class: impl Into<<Theme as Catalog>::Class<'a>>,
) -> Self
pub fn title_class( self, class: impl Into<<Theme as Catalog>::Class<'a>>, ) -> Self
Sets the style class of the Dialog’s title.