pub struct TabsState { /* private fields */ }Expand description
Allocation-free controlled active value for one tab set.
QuickGUI deliberately does not retain or discover application values outside the mounted tree.
The application owns this state, mutates it only from direct interaction, and rebuilds the
descriptor from Tabs::from_state.
Implementations§
Source§impl TabsState
impl TabsState
pub fn new(active: impl Into<ElementId>) -> Self
pub const fn empty() -> Self
pub const fn active(&self) -> Option<ElementId>
Sourcepub const fn active_index(&self) -> Option<usize>
pub const fn active_index(&self) -> Option<usize>
The position the active tab was last selected at, when the application supplied one.
Sourcepub const fn activation_movement(&self) -> TabsActivationMovement
pub const fn activation_movement(&self) -> TabsActivationMovement
Which way the selection last moved along the tab list.
This is the raw half of Base UI’s data-activation-direction; Tabs::activation_direction
turns it into a side using the declared orientation. It stays
TabsActivationMovement::None until the application selects through
Self::select_at, because a bare value carries no ordering.
Sourcepub fn set_active(&mut self, active: Option<ElementId>) -> bool
pub fn set_active(&mut self, active: Option<ElementId>) -> bool
Replace the controlled value, returning whether it changed.
The activation movement is cleared: a value on its own says nothing about which way the
selection travelled. Use Self::select_at to record it.
pub fn select(&mut self, value: impl Into<ElementId>) -> bool
Sourcepub fn select_at(&mut self, value: impl Into<ElementId>, index: usize) -> bool
pub fn select_at(&mut self, value: impl Into<ElementId>, index: usize) -> bool
Select one tab by value and position, recording which way the selection moved.
The application already knows the order it declares its tabs in, so it passes the index it is rendering; QuickGUI keeps no item registry to discover it from. Returns whether the value changed.
pub fn clear(&mut self) -> bool
Trait Implementations§
impl Copy for TabsState
impl Eq for TabsState
impl StructuralPartialEq for TabsState
Auto Trait Implementations§
impl Freeze for TabsState
impl RefUnwindSafe for TabsState
impl Send for TabsState
impl Sync for TabsState
impl Unpin for TabsState
impl UnsafeUnpin for TabsState
impl UnwindSafe for TabsState
Blanket Implementations§
impl<T> Action for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.