pub struct Dialog { /* private fields */ }Expand description
A modal dialog over a dimmed backdrop, shown while open is true.
Clicking the backdrop, the close button or pressing Escape closes it, and each of
the three can be turned off for what must not be dismissed by accident.
use ravenrs_reactive::State;
use ravenrs_widgets::{Dialog, Ui};
let open = State::new(true);
// Only its own buttons or Escape close it: a stray click does not lose what was typed.
let dialog = Dialog::new(open.binding(), "Discard the changes?").close_on_backdrop(false).close_button(false);
let mut ui = Ui::new(dialog, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl Dialog
impl Dialog
Sourcepub fn new(open: Binding<bool>, title: impl Into<String>) -> Self
pub fn new(open: Binding<bool>, title: impl Into<String>) -> Self
A dialog shown while open is true.
Sourcepub fn description(self, text: impl Into<String>) -> Self
pub fn description(self, text: impl Into<String>) -> Self
Adds a muted description under the title.
Sourcepub fn width(self, width: f32) -> Self
pub fn width(self, width: f32) -> Self
The widest the dialog gets, in logical pixels (460 by default). It always fits the window.
Sourcepub fn close_label(self, label: impl Into<String>) -> Self
pub fn close_label(self, label: impl Into<String>) -> Self
The close button’s name for screen readers (from Labels by default).
Sourcepub fn close_on_escape(self, close: bool) -> Self
pub fn close_on_escape(self, close: bool) -> Self
Whether Escape closes it (it does by default).
Sourcepub fn close_on_backdrop(self, close: bool) -> Self
pub fn close_on_backdrop(self, close: bool) -> Self
Whether a click on the backdrop closes it (it does by default).
Whether it shows the X in its corner (it does by default).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Dialog
impl !Send for Dialog
impl !Sync for Dialog
impl !UnwindSafe for Dialog
impl Freeze for Dialog
impl Unpin for Dialog
impl UnsafeUnpin for Dialog
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
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.