Trait modalkit_ratatui::WindowOps

source ·
pub trait WindowOps<I: ApplicationInfo>: TerminalCursor {
    // Required methods
    fn dup(&self, store: &mut Store<I>) -> Self;
    fn close(&mut self, flags: CloseFlags, store: &mut Store<I>) -> bool;
    fn draw(
        &mut self,
        area: Rect,
        buf: &mut Buffer,
        focused: bool,
        store: &mut Store<I>
    );
    fn get_completions(&self) -> Option<CompletionList>;
    fn get_cursor_word(&self, style: &WordStyle) -> Option<String>;
    fn get_selected_word(&self) -> Option<String>;
    fn write(
        &mut self,
        path: Option<&str>,
        flags: WriteFlags,
        store: &mut Store<I>
    ) -> UIResult<EditInfo, I>;
}
Expand description

Trait to allow widgets to control how they get drawn onto the screen when they are either focused or unfocused.

Required Methods§

source

fn dup(&self, store: &mut Store<I>) -> Self

Create a copy of this window during a window split.

source

fn close(&mut self, flags: CloseFlags, store: &mut Store<I>) -> bool

Perform any necessary cleanup for this window and close it.

If this function returns false, it’s because the window cannot be closed, at least not with the provided set of flags.

source

fn draw( &mut self, area: Rect, buf: &mut Buffer, focused: bool, store: &mut Store<I> )

Draw this window into the buffer for the prescribed area.

source

fn get_completions(&self) -> Option<CompletionList>

Get completion candidates to show the user.

source

fn get_cursor_word(&self, style: &WordStyle) -> Option<String>

Returns the word following the current cursor position in this window.

source

fn get_selected_word(&self) -> Option<String>

Returns the currently selected text in this window.

source

fn write( &mut self, path: Option<&str>, flags: WriteFlags, store: &mut Store<I> ) -> UIResult<EditInfo, I>

Write the contents of the window.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<I> WindowOps<I> for TextBoxState<I>
where I: ApplicationInfo,

source§

impl<I, T> WindowOps<I> for ListState<T, I>
where T: ListItem<I>, I: ApplicationInfo,