pub struct PanelState {
pub focused: Option<PanelId>,
pub exploded: Option<PanelId>,
pub visible: Vec<PanelId>,
}Expand description
Panel state for focus/explode behavior.
Implements the ttop pattern for keyboard-navigable TUI panels.
Fields§
§focused: Option<PanelId>Currently focused panel
exploded: Option<PanelId>Currently exploded (full-screen) panel
visible: Vec<PanelId>Visible panels in display order
Implementations§
Source§impl PanelState
impl PanelState
Sourcepub fn with_panels(panels: Vec<PanelId>) -> Self
pub fn with_panels(panels: Vec<PanelId>) -> Self
Create with custom panel list.
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Focus next panel in list.
Sourcepub fn focus_prev(&mut self)
pub fn focus_prev(&mut self)
Focus previous panel in list.
Sourcepub fn toggle_explode(&mut self)
pub fn toggle_explode(&mut self)
Toggle exploded state for focused panel.
Sourcepub fn is_focused(&self, panel: PanelId) -> bool
pub fn is_focused(&self, panel: PanelId) -> bool
Check if a panel is focused.
Sourcepub fn is_exploded(&self, panel: PanelId) -> bool
pub fn is_exploded(&self, panel: PanelId) -> bool
Check if a panel is exploded.
Sourcepub fn has_exploded(&self) -> bool
pub fn has_exploded(&self) -> bool
Check if any panel is exploded.
Sourcepub fn remove_panel(&mut self, panel: PanelId)
pub fn remove_panel(&mut self, panel: PanelId)
Remove a panel from the visible list.
Trait Implementations§
Source§impl Clone for PanelState
impl Clone for PanelState
Source§fn clone(&self) -> PanelState
fn clone(&self) -> PanelState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PanelState
impl Debug for PanelState
Auto Trait Implementations§
impl Freeze for PanelState
impl RefUnwindSafe for PanelState
impl Send for PanelState
impl Sync for PanelState
impl Unpin for PanelState
impl UnsafeUnpin for PanelState
impl UnwindSafe for PanelState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().