Skip to main content

StructuredRichUI

Struct StructuredRichUI 

Source
pub struct StructuredRichUI(pub FltkStructuredRichDisplay);
Expand description

NoteUI adapter for rutle’s Renderer + FLTK Group wrapper

Tuple Fields§

§0: FltkStructuredRichDisplay

Implementations§

Source§

impl StructuredRichUI

Source

pub fn new(x: i32, y: i32, w: i32, h: i32, edit_mode: bool) -> Self

Source

pub fn has_selection(&self) -> bool

Source

pub fn highlight_targets(&self) -> Vec<HighlightTarget>

The web-view highlights mirroring the editor’s selection: one HighlightTarget per top-level block (or list/checklist item) the selection touches, in document order. Empty when there is no selection, so a bare caret shows no highlight and double-clicking a word brings one back.

Source

pub fn cut_selection(&mut self) -> bool

Cut the current selection to the system clipboard (HTML + Markdown). Returns true if there was a selection that was cut.

Source

pub fn copy_selection(&self) -> bool

Copy the current selection to the system clipboard (HTML + Markdown). Returns true if there was a selection that was copied.

Source

pub fn paste_from_clipboard(&mut self)

Source

pub fn undo(&mut self) -> bool

Source

pub fn redo(&mut self) -> bool

Source

pub fn clear_formatting(&mut self) -> bool

Source

pub fn set_block_type(&mut self, block_type: BlockType) -> bool

Source

pub fn toggle_quote(&mut self) -> bool

Source

pub fn toggle_code_block(&mut self) -> bool

Source

pub fn toggle_list(&mut self) -> bool

Source

pub fn toggle_checklist(&mut self) -> bool

Source

pub fn toggle_ordered_list(&mut self) -> bool

Source

pub fn toggle_bold(&mut self) -> bool

Source

pub fn toggle_italic(&mut self) -> bool

Source

pub fn toggle_code(&mut self) -> bool

Source

pub fn toggle_strikethrough(&mut self) -> bool

Source

pub fn toggle_underline(&mut self) -> bool

Source

pub fn toggle_highlight(&mut self) -> bool

Source

pub fn current_block_type(&self) -> Option<BlockType>

Source

pub fn current_heading_anchor(&self) -> Option<String>

The anchor slug of the heading the caret is currently inside, or None when the caret is not in a heading. Duplicate headings are disambiguated exactly as Self::scroll_to_anchor resolves them, so the slug links back to this heading and not an earlier namesake.

Source

pub fn scroll_to_anchor(&mut self, anchor: &str) -> bool

Scroll so the heading whose anchor slug equals anchor sits near the top of the viewport. Returns false if no heading matches.

Source

pub fn scroll_to_block(&mut self, block_index: usize) -> bool

Scroll so top-level block block_index sits near the top of the viewport.

The renderer exposes no public block→pixel mapping, so this moves the caret into the target block and reuses the caret→pixel bridge (cursor_content_y) after a layout pass. Returns false if the index is out of range.

Source

pub fn set_horizontal_padding(&mut self, padding: i32)

Set horizontal padding (for write room mode)

Source

pub fn horizontal_padding(&self) -> i32

Get current horizontal padding

Source

pub fn reveal_codes(&self) -> bool

Whether reveal-codes mode is active (rutle’s inline-style tags, e.g. [Bold>…<Bold], shown inline).

Source

pub fn toggle_reveal_codes(&mut self) -> bool

Toggle reveal-codes mode, returning the new state. This is purely a view change — not a document edit — so it deliberately skips the change/undo machinery; the tags appearing inline are their own feedback.

Source

pub fn resize(&mut self, x: i32, y: i32, w: i32, h: i32)

Resize the editor widget

Source

pub fn height(&self) -> i32

Get current height

Source

pub fn width(&self) -> i32

Get current width

Source

pub fn x(&self) -> i32

Get current x position

Source

pub fn y(&self) -> i32

Get current y position

Source

pub fn search(&mut self, term: &str) -> usize

Perform a case-insensitive search for the given term

Clear the search state

Source

pub fn search_matches(&self) -> Vec<SearchMatch>

Get all search matches

Source

pub fn search_current_index(&self) -> Option<usize>

Get the current match index

Source

pub fn next_match(&mut self) -> bool

Move to the next match

Source

pub fn prev_match(&mut self) -> bool

Move to the previous match

Source

pub fn scroll_to_current_match(&mut self)

Scroll to make the current match visible

Source

pub fn take_focus(&mut self)

Focus the editor widget

Trait Implementations§

Source§

impl ContentLoader for StructuredRichUI

Source§

fn set_content_from_markdown(&mut self, markdown: &str)

Source§

impl ContentProvider for StructuredRichUI

Source§

impl NoteUI for StructuredRichUI

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 cursor_pos(&self) -> Option<DocumentPosition>

Source§

fn set_cursor_pos(&mut self, pos: DocumentPosition)

Source§

fn set_bg_color(&mut self, color: Color)

Source§

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

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 as_any(&self) -> &dyn Any

Source§

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

Source§

fn hide(&mut self)

Source§

fn take_focus(&mut self)

Source§

fn restyle(&mut self)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.