pub struct SessionPickerState {
pub active: bool,
pub selected_index: usize,
/* private fields */
}Expand description
State for the session picker
Fields§
§active: boolWhether the picker is currently visible
selected_index: usizeIndex of the currently selected session
Implementations§
Source§impl SessionPickerState
impl SessionPickerState
pub fn new() -> Self
Sourcepub fn with_config(config: SessionPickerConfig) -> Self
pub fn with_config(config: SessionPickerConfig) -> Self
Create a new session picker with custom configuration
Sourcepub fn config(&self) -> &SessionPickerConfig
pub fn config(&self) -> &SessionPickerConfig
Get the current configuration
Sourcepub fn set_config(&mut self, config: SessionPickerConfig)
pub fn set_config(&mut self, config: SessionPickerConfig)
Set a new configuration
Sourcepub fn activate(&mut self, sessions: Vec<SessionInfo>, current_session_id: i64)
pub fn activate(&mut self, sessions: Vec<SessionInfo>, current_session_id: i64)
Activate the picker with the given sessions
Sourcepub fn select_previous(&mut self)
pub fn select_previous(&mut self)
Move selection up
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Move selection down
Sourcepub fn selected_session_id(&self) -> Option<i64>
pub fn selected_session_id(&self) -> Option<i64>
Get the currently selected session ID
Sourcepub fn selected_session(&self) -> Option<&SessionInfo>
pub fn selected_session(&self) -> Option<&SessionInfo>
Get the currently selected session info
Source§impl SessionPickerState
impl SessionPickerState
Sourcepub fn process_key(&mut self, key: KeyEvent) -> SessionKeyAction
pub fn process_key(&mut self, key: KeyEvent) -> SessionKeyAction
Handle a key event
Trait Implementations§
Source§impl Default for SessionPickerState
impl Default for SessionPickerState
Source§impl Widget for SessionPickerState
impl Widget for SessionPickerState
Source§fn handle_key(
&mut self,
key: KeyEvent,
ctx: &WidgetKeyContext<'_>,
) -> WidgetKeyResult
fn handle_key( &mut self, key: KeyEvent, ctx: &WidgetKeyContext<'_>, ) -> WidgetKeyResult
Handle key event, return result indicating what action to take. Read more
Source§fn required_height(&self, _available: u16) -> u16
fn required_height(&self, _available: u16) -> u16
Calculate required height for this widget Read more
Source§fn blocks_input(&self) -> bool
fn blocks_input(&self) -> bool
Whether this widget blocks input to the text input when active
Source§fn is_overlay(&self) -> bool
fn is_overlay(&self) -> bool
Whether this widget is a full-screen overlay Read more
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Cast to Any for mutable downcasting
Auto Trait Implementations§
impl Freeze for SessionPickerState
impl RefUnwindSafe for SessionPickerState
impl Send for SessionPickerState
impl Sync for SessionPickerState
impl Unpin for SessionPickerState
impl UnwindSafe for SessionPickerState
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> 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>
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 more