Skip to main content

ViewMode

Trait ViewMode 

Source
pub trait ViewMode: Send {
    // Required methods
    fn describe(&self) -> ModeInfo;
    fn show(&mut self, ui: &mut Ui, cx: ModeContext<'_>) -> ModeOutput;
    fn step(&self, from: usize, count: usize, key: ModeKey) -> usize;

    // Provided methods
    fn travel(&self, _key: ModeKey) -> Option<Travel> { ... }
    fn toolbar(&mut self, _ui: &mut Ui, _settings: &mut ModeSettings) -> bool { ... }
    fn own_key(
        &mut self,
        _key: Key,
        _modifiers: Modifiers,
        _focus: Option<usize>,
        _settings: &mut ModeSettings,
    ) -> bool { ... }
}
Expand description

A way to show a browser’s entries. It draws and reports; selection rules, what Enter does and what a click on a folder does are the browser’s.

Required Methods§

Source

fn describe(&self) -> ModeInfo

Source

fn show(&mut self, ui: &mut Ui, cx: ModeContext<'_>) -> ModeOutput

Source

fn step(&self, from: usize, count: usize, key: ModeKey) -> usize

Where a key moves the focus from from, among count entries, in the layout last drawn.

Provided Methods§

Source

fn travel(&self, _key: ModeKey) -> Option<Travel>

Whether a key leaves the place rather than moving within it (Left and Right in Finder’s columns). None, the default, leaves the key to ViewMode::step.

Source

fn toolbar(&mut self, _ui: &mut Ui, _settings: &mut ModeSettings) -> bool

Draws the mode’s own controls in the browser’s toolbar, after the switcher (the agenda’s level). true when a setting changed.

Source

fn own_key( &mut self, _key: Key, _modifiers: Modifiers, _focus: Option<usize>, _settings: &mut ModeSettings, ) -> bool

A key of the mode’s own, beyond the arrows (Ctrl+Up in the agenda), pressed while the entry focus has the focus. true when taken: the browser then brings the focus into view and does nothing else with it.

Implementors§