pub struct DrawerState { /* private fields */ }Expand description
Retained pointer geometry around the existing modal lifecycle.
DialogState remains the sole owner of open state, focus trapping, initial focus and restoration. Only presses on the dedicated handle start dragging; scrolling and editing inside the body retain their normal native behavior.
Implementations§
Source§impl DrawerState
impl DrawerState
pub fn new(window: &mut Window, cx: &mut Context<'_, Self>) -> Self
Sourcepub fn with_dialog(
dialog: Entity<DialogState>,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Self
pub fn with_dialog( dialog: Entity<DialogState>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
Adopts an existing modal state, including its configured initial focus. Mount that state in this Drawer only, not in a second Dialog as well.
pub fn dialog(&self) -> &Entity<DialogState>
Sourcepub fn side(self, side: Placement) -> Self
pub fn side(self, side: Placement) -> Self
Sets the physical window edge before mounting. The default is bottom.
Sourcepub fn snap_points(self, points: impl IntoIterator<Item = f32>) -> Self
pub fn snap_points(self, points: impl IntoIterator<Item = f32>) -> Self
Sets increasing fractions of the window height for a top or bottom drawer. The first fraction is its initial height.
Sourcepub fn snap_index(&self) -> Option<usize>
pub fn snap_index(&self) -> Option<usize>
Index of the current resting height, retained when the drawer closes.
Sourcepub fn set_snap_index(
&mut self,
index: usize,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> bool
pub fn set_snap_index( &mut self, index: usize, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool
Changes the resting height, for example from an accessible size button. Returns false for an index outside the configured points.
pub fn is_open(&self, cx: &App) -> bool
pub fn focus_handle(&self, cx: &App) -> FocusHandle
pub fn open(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
pub fn close(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
pub fn is_dragging(&self) -> bool
pub fn drag_offset(&self) -> Pixels
Trait Implementations§
impl EventEmitter<DialogEvent> for DrawerState
Auto Trait Implementations§
impl !RefUnwindSafe for DrawerState
impl !Send for DrawerState
impl !Sync for DrawerState
impl !UnwindSafe for DrawerState
impl Forget for DrawerState
impl Freeze for DrawerState
impl Move for DrawerState
impl Unpin for DrawerState
impl UnsafeUnpin for DrawerState
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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