pub struct PromptInput {
pub send_icon: LiveValue,
pub stop_icon: LiveValue,
pub task: Task,
pub interactivity: Interactivity,
pub bot_capabilities: Option<BotCapabilities>,
/* private fields */
}Expand description
A prepared text input for conversation with bots.
This is mostly a dummy widget. Prefer using and adapting crate::widgets::chat::Chat instead.
Fields§
§send_icon: LiveValueIcon used by this widget when the task is set to Task::Send.
stop_icon: LiveValueIcon used by this widget when the task is set to Task::Stop.
task: TaskIf this widget should provoke sending a message or stopping the current response.
interactivity: InteractivityIf this widget should be interactive or not.
bot_capabilities: Option<BotCapabilities>Capabilities of the currently selected bot
Implementations§
Source§impl PromptInput
impl PromptInput
Sourcepub fn reset(&mut self, cx: &mut Cx)
pub fn reset(&mut self, cx: &mut Cx)
Reset this prompt input erasing text, removing attachments, etc.
Shadows the [CommandTextInput::reset] method.
Sourcepub fn submitted(&self, actions: &Actions) -> bool
pub fn submitted(&self, actions: &Actions) -> bool
Check if the submit button or the return key was pressed.
Note: To know what the button submission means, check Self::task or the utility methods.
pub fn call_pressed(&self, actions: &Actions) -> bool
Sourcepub fn has_send_task(&self) -> bool
pub fn has_send_task(&self) -> bool
Shorthand to check if Self::task is set to Task::Send.
Sourcepub fn has_stop_task(&self) -> bool
pub fn has_stop_task(&self) -> bool
Shorthand to check if Self::task is set to Task::Stop.
Sourcepub fn set_send(&mut self)
pub fn set_send(&mut self)
Shorthand to set Self::task to Task::Send.
Sourcepub fn set_stop(&mut self)
pub fn set_stop(&mut self)
Shorthand to set Self::task to Task::Stop.
Sourcepub fn set_bot_capabilities(
&mut self,
cx: &mut Cx,
capabilities: Option<BotCapabilities>,
)
pub fn set_bot_capabilities( &mut self, cx: &mut Cx, capabilities: Option<BotCapabilities>, )
Set the capabilities of the currently selected bot
Methods from Deref<Target = CommandTextInput>§
pub fn keyboard_focus_index(&self) -> Option<usize>
pub fn set_keyboard_focus_index(&mut self, idx: usize)
pub fn set_keyboard_focus_index(&mut self, idx: usize)
Sets the keyboard focus index for the list of selectable items Only updates the visual highlight state of the dropdown items
pub fn reset(&mut self, cx: &mut Cx)
pub fn reset(&mut self, cx: &mut Cx)
Clear all text and hide the popup going back to initial state.
pub fn clear_items(&mut self)
pub fn clear_items(&mut self)
Clears the list of items.
Normally called as response to should_build_items.
pub fn add_item(&mut self, widget: WidgetRef)
pub fn add_item(&mut self, widget: WidgetRef)
Add a custom selectable item to the list.
Normally called after clearing the previous items.
pub fn add_unselectable_item(&mut self, widget: WidgetRef)
pub fn add_unselectable_item(&mut self, widget: WidgetRef)
Add a custom unselectable item to the list.
Ex: Headers, dividers, etc.
Normally called after clearing the previous items.
pub fn search_text(&self) -> String
pub fn search_text(&self) -> String
Get the current search query.
You probably want this for filtering purposes when updating the items.
pub fn item_selected(
&self,
actions: &[Box<dyn ActionTrait>],
) -> Option<WidgetRef>
pub fn item_selected( &self, actions: &[Box<dyn ActionTrait>], ) -> Option<WidgetRef>
Checks if any item has been selected in the given actions
and returns a reference to the selected item as a widget.
pub fn should_build_items(&self, actions: &[Box<dyn ActionTrait>]) -> bool
pub fn should_build_items(&self, actions: &[Box<dyn ActionTrait>]) -> bool
Returns true if an action in the given actions indicates that
the items to display need to be recomputed again.
For example, this returns true if the trigger character was typed, if the search filter changes, etc.
pub fn text_input_ref(&self) -> TextInputRef
pub fn text_input_ref(&self) -> TextInputRef
Returns a reference to the inner TextInput widget.
pub fn search_input_ref(&self) -> TextInputRef
pub fn search_input_ref(&self) -> TextInputRef
Returns a reference to the inner TextInput widget used for search.
pub fn request_text_input_focus(&mut self)
pub fn request_text_input_focus(&mut self)
Obtain focus in the main TextInput widget as soon as possible.