pub struct SlashPopupState {
pub active: bool,
pub selected_index: usize,
/* private fields */
}Expand description
State for the slash command popup
Fields§
§active: boolWhether the popup is currently visible
selected_index: usizeIndex of the currently selected command
Implementations§
Source§impl SlashPopupState
impl SlashPopupState
Sourcepub fn with_config(config: SlashPopupConfig) -> Self
pub fn with_config(config: SlashPopupConfig) -> Self
Create a new slash popup with custom configuration
Sourcepub fn config(&self) -> &SlashPopupConfig
pub fn config(&self) -> &SlashPopupConfig
Get the current configuration
Sourcepub fn set_config(&mut self, config: SlashPopupConfig)
pub fn set_config(&mut self, config: SlashPopupConfig)
Set a new configuration
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivate popup
Sourcepub fn set_filtered_count(&mut self, count: usize)
pub fn set_filtered_count(&mut self, count: usize)
Update the filtered command count and clamp selection
Sourcepub fn select_previous(&mut self)
pub fn select_previous(&mut self)
Move selection up (with wrap)
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Move selection down (with wrap)
Sourcepub fn selected_index(&self) -> usize
pub fn selected_index(&self) -> usize
Get the currently selected index
Sourcepub fn popup_height(&self, max_height: u16) -> u16
pub fn popup_height(&self, max_height: u16) -> u16
Calculate the popup height based on filtered commands
Source§impl SlashPopupState
impl SlashPopupState
Sourcepub fn process_key(&mut self, key: KeyEvent) -> SlashKeyAction
pub fn process_key(&mut self, key: KeyEvent) -> SlashKeyAction
Handle a key event
Returns the action. For CharTyped and Backspace, the App needs to update the input buffer and filtered commands.
Trait Implementations§
Source§impl Default for SlashPopupState
impl Default for SlashPopupState
Source§impl Widget for SlashPopupState
impl Widget for SlashPopupState
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, max_height: u16) -> u16
fn required_height(&self, max_height: 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 SlashPopupState
impl RefUnwindSafe for SlashPopupState
impl Send for SlashPopupState
impl Sync for SlashPopupState
impl Unpin for SlashPopupState
impl UnwindSafe for SlashPopupState
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