[][src]Trait broot::app::AppState

pub trait AppState {
    fn on_internal(
        &mut self,
        w: &mut W,
        internal_exec: &InternalExecution,
        input_invocation: Option<&VerbInvocation>,
        trigger_type: TriggerType,
        cc: &CmdContext,
        screen: &mut Screen
    ) -> Result<AppStateCmdResult, ProgramError>;
fn selected_path(&self) -> &Path;
fn selection(&self) -> Selection;
fn refresh(&mut self, screen: &Screen, con: &AppContext) -> Command;
fn display(
        &mut self,
        w: &mut W,
        screen: &Screen,
        state_area: Area,
        skin: &PanelSkin,
        con: &AppContext
    ) -> Result<(), ProgramError>;
fn no_verb_status(&self, has_pattern: bool, con: &AppContext) -> Status; fn clear_pending(&mut self) { ... }
fn on_click(
        &mut self,
        _x: u16,
        _y: u16,
        _screen: &mut Screen,
        _con: &AppContext
    ) -> Result<AppStateCmdResult, ProgramError> { ... }
fn on_double_click(
        &mut self,
        _x: u16,
        _y: u16,
        _screen: &mut Screen,
        _con: &AppContext
    ) -> Result<AppStateCmdResult, ProgramError> { ... }
fn on_pattern(
        &mut self,
        _pat: InputPattern,
        _con: &AppContext
    ) -> Result<AppStateCmdResult, ProgramError> { ... }
fn on_internal_generic(
        &mut self,
        _w: &mut W,
        internal_exec: &InternalExecution,
        input_invocation: Option<&VerbInvocation>,
        _trigger_type: TriggerType,
        cc: &CmdContext,
        screen: &mut Screen
    ) -> Result<AppStateCmdResult, ProgramError> { ... }
fn on_command(
        &mut self,
        w: &mut W,
        cc: &CmdContext,
        screen: &mut Screen
    ) -> Result<AppStateCmdResult, ProgramError> { ... }
fn do_pending_task(
        &mut self,
        _screen: &mut Screen,
        _con: &AppContext,
        _dam: &mut Dam
    ) { ... }
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 get_status(
        &self,
        cmd: &Command,
        other_path: &Option<PathBuf>,
        con: &AppContext
    ) -> Status { ... } }

a whole application state, stackable to allow reverting to a previous one

Required methods

fn on_internal(
    &mut self,
    w: &mut W,
    internal_exec: &InternalExecution,
    input_invocation: Option<&VerbInvocation>,
    trigger_type: TriggerType,
    cc: &CmdContext,
    screen: &mut Screen
) -> Result<AppStateCmdResult, 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 shorctut)

fn selected_path(&self) -> &Path

fn selection(&self) -> Selection

fn refresh(&mut self, screen: &Screen, con: &AppContext) -> Command

fn display(
    &mut self,
    w: &mut W,
    screen: &Screen,
    state_area: Area,
    skin: &PanelSkin,
    con: &AppContext
) -> Result<(), ProgramError>

fn no_verb_status(&self, has_pattern: bool, con: &AppContext) -> Status

return the status which should be used when there's no verb edited

Loading content...

Provided methods

fn clear_pending(&mut self)

called on start of on_command

fn on_click(
    &mut self,
    _x: u16,
    _y: u16,
    _screen: &mut Screen,
    _con: &AppContext
) -> Result<AppStateCmdResult, ProgramError>

fn on_double_click(
    &mut self,
    _x: u16,
    _y: u16,
    _screen: &mut Screen,
    _con: &AppContext
) -> Result<AppStateCmdResult, ProgramError>

fn on_pattern(
    &mut self,
    _pat: InputPattern,
    _con: &AppContext
) -> Result<AppStateCmdResult, ProgramError>

fn on_internal_generic(
    &mut self,
    _w: &mut W,
    internal_exec: &InternalExecution,
    input_invocation: Option<&VerbInvocation>,
    _trigger_type: TriggerType,
    cc: &CmdContext,
    screen: &mut Screen
) -> Result<AppStateCmdResult, ProgramError>

a generic implementation of on_internal which may be called by states when they don't have a specific behavior to execute

fn on_command(
    &mut self,
    w: &mut W,
    cc: &CmdContext,
    screen: &mut Screen
) -> Result<AppStateCmdResult, ProgramError>

change the state, does no rendering

fn do_pending_task(
    &mut self,
    _screen: &mut Screen,
    _con: &AppContext,
    _dam: &mut Dam
)

fn get_pending_task(&self) -> Option<&'static str>

fn get_flags(&self) -> Vec<Flag>

return the flags to display

fn get_starting_input(&self) -> String

fn set_selected_path(&mut self, _path: PathBuf, _con: &AppContext)

fn get_status(
    &self,
    cmd: &Command,
    other_path: &Option<PathBuf>,
    con: &AppContext
) -> Status

Loading content...

Implementors

impl AppState for BrowserState[src]

fn do_pending_task(
    &mut self,
    screen: &mut Screen,
    con: &AppContext,
    dam: &mut Dam
)
[src]

do some work, totally or partially, if there's some to do. Stop as soon as the dam asks for interruption

impl AppState for HelpState[src]

impl AppState for PreviewState[src]

fn do_pending_task(
    &mut self,
    _screen: &mut Screen,
    con: &AppContext,
    dam: &mut Dam
)
[src]

do the preview filtering if required and not yet done

Loading content...