pub struct Modal { /* private fields */ }Expand description
A modal dialog widget
Implementations§
Source§impl Modal
impl Modal
Sourcepub fn new(id: impl Hash + Debug, title: impl Into<String>) -> Self
pub fn new(id: impl Hash + Debug, title: impl Into<String>) -> Self
Create a new modal with the given title. An empty title leaves the header to the content.
Sourcepub fn width(self, width: f32) -> Self
pub fn width(self, width: f32) -> Self
Set the outer width of the modal, including its frame padding
Sourcepub fn height(self, height: f32) -> Self
pub fn height(self, height: f32) -> Self
Set the outer height of the modal, including its 16 px padding, for content that fills
the modal, such as a list in a scroll area. The modal keeps 24 px free above and below it
in the window and follows the window when it shrinks. Overrides Self::min_height.
Sourcepub fn min_height(self, height: f32) -> Self
pub fn min_height(self, height: f32) -> Self
Set the minimum outer height of the modal, including its 16 px padding
Sourcepub fn closable(self, closable: bool) -> Self
pub fn closable(self, closable: bool) -> Self
Set whether the modal can be closed with the close button, Escape or a backdrop click
Sourcepub fn fill(self, fill: Color32) -> Self
pub fn fill(self, fill: Color32) -> Self
Override the surface fill, leaving the theme’s panel fill as the default.
Sourcepub fn backdrop(self, color: Color32) -> Self
pub fn backdrop(self, color: Color32) -> Self
Override the backdrop colour, leaving the theme’s modal overlay as the default.
Sourcepub fn rounding(self, rounding: f32) -> Self
pub fn rounding(self, rounding: f32) -> Self
Override the corner radius, leaving the theme’s radius as the default.
Sourcepub fn top(self, top: f32) -> Self
pub fn top(self, top: f32) -> Self
Keep a fixed top edge while content height changes; clamp it inside the window.
Sourcepub fn dim_background(self, dim: bool) -> Self
pub fn dim_background(self, dim: bool) -> Self
Set whether to dim the background
Sourcepub fn show<R>(
self,
ctx: &Context,
open: &mut bool,
add_contents: impl FnOnce(&mut Ui) -> R,
) -> Option<ModalResponse<R>>
pub fn show<R>( self, ctx: &Context, open: &mut bool, add_contents: impl FnOnce(&mut Ui) -> R, ) -> Option<ModalResponse<R>>
Show the modal
Returns Some(R) if the modal was shown, where R is the result of the content function.
The open parameter controls whether the modal is visible and can be set to false
to close the 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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