pub struct Panel {
pub id: PanelId,
pub areas: Areas,
pub purpose: PanelPurpose,
/* private fields */
}
Expand description
A colon on screen containing a stack of states, the top one being visible
Fields§
§id: PanelId
§areas: Areas
§purpose: PanelPurpose
Implementations§
source§impl Panel
impl Panel
pub fn new(
id: PanelId,
state: Box<dyn PanelState>,
areas: Areas,
con: &AppContext
) -> Self
pub fn set_error(&mut self, text: String)
pub fn set_message<S: Into<String>>(&mut self, md: S)
sourcepub fn apply_command<'c>(
&mut self,
w: &'c mut W,
cmd: &'c Command,
app_state: &mut AppState,
app_cmd_context: &'c AppCmdContext<'c>
) -> Result<CmdResult, ProgramError>
pub fn apply_command<'c>(
&mut self,
w: &'c mut W,
cmd: &'c Command,
app_state: &mut AppState,
app_cmd_context: &'c AppCmdContext<'c>
) -> Result<CmdResult, ProgramError>
apply a command on the current state, with no effect on screen
sourcepub fn refresh_input_status<'c>(
&mut self,
app_state: &AppState,
app_cmd_context: &'c AppCmdContext<'c>
)
pub fn refresh_input_status<'c>(
&mut self,
app_state: &AppState,
app_cmd_context: &'c AppCmdContext<'c>
)
called on focusing the panel and before the display, this updates the status from the command read in the input
sourcepub fn do_pending_task(
&mut self,
app_state: &mut AppState,
screen: Screen,
con: &AppContext,
dam: &mut Dam
) -> Result<(), ProgramError>
pub fn do_pending_task(
&mut self,
app_state: &mut AppState,
screen: Screen,
con: &AppContext,
dam: &mut Dam
) -> Result<(), ProgramError>
do the next pending task stopping as soon as there’s an event in the dam
pub fn has_pending_task(&self) -> bool
sourcepub fn add_event(
&mut self,
w: &mut W,
event: TimedEvent,
app_state: &AppState,
con: &AppContext
) -> Result<Command, ProgramError>
pub fn add_event(
&mut self,
w: &mut W,
event: TimedEvent,
app_state: &AppState,
con: &AppContext
) -> Result<Command, ProgramError>
return a new command Update the input field
pub fn push_state(&mut self, new_state: Box<dyn PanelState>)
pub fn mut_state(&mut self) -> &mut dyn PanelState
pub fn state(&self) -> &dyn PanelState
pub fn clear_input(&mut self)
sourcepub fn clear_input_invocation(&mut self, con: &AppContext)
pub fn clear_input_invocation(&mut self, con: &AppContext)
remove the verb invocation from the input but keep the filter if there’s one
pub fn set_input_content(&mut self, content: &str)
pub fn get_input_content(&self) -> String
sourcepub fn set_input_arg(&mut self, arg: String)
pub fn set_input_arg(&mut self, arg: String)
change the argument of the verb in the input, if there’s one
sourcepub fn remove_state(&mut self) -> bool
pub fn remove_state(&mut self) -> bool
return true when the element has been removed
sourcepub fn display(
&mut self,
w: &mut W,
disc: &DisplayContext<'_>
) -> Result<(), ProgramError>
pub fn display(
&mut self,
w: &mut W,
disc: &DisplayContext<'_>
) -> Result<(), ProgramError>
render the whole panel (state, status, purpose, input, flags)