Trait broot::app::PanelState
source · pub trait PanelState {
Show 35 methods
// Required methods
fn get_type(&self) -> PanelStateType;
fn set_mode(&mut self, mode: Mode);
fn get_mode(&self) -> Mode;
fn on_internal(
&mut self,
w: &mut W,
internal_exec: &InternalExecution,
input_invocation: Option<&VerbInvocation>,
trigger_type: TriggerType<'_>,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>;
fn selected_path(&self) -> Option<&Path>;
fn selection(&self) -> Option<Selection<'_>>;
fn refresh(&mut self, screen: Screen, con: &AppContext) -> Command;
fn tree_options(&self) -> TreeOptions;
fn with_new_options(
&mut self,
screen: Screen,
change_options: &dyn Fn(&mut TreeOptions) -> &'static str,
in_new_panel: bool,
con: &AppContext
) -> CmdResult;
fn display(
&mut self,
w: &mut W,
disc: &DisplayContext<'_>
) -> Result<(), ProgramError>;
// Provided methods
fn clear_pending(&mut self) { ... }
fn on_click(
&mut self,
_x: u16,
_y: u16,
_screen: Screen,
_con: &AppContext
) -> Result<CmdResult, ProgramError> { ... }
fn on_double_click(
&mut self,
_x: u16,
_y: u16,
_screen: Screen,
_con: &AppContext
) -> Result<CmdResult, ProgramError> { ... }
fn on_pattern(
&mut self,
_pat: InputPattern,
_app_state: &AppState,
_con: &AppContext
) -> Result<CmdResult, ProgramError> { ... }
fn on_mode_verb(&mut self, mode: Mode, con: &AppContext) -> CmdResult { ... }
fn on_internal_generic(
&mut self,
_w: &mut W,
internal_exec: &InternalExecution,
input_invocation: Option<&VerbInvocation>,
_trigger_type: TriggerType<'_>,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError> { ... }
fn stage(
&self,
app_state: &mut AppState,
cc: &CmdContext<'_>,
con: &AppContext
) -> CmdResult { ... }
fn unstage(
&self,
app_state: &mut AppState,
cc: &CmdContext<'_>,
_con: &AppContext
) -> CmdResult { ... }
fn toggle_stage(
&self,
app_state: &mut AppState,
cc: &CmdContext<'_>,
con: &AppContext
) -> CmdResult { ... }
fn execute_verb(
&mut self,
w: &mut W,
verb: &Verb,
invocation: Option<&VerbInvocation>,
trigger_type: TriggerType<'_>,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError> { ... }
fn execute_external(
&mut self,
w: &mut W,
verb: &Verb,
external_execution: &ExternalExecution,
invocation: Option<&VerbInvocation>,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError> { ... }
fn execute_sequence(
&mut self,
_w: &mut W,
verb: &Verb,
seq_ex: &SequenceExecution,
invocation: Option<&VerbInvocation>,
app_state: &mut AppState,
_cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError> { ... }
fn on_command(
&mut self,
w: &mut W,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError> { ... }
fn open_preview(
&mut self,
preferred_mode: Option<PreviewMode>,
close_if_open: bool,
cc: &CmdContext<'_>
) -> CmdResult { ... }
fn tree_root(&self) -> Option<&Path> { ... }
fn sel_info<'c>(&'c self, _app_state: &'c AppState) -> SelInfo<'c> { ... }
fn has_at_least_one_selection(&self, _app_state: &AppState) -> bool { ... }
fn do_pending_task(
&mut self,
_app_state: &mut AppState,
_screen: Screen,
_con: &AppContext,
_dam: &mut Dam
) -> Result<(), ProgramError> { ... }
fn get_pending_task(&self) -> Option<&'static str> { ... }
fn get_flags(&self) -> Vec<Flag> { ... }
fn get_starting_input(&self) -> String { ... }
fn set_selected_path(&mut self, _path: PathBuf, _con: &AppContext) { ... }
fn no_verb_status(
&self,
_has_previous_state: bool,
_con: &AppContext
) -> Status { ... }
fn get_status(
&self,
app_state: &AppState,
cc: &CmdContext<'_>,
has_previous_state: bool
) -> Status { ... }
fn get_verb_status(
&self,
verb: &Verb,
invocation: &VerbInvocation,
sel_info: SelInfo<'_>,
_cc: &CmdContext<'_>,
app_state: &AppState
) -> Status { ... }
}
Expand description
a panel state, stackable to allow reverting to a previous one
Required Methods§
fn get_type(&self) -> PanelStateType
fn set_mode(&mut self, mode: Mode)
fn get_mode(&self) -> Mode
sourcefn on_internal(
&mut self,
w: &mut W,
internal_exec: &InternalExecution,
input_invocation: Option<&VerbInvocation>,
trigger_type: TriggerType<'_>,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn on_internal( &mut self, w: &mut W, internal_exec: &InternalExecution, input_invocation: Option<&VerbInvocation>, trigger_type: TriggerType<'_>, app_state: &mut AppState, cc: &CmdContext<'_> ) -> Result<CmdResult, ProgramError>
execute the internal with the optional given invocation.
The invocation comes from the input and may be related to a different verb (the verb may have been triggered by a key shortcut)
fn selected_path(&self) -> Option<&Path>
fn selection(&self) -> Option<Selection<'_>>
fn refresh(&mut self, screen: Screen, con: &AppContext) -> Command
fn tree_options(&self) -> TreeOptions
sourcefn with_new_options(
&mut self,
screen: Screen,
change_options: &dyn Fn(&mut TreeOptions) -> &'static str,
in_new_panel: bool,
con: &AppContext
) -> CmdResult
fn with_new_options( &mut self, screen: Screen, change_options: &dyn Fn(&mut TreeOptions) -> &'static str, in_new_panel: bool, con: &AppContext ) -> CmdResult
Build a cmdResult in response to a command being a change of tree options. This may or not be a new state.
The provided change_options
function returns a status message
explaining the change
fn display( &mut self, w: &mut W, disc: &DisplayContext<'_> ) -> Result<(), ProgramError>
Provided Methods§
sourcefn clear_pending(&mut self)
fn clear_pending(&mut self)
called on start of on_command
fn on_click( &mut self, _x: u16, _y: u16, _screen: Screen, _con: &AppContext ) -> Result<CmdResult, ProgramError>
fn on_double_click( &mut self, _x: u16, _y: u16, _screen: Screen, _con: &AppContext ) -> Result<CmdResult, ProgramError>
fn on_pattern( &mut self, _pat: InputPattern, _app_state: &AppState, _con: &AppContext ) -> Result<CmdResult, ProgramError>
fn on_mode_verb(&mut self, mode: Mode, con: &AppContext) -> CmdResult
sourcefn on_internal_generic(
&mut self,
_w: &mut W,
internal_exec: &InternalExecution,
input_invocation: Option<&VerbInvocation>,
_trigger_type: TriggerType<'_>,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn on_internal_generic( &mut self, _w: &mut W, internal_exec: &InternalExecution, input_invocation: Option<&VerbInvocation>, _trigger_type: TriggerType<'_>, app_state: &mut AppState, cc: &CmdContext<'_> ) -> Result<CmdResult, ProgramError>
a generic implementation of on_internal which may be called by states when they don’t have a specific behavior to execute
fn stage( &self, app_state: &mut AppState, cc: &CmdContext<'_>, con: &AppContext ) -> CmdResult
fn unstage( &self, app_state: &mut AppState, cc: &CmdContext<'_>, _con: &AppContext ) -> CmdResult
fn toggle_stage( &self, app_state: &mut AppState, cc: &CmdContext<'_>, con: &AppContext ) -> CmdResult
fn execute_verb( &mut self, w: &mut W, verb: &Verb, invocation: Option<&VerbInvocation>, trigger_type: TriggerType<'_>, app_state: &mut AppState, cc: &CmdContext<'_> ) -> Result<CmdResult, ProgramError>
fn execute_external( &mut self, w: &mut W, verb: &Verb, external_execution: &ExternalExecution, invocation: Option<&VerbInvocation>, app_state: &mut AppState, cc: &CmdContext<'_> ) -> Result<CmdResult, ProgramError>
fn execute_sequence( &mut self, _w: &mut W, verb: &Verb, seq_ex: &SequenceExecution, invocation: Option<&VerbInvocation>, app_state: &mut AppState, _cc: &CmdContext<'_> ) -> Result<CmdResult, ProgramError>
sourcefn on_command(
&mut self,
w: &mut W,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn on_command( &mut self, w: &mut W, app_state: &mut AppState, cc: &CmdContext<'_> ) -> Result<CmdResult, ProgramError>
change the state, does no rendering
sourcefn open_preview(
&mut self,
preferred_mode: Option<PreviewMode>,
close_if_open: bool,
cc: &CmdContext<'_>
) -> CmdResult
fn open_preview( &mut self, preferred_mode: Option<PreviewMode>, close_if_open: bool, cc: &CmdContext<'_> ) -> CmdResult
return a cmdresult asking for the opening of a preview
fn sel_info<'c>(&'c self, _app_state: &'c AppState) -> SelInfo<'c>
fn has_at_least_one_selection(&self, _app_state: &AppState) -> bool
fn do_pending_task( &mut self, _app_state: &mut AppState, _screen: Screen, _con: &AppContext, _dam: &mut Dam ) -> Result<(), ProgramError>
fn get_pending_task(&self) -> Option<&'static str>
fn get_starting_input(&self) -> String
fn set_selected_path(&mut self, _path: PathBuf, _con: &AppContext)
sourcefn no_verb_status(&self, _has_previous_state: bool, _con: &AppContext) -> Status
fn no_verb_status(&self, _has_previous_state: bool, _con: &AppContext) -> Status
return the status which should be used when there’s no verb edited