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§
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)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".