Struct ModalSpec
pub struct ModalSpec<'a> {
pub title: &'a str,
pub icon: Option<Icon>,
pub closable: bool,
pub actions: &'a [ModalAction<'a>],
pub platform: PlatformConventions,
pub body_height: f64,
pub header_height: f64,
pub max_width: f64,
pub close_hovered: bool,
pub close_focused: bool,
pub dismiss_on_scrim: bool,
pub anchor: Option<Rect>,
}Expand description
What a modal is being asked to frame.
Fields§
§title: &'a strThe sheet’s title, set in the Title role.
icon: Option<Icon>An icon leading the title that names who asks (a lock for a password, the network for a Wi-Fi join).
closable: boolDraw a close control. Escape always dismisses; this is its visible half, for a sheet with no Cancel action.
actions: &'a [ModalAction<'a>]Actions in semantic authoring order. Geometry follows
Self::platform, so callers do not branch on native button order.
platform: PlatformConventionsNative shortcut and dialog presentation conventions.
body_height: f64Height the caller’s body content wants, in the same logical pixels as the rest of the layout (already grown by the text scale).
header_height: f64Height the sheet’s header wants, below the title: the body scrolls under it, so a strip of tabs or a search field stays in view.
max_width: f64Widest the sheet may be drawn, in design pixels. Defaults to
MODAL_MAX_WIDTH.
close_hovered: bool§close_focused: bool§dismiss_on_scrim: boolWhether a scrim click dismisses. The scrim swallows the click either way: a surface that lets clicks through is not modal.
anchor: Option<Rect>The control the sheet asks about: it stands beside it as a popover,
the window undimmed. None centres it over the window.
Implementations§
§impl<'a> ModalSpec<'a>
impl<'a> ModalSpec<'a>
pub fn new(title: &'a str) -> ModalSpec<'a>
pub fn actions(self, actions: &'a [ModalAction<'a>]) -> ModalSpec<'a>
pub fn icon(self, icon: Option<Icon>) -> ModalSpec<'a>
pub fn platform_conventions( self, platform: PlatformConventions, ) -> ModalSpec<'a>
pub fn body_height(self, h: f64) -> ModalSpec<'a>
pub fn header_height(self, h: f64) -> ModalSpec<'a>
pub fn max_width(self, w: f64) -> ModalSpec<'a>
pub fn closable(self, v: bool) -> ModalSpec<'a>
pub fn dismiss_on_scrim(self, v: bool) -> ModalSpec<'a>
pub fn close_hovered(self, v: bool) -> ModalSpec<'a>
pub fn close_focused(self, v: bool) -> ModalSpec<'a>
pub fn anchor(self, anchor: Option<Rect>) -> ModalSpec<'a>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ModalSpec<'a>
impl<'a> RefUnwindSafe for ModalSpec<'a>
impl<'a> Send for ModalSpec<'a>
impl<'a> Sync for ModalSpec<'a>
impl<'a> Unpin for ModalSpec<'a>
impl<'a> UnsafeUnpin for ModalSpec<'a>
impl<'a> UnwindSafe for ModalSpec<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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