pub struct CollapsibleState { /* private fields */ }Expand description
Retained disclosure state and focus for one host in one window.
The trigger toggles the content without moving focus into it. Closing focused content returns focus to its still-mounted trigger, or the root scope while that trigger is disabled. Focus elsewhere is kept. Keep child data in application-owned entities so it survives unmounting.
Implementations§
Source§impl CollapsibleState
impl CollapsibleState
pub fn new(cx: &mut Context<'_, Self>) -> Self
Sourcepub fn default_open(self, open: bool) -> Self
pub fn default_open(self, open: bool) -> Self
Chooses the initial open state without emitting a change event.
pub fn is_open(&self) -> bool
pub fn is_disabled(&self) -> bool
pub fn trigger_focus_handle(&self) -> &FocusHandle
pub fn content_focus_handle(&self) -> &FocusHandle
Sourcepub fn set_open(
&mut self,
open: bool,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_open( &mut self, open: bool, window: &mut Window, cx: &mut Context<'_, Self>, )
Changes visibility programmatically, including while the trigger is disabled.
If closing removes the focused content, focus returns to the live trigger. While that trigger is disabled, the live non-Tab root receives focus so normal Tab traversal can leave the closed disclosure. Removing the entire host remains the application’s responsibility, including moving focus to a surviving control before removal.
Sourcepub fn toggle(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
pub fn toggle(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
Toggles an enabled disclosure. Disabled triggers ignore this request.
Sourcepub fn set_disabled(
&mut self,
disabled: bool,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_disabled( &mut self, disabled: bool, window: &mut Window, cx: &mut Context<'_, Self>, )
Disables user toggling without closing or disabling existing content. A focused disabled trigger keeps Button’s focus binding so Tab can leave.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CollapsibleState
impl !UnwindSafe for CollapsibleState
impl Forget for CollapsibleState
impl Freeze for CollapsibleState
impl Move for CollapsibleState
impl Send for CollapsibleState
impl Sync for CollapsibleState
impl Unpin for CollapsibleState
impl UnsafeUnpin for CollapsibleStatewhere
NonZeroU32Inner: UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin,
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