pub struct Modal { /* private fields */ }
Expand description

A Modal is created using Modal::new(). Make sure to use a let binding when using Modal::new() to ensure you can call things like Modal::open() later on.

let modal = Modal::new("my_modal");
modal.show(ctx, |ui| {
    ui.label("Hello world!")
});
if ui.button("modal").clicked() {
    modal.open(ctx);
}

Implementations

Creates a new Modal. Can use constructor functions like Modal::with_style to modify upon creation.

Open the modal; make it visible. The modal prevents user input to other parts of the application.

Close the modal so that it is no longer visible, allowing input to flow back into the application.

If set to true, the modal will close itself if the user clicks outside on the modal window (onto the overlay).

Change the ModalStyle of the modal upon creation.

Helper function for styling the title of the modal.

Helper function for styling the icon of the modal.

Helper function for styling the container the of body and icon.

Helper function that should be used when using a body and icon together.

Helper function for styling the body of the modal.

Helper function for styling the button container of the modal.

Helper function for creating a normal button for the modal. Automatically closes the modal on click.

Helper function for creating a “cautioned” button for the modal. Automatically closes the modal on click.

Helper function for creating a “suggested” button for the modal. Automatically closes the modal on click.

The ui contained in this function will be shown within the modal window. The modal will only actually show when Modal::open is used.

Open the modal as a dialog. This is a shorthand way of defining a Modal::show once, for example, if a function returns an Error. This should be used in conjunction with Modal::show_dialog. This function should be put AFTER any calls to

Needed in order to use Modal::open_dialog. Make sure this is called every frame, as it renders the necessary ui when using a modal as a dialog.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.