Skip to main content

NoteUI

Trait NoteUI 

Source
pub trait NoteUI:
    ContentProvider
    + ContentLoader
    + 'static {
Show 18 methods // Required methods fn on_change(&mut self, f: Box<dyn FnMut() + 'static>); fn set_readonly(&mut self, readonly: bool); fn is_readonly(&self) -> bool; fn scroll_pos(&self) -> i32; fn set_scroll_pos(&mut self, pos: i32); fn set_bg_color(&mut self, color: Color); fn set_resizable(&self, wind: &mut Window); fn on_link_click(&mut self, f: Box<dyn Fn(String) + 'static>); fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; fn hide(&mut self); // Provided methods fn cursor_pos(&self) -> Option<DocumentPosition> { ... } fn set_cursor_pos(&mut self, _pos: DocumentPosition) { ... } fn on_link_hover(&mut self, _f: Box<dyn Fn(Option<String>) + 'static>) { ... } fn restyle(&mut self) { ... } fn tick(&mut self, _ms_since_start: u64) { ... } fn on_paragraph_style_change( &mut self, _f: Box<dyn FnMut(BlockType) + 'static>, ) { ... } fn take_focus(&mut self) { ... }
}
Expand description

A minimal UI abstraction layer for a note editor/viewer.

It unifies the interactions needed by main.rs so different implementations (e.g. StructuredRichUI) can be swapped without changing app logic.

Required Methods§

Source

fn on_change(&mut self, f: Box<dyn FnMut() + 'static>)

Source

fn set_readonly(&mut self, readonly: bool)

Source

fn is_readonly(&self) -> bool

Source

fn scroll_pos(&self) -> i32

Source

fn set_scroll_pos(&mut self, pos: i32)

Source

fn set_bg_color(&mut self, color: Color)

Source

fn set_resizable(&self, wind: &mut Window)

Source

fn as_any(&self) -> &dyn Any

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Source

fn hide(&mut self)

Provided Methods§

Source

fn cursor_pos(&self) -> Option<DocumentPosition>

Source

fn set_cursor_pos(&mut self, _pos: DocumentPosition)

Source

fn restyle(&mut self)

Source

fn tick(&mut self, _ms_since_start: u64)

Source

fn on_paragraph_style_change(&mut self, _f: Box<dyn FnMut(BlockType) + 'static>)

Source

fn take_focus(&mut self)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§