pub struct CommandPalette { /* private fields */ }Expand description
A query field over a list of commands.
The palette owns the query and where the keyboard is; the command list and whether the palette is on screen at all belong to the host.
Implementations§
Source§impl CommandPalette
impl CommandPalette
pub fn new( ident: impl Into<Ident>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
pub fn commands(self, commands: impl IntoIterator<Item = Command>) -> Self
pub fn set_commands( &mut self, commands: Vec<Command>, cx: &mut Context<'_, Self>, )
pub fn query(&self, cx: &App) -> SharedString
Sourcepub fn set_query(
&mut self,
query: impl Into<SharedString>,
cx: &mut Context<'_, Self>,
)
pub fn set_query( &mut self, query: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
Replaces the query from the host side, for example when the palette is opened with something already typed.
pub fn query_input(&self) -> &Entity<TextInput>
Sourcepub fn focus_query(&self, window: &mut Window, cx: &mut App)
pub fn focus_query(&self, window: &mut Window, cx: &mut App)
Moves the keyboard into the query field.
Sourcepub fn active_id(&self, cx: &App) -> Option<SharedString>
pub fn active_id(&self, cx: &App) -> Option<SharedString>
The command the keyboard is on, or None when nothing can be taken.
Trait Implementations§
Source§impl Debug for CommandPalette
impl Debug for CommandPalette
impl EventEmitter<CommandPaletteEvent> for CommandPalette
Source§impl Focusable for CommandPalette
impl Focusable for CommandPalette
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Source§impl Render for CommandPalette
impl Render for CommandPalette
Auto Trait Implementations§
impl !RefUnwindSafe for CommandPalette
impl !Send for CommandPalette
impl !Sync for CommandPalette
impl !UnwindSafe for CommandPalette
impl Freeze for CommandPalette
impl Unpin for CommandPalette
impl UnsafeUnpin for CommandPalette
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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