pub struct CommandBarState<I: ApplicationInfo> { /* private fields */ }Expand description
Persistent state for rendering CommandBar.
Implementations§
Source§impl<I> CommandBarState<I>where
I: ApplicationInfo,
impl<I> CommandBarState<I>where
I: ApplicationInfo,
Sourcepub fn new(store: &mut Store<I>) -> Self
pub fn new(store: &mut Store<I>) -> Self
Create state for a CommandBar widget.
Sourcepub fn get_completions(&self) -> Option<CompletionList>
pub fn get_completions(&self) -> Option<CompletionList>
Get completion candidates from the command bar to show the user.
Sourcepub fn set_type(
&mut self,
prompt: &str,
ct: CommandType,
act: &Action<I>,
ctx: &EditContext,
)
pub fn set_type( &mut self, prompt: &str, ct: CommandType, act: &Action<I>, ctx: &EditContext, )
Set the type of command that the bar is being used for.
Sourcepub fn reset(&mut self) -> EditRope
pub fn reset(&mut self) -> EditRope
Reset the contents of the bar, and return the contents as an EditRope.
Sourcepub fn reset_text(&mut self) -> String
pub fn reset_text(&mut self) -> String
Reset the contents of the bar, and return the contents as a String.
Methods from Deref<Target = TextBoxState<I>>§
Sourcepub fn buffer(&self) -> SharedBuffer<I>
pub fn buffer(&self) -> SharedBuffer<I>
Get a reference to the shared buffer used by this text box.
Sourcepub fn is_readonly(&self) -> bool
pub fn is_readonly(&self) -> bool
Indicates whether the buffer contents are readonly.
Sourcepub fn set_readonly(&mut self, readonly: bool)
pub fn set_readonly(&mut self, readonly: bool)
Set whether the buffer contents are modifiable through the Editable trait.
Sourcepub fn set_text<T: Into<EditRope>>(&mut self, t: T)
pub fn set_text<T: Into<EditRope>>(&mut self, t: T)
Replace the contents of the text box’s underlying buffer.
Sourcepub fn reset(&mut self) -> EditRope
pub fn reset(&mut self) -> EditRope
Clear the text box’s underlying buffer of its content, and return it.
Sourcepub fn reset_text(&mut self) -> String
pub fn reset_text(&mut self) -> String
Clear the text box’s underlying buffer of its content, and return it as a String.
Sourcepub fn set_left_gutter(&mut self, line: usize, s: String, style: Option<Style>)
pub fn set_left_gutter(&mut self, line: usize, s: String, style: Option<Style>)
Create or update a line annotation for the left gutter.
Sourcepub fn set_right_gutter(&mut self, line: usize, s: String, style: Option<Style>)
pub fn set_right_gutter(&mut self, line: usize, s: String, style: Option<Style>)
Create or update a line annotation for the right gutter.
Sourcepub fn set_wrap(&mut self, wrap: bool)
pub fn set_wrap(&mut self, wrap: bool)
Control whether the text box should wrap long lines when displaying them.
Sourcepub fn set_term_info(&mut self, area: Rect)
pub fn set_term_info(&mut self, area: Rect)
Inform the text box what its dimensions and placement on the terminal window is.
Sourcepub fn get_cursor(&mut self) -> Cursor
pub fn get_cursor(&mut self) -> Cursor
Get the leader cursor for this text box’s cursor group.
Sourcepub fn has_lines(&self, max: usize) -> usize
pub fn has_lines(&self, max: usize) -> usize
Check whether this text box is capable of displaying max lines.
If there are fewer lines available than max, this returns the same value as
get_lines().
Otherwise, this returns max.
This method is useful for building additional widgets that want to create a TextBox with a
flexible height up to max lines.
Trait Implementations§
Source§impl<I> Deref for CommandBarState<I>where
I: ApplicationInfo,
impl<I> Deref for CommandBarState<I>where
I: ApplicationInfo,
Source§impl<I> DerefMut for CommandBarState<I>where
I: ApplicationInfo,
impl<I> DerefMut for CommandBarState<I>where
I: ApplicationInfo,
Source§impl<I> PromptActions<EditContext, Store<I>, I> for CommandBarState<I>where
I: ApplicationInfo,
impl<I> PromptActions<EditContext, Store<I>, I> for CommandBarState<I>where
I: ApplicationInfo,
Source§fn submit(
&mut self,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<Vec<(Action<I>, EditContext)>, I>
fn submit( &mut self, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<Vec<(Action<I>, EditContext)>, I>
Source§fn abort(
&mut self,
_empty: bool,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<Vec<(Action<I>, EditContext)>, I>
fn abort( &mut self, _empty: bool, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<Vec<(Action<I>, EditContext)>, I>
Source§fn recall(
&mut self,
filter: &RecallFilter,
dir: &MoveDir1D,
count: &Count,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<Vec<(Action<I>, EditContext)>, I>
fn recall( &mut self, filter: &RecallFilter, dir: &MoveDir1D, count: &Count, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<Vec<(Action<I>, EditContext)>, I>
Source§impl<I> Promptable<EditContext, Store<I>, I> for CommandBarState<I>where
I: ApplicationInfo,
impl<I> Promptable<EditContext, Store<I>, I> for CommandBarState<I>where
I: ApplicationInfo,
Source§fn prompt(
&mut self,
act: &PromptAction,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<Vec<(Action<I>, EditContext)>, I>
fn prompt( &mut self, act: &PromptAction, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<Vec<(Action<I>, EditContext)>, I>
Auto Trait Implementations§
impl<I> Freeze for CommandBarState<I>
impl<I> RefUnwindSafe for CommandBarState<I>where
<I as ApplicationInfo>::Action: RefUnwindSafe,
<I as ApplicationInfo>::WindowId: RefUnwindSafe,
impl<I> Send for CommandBarState<I>
impl<I> Sync for CommandBarState<I>where
<I as ApplicationInfo>::Action: Sync,
<I as ApplicationInfo>::ContentId: Sync,
<I as ApplicationInfo>::WindowId: Sync,
I: Send + Sync,
impl<I> Unpin for CommandBarState<I>
impl<I> UnsafeUnpin for CommandBarState<I>
impl<I> UnwindSafe for CommandBarState<I>
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
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