pub struct PopupModal<'p, Label> { /* private fields */ }
Expand description

Create a modal pop-up.

§Example

if ui.button(im_str!("Show modal")) {
    ui.open_popup(im_str!("modal"));
}
if let Some(_token) = PopupModal::new(im_str!("modal")).begin_popup(&ui) {
    ui.text("Content of my modal");
    if ui.button(im_str!("OK")) {
        ui.close_current_popup();
    }
};

Implementations§

source§

impl<'p, Label: AsRef<str>> PopupModal<'p, Label>

source

pub fn new(label: Label) -> Self

source

pub fn opened(self, opened: &'p mut bool) -> Self

Pass a mutable boolean which will be updated to refer to the current “open” state of the modal.

source

pub fn flags(self, flags: WindowFlags) -> Self

source

pub fn title_bar(self, value: bool) -> Self

source

pub fn resizable(self, value: bool) -> Self

source

pub fn movable(self, value: bool) -> Self

source

pub fn scroll_bar(self, value: bool) -> Self

source

pub fn scrollable(self, value: bool) -> Self

source

pub fn collapsible(self, value: bool) -> Self

source

pub fn always_auto_resize(self, value: bool) -> Self

source

pub fn save_settings(self, value: bool) -> Self

source

pub fn inputs(self, value: bool) -> Self

source

pub fn menu_bar(self, value: bool) -> Self

source

pub fn horizontal_scrollbar(self, value: bool) -> Self

source

pub fn no_focus_on_appearing(self, value: bool) -> Self

source

pub fn no_bring_to_front_on_focus(self, value: bool) -> Self

source

pub fn always_vertical_scrollbar(self, value: bool) -> Self

source

pub fn always_horizontal_scrollbar(self, value: bool) -> Self

source

pub fn always_use_window_padding(self, value: bool) -> Self

source

pub fn build<T, F: FnOnce() -> T>(self, ui: &Ui<'_>, f: F) -> Option<T>

Consume and draw the PopupModal. Returns the result of the closure, if it is called.

source

pub fn begin_popup<'ui>(self, ui: &Ui<'ui>) -> Option<PopupToken<'ui>>

Consume and draw the PopupModal. Construct a popup that can have any kind of content.

This should be called per frame, whereas Ui::open_popup should be called once when you want to actual create the popup.

Auto Trait Implementations§

§

impl<'p, Label> Freeze for PopupModal<'p, Label>
where Label: Freeze,

§

impl<'p, Label> RefUnwindSafe for PopupModal<'p, Label>
where Label: RefUnwindSafe,

§

impl<'p, Label> Send for PopupModal<'p, Label>
where Label: Send,

§

impl<'p, Label> Sync for PopupModal<'p, Label>
where Label: Sync,

§

impl<'p, Label> Unpin for PopupModal<'p, Label>
where Label: Unpin,

§

impl<'p, Label> !UnwindSafe for PopupModal<'p, Label>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.