pub struct QuestionPanel { /* private fields */ }Expand description
State for the question panel overlay
Implementations§
Source§impl QuestionPanel
impl QuestionPanel
Sourcepub fn with_config(config: QuestionPanelConfig) -> Self
pub fn with_config(config: QuestionPanelConfig) -> Self
Create a new inactive question panel with custom configuration
Sourcepub fn config(&self) -> &QuestionPanelConfig
pub fn config(&self) -> &QuestionPanelConfig
Get the current configuration
Sourcepub fn set_config(&mut self, config: QuestionPanelConfig)
pub fn set_config(&mut self, config: QuestionPanelConfig)
Set a new configuration
Sourcepub fn activate(
&mut self,
tool_use_id: String,
session_id: i64,
request: AskUserQuestionsRequest,
turn_id: Option<TurnId>,
)
pub fn activate( &mut self, tool_use_id: String, session_id: i64, request: AskUserQuestionsRequest, turn_id: Option<TurnId>, )
Activate the panel with questions
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivate the panel
Sourcepub fn tool_use_id(&self) -> &str
pub fn tool_use_id(&self) -> &str
Get the current tool use ID
Sourcepub fn session_id(&self) -> i64
pub fn session_id(&self) -> i64
Get the session ID
Sourcepub fn request(&self) -> &AskUserQuestionsRequest
pub fn request(&self) -> &AskUserQuestionsRequest
Get the current request
Sourcepub fn build_response(&self) -> AskUserQuestionsResponse
pub fn build_response(&self) -> AskUserQuestionsResponse
Build the response from current answers
Sourcepub fn current_focus(&self) -> Option<&FocusItem>
pub fn current_focus(&self) -> Option<&FocusItem>
Get current focus item
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Move focus to next item
Sourcepub fn focus_prev(&mut self)
pub fn focus_prev(&mut self)
Move focus to previous item
Sourcepub fn focus_submit(&mut self)
pub fn focus_submit(&mut self)
Jump to submit button
Sourcepub fn is_text_focused(&self) -> bool
pub fn is_text_focused(&self) -> bool
Check if current focus is on a text input (or OtherOption which also accepts typing)
Sourcepub fn can_submit(&self) -> bool
pub fn can_submit(&self) -> bool
Check if all required questions have been answered
Sourcepub fn process_key(&mut self, key: KeyEvent) -> KeyAction
pub fn process_key(&mut self, key: KeyEvent) -> KeyAction
Handle a key event
Returns the action that should be taken based on the key press.
Sourcepub fn panel_height(&self, max_height: u16) -> u16
pub fn panel_height(&self, max_height: u16) -> u16
Calculate the panel height based on content
Trait Implementations§
Source§impl Default for QuestionPanel
impl Default for QuestionPanel
Source§impl Widget for QuestionPanel
impl Widget for QuestionPanel
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 QuestionPanel
impl RefUnwindSafe for QuestionPanel
impl Send for QuestionPanel
impl Sync for QuestionPanel
impl Unpin for QuestionPanel
impl UnwindSafe for QuestionPanel
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