FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    RichEditBox

    struct · ferroui-controls · v0.5.0

    struct RichEditBox
    

    A structured rich-text editor rendered by FerroUI's text layout, drawing, and input APIs.

    The Document is shared with its persistent presenter and remains editable independently of this control. Read-only and length policies apply to user editing, clipboard, and IME; applications can replace the document directly. Every user operation goes through the same transaction engine, including formatting and accessible value changes.

    View source

    Members

    can_format

    fn can_format(self: &Self) -> bool
    

    Whether the UI should enable formatting commands. Programmatic formatting retains the normal editor error contract; disabled controls are not editable through their command flyout.

    Source

    bold_state

    fn bold_state(self: &Self) -> Option<bool>
    

    None denotes mixed bold formatting across the selection.

    Source

    italic_state

    fn italic_state(self: &Self) -> Option<bool>
    

    None denotes mixed italic formatting across the selection.

    Source

    underline_state

    fn underline_state(self: &Self) -> Option<bool>
    

    None denotes mixed underline formatting across the selection.

    Source

    is_bold

    fn is_bold(self: &Self) -> bool
    

    Checked only when every selected text run is bold.

    Source

    is_italic

    fn is_italic(self: &Self) -> bool
    

    Checked only when every selected text run is italic.

    Source

    is_underlined

    fn is_underlined(self: &Self) -> bool
    

    Checked only when every selected text run is underlined.

    Source

    toggle_bold

    fn toggle_bold(self: &Self) -> Result<(), EditError>
    

    Toggle bold for the entire selection; a mixed selection becomes bold.

    Source

    toggle_italic

    fn toggle_italic(self: &Self) -> Result<(), EditError>
    

    Toggle italic for the entire selection; a mixed selection becomes italic.

    Source

    toggle_underline

    fn toggle_underline(self: &Self) -> Result<(), EditError>
    

    Toggle underline in one undo transaction. Existing strike-through, overline and other decoration data remain specific to each selected run.

    Source

    context_menu_opening_event

    fn context_menu_opening_event() -> &'static RoutedEvent<ContextMenuEventArgs>
    

    Raised synchronously before a pointer, holding, or keyboard context request opens a menu. Handled cancels that request.

    Source

    context_menu_opening

    fn context_menu_opening(self: &Self, handler: impl Fn(&Interactive, &ContextMenuEventArgs) -> () + 'static) -> RoutedEventHandlerToken
    

    Source

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<RichEditBox>
    

    Returns a strong reference to this object.

    Source

    rich_document_property

    fn rich_document_property() -> &'static DirectProperty<RichEditBox, RichTextDocument>
    

    The shared document the editor edits (RichDocument, a FerroUI addition, D3). WinUI's Document is the text object model: RichEditBox::document.

    Source

    selection_start_property

    fn selection_start_property() -> &'static DirectProperty<RichEditBox, i32>
    

    Source

    selection_end_property

    fn selection_end_property() -> &'static DirectProperty<RichEditBox, i32>
    

    Source

    selected_text_property

    fn selected_text_property() -> &'static DirectProperty<RichEditBox, String>
    

    Source

    is_text_selection_enabled_property

    fn is_text_selection_enabled_property() -> &'static StyledProperty<bool>
    

    Source

    selection_highlight_color_property

    fn selection_highlight_color_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
    

    Source

    selection_highlight_color_when_not_focused_property

    fn selection_highlight_color_when_not_focused_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
    

    Source

    selection_foreground_brush_property

    fn selection_foreground_brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
    

    Source

    caret_brush_property

    fn caret_brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
    

    Source

    letter_spacing_property

    fn letter_spacing_property() -> &'static StyledProperty<f64>
    

    Source

    language_property

    fn language_property() -> &'static StyledProperty<ferroui_base::utilities::Locale>
    

    Source

    text_alignment_property

    fn text_alignment_property() -> &'static StyledProperty<TextAlignment>
    

    Source

    text_wrapping_property

    fn text_wrapping_property() -> &'static StyledProperty<TextWrapping>
    

    Source

    line_height_property

    fn line_height_property() -> &'static StyledProperty<f64>
    

    Source

    text_indent_property

    fn text_indent_property() -> &'static StyledProperty<f64>
    

    Source

    line_stacking_strategy_property

    fn line_stacking_strategy_property() -> &'static StyledProperty<LineStackingStrategy>
    

    Source

    text_decorations_property

    fn text_decorations_property() -> &'static StyledProperty<Option<TextDecorationCollection>>
    

    Source

    is_read_only_property

    fn is_read_only_property() -> &'static StyledProperty<bool>
    

    Source

    accepts_return_property

    fn accepts_return_property() -> &'static StyledProperty<bool>
    

    Source

    accepts_tab_property

    fn accepts_tab_property() -> &'static StyledProperty<bool>
    

    Source

    fn caret_blink_interval_property() -> &'static StyledProperty<Duration>
    

    Source

    max_length_property

    fn max_length_property() -> &'static StyledProperty<i32>
    

    Source

    clipboard_copy_format_property

    fn clipboard_copy_format_property() -> &'static StyledProperty<RichEditClipboardFormat>
    

    Source

    disabled_formatting_accelerators_property

    fn disabled_formatting_accelerators_property() -> &'static StyledProperty<DisabledFormattingAccelerators>
    

    Source

    character_casing_property

    fn character_casing_property() -> &'static StyledProperty<RichEditCharacterCasing>
    

    Source

    is_text_prediction_enabled_property

    fn is_text_prediction_enabled_property() -> &'static StyledProperty<bool>
    

    Source

    input_scope_property

    fn input_scope_property() -> &'static StyledProperty<Option<Ref<InputScope>>>
    

    Source

    placeholder_text_property

    fn placeholder_text_property() -> &'static StyledProperty<String>
    

    Source

    placeholder_foreground_property

    fn placeholder_foreground_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
    

    Source

    header_property

    fn header_property() -> &'static StyledProperty<Option<BoxedValue>>
    

    Source

    header_template_property

    fn header_template_property() -> &'static StyledProperty<Option<Rc<dyn IDataTemplate>>>
    

    Source

    description_property

    fn description_property() -> &'static StyledProperty<Option<BoxedValue>>
    

    Source

    is_undo_enabled_property

    fn is_undo_enabled_property() -> &'static StyledProperty<bool>
    

    Source

    undo_limit_property

    fn undo_limit_property() -> &'static StyledProperty<i32>
    

    Source

    can_undo_property

    fn can_undo_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    can_redo_property

    fn can_redo_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    can_copy_property

    fn can_copy_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    can_cut_property

    fn can_cut_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    can_paste_property

    fn can_paste_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    can_format_property

    fn can_format_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    bold_state_property

    fn bold_state_property() -> &'static DirectProperty<RichEditBox, Option<bool>>
    

    Source

    italic_state_property

    fn italic_state_property() -> &'static DirectProperty<RichEditBox, Option<bool>>
    

    Source

    underline_state_property

    fn underline_state_property() -> &'static DirectProperty<RichEditBox, Option<bool>>
    

    Source

    is_bold_property

    fn is_bold_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    is_italic_property

    fn is_italic_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    is_underlined_property

    fn is_underlined_property() -> &'static DirectProperty<RichEditBox, bool>
    

    Source

    text_property

    fn text_property() -> &'static DirectProperty<RichEditBox, String>
    

    Source

    construct

    fn construct() -> Self
    

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    TEMPLATE_PARTS

    const TEMPLATE_PARTS: &'static [TemplatePartAttribute]
    

    Source

    PSEUDO_CLASSES

    const PSEUDO_CLASSES: PseudoClassesAttribute
    

    Source

    text_presenter

    fn text_presenter(self: &Self) -> Ref<RichEditBoxTextPresenter>
    

    The persistent rich document view used by the current control template.

    Source

    content_element

    fn content_element(self: &Self) -> Option<Ref<Control>>
    

    The supported content host found in the applied template, if present.

    Source

    rich_document

    fn rich_document(self: &Self) -> RichTextDocument
    

    The shared document the editor edits (the property RichDocument, D3).

    Source

    set_rich_document

    fn set_rich_document(self: &Self, document: RichTextDocument)
    

    Sets the shared document the editor edits.

    Source

    try_set_rich_document

    fn try_set_rich_document(self: &Self, document: RichTextDocument) -> bool
    

    Attaches a shared document whose blocks no other view owns.

    Source

    document

    fn document(self: &Self) -> RichEditTextDocument
    

    WinUI's RichEditBox.Document: the text object model of the content, the same object text_document returns (docs/porting/winui-rich-text.md, D3).

    Source

    blocks

    fn blocks(self: &Self) -> BlockCollection
    

    Source

    text_highlighters

    fn text_highlighters(self: &Self) -> TextHighlighterCollection
    

    Source

    selection_start

    fn selection_start(self: &Self) -> usize
    

    Source

    set_selection_start

    fn set_selection_start(self: &Self, value: usize)
    

    Source

    selection_end

    fn selection_end(self: &Self) -> usize
    

    Source

    set_selection_end

    fn set_selection_end(self: &Self, value: usize)
    

    Source

    caret_index

    fn caret_index(self: &Self) -> usize
    

    Source

    select

    fn select(self: &Self, start: usize, end: usize)
    

    Source

    clear_selection

    fn clear_selection(self: &Self)
    

    Source

    selected_text

    fn selected_text(self: &Self) -> String
    

    Source

    selection_changed

    fn selection_changed(self: &Self, handler: impl Fn(&RichTextSelectionChangedEventArgs) -> () + 'static) -> Subscription
    

    Adds a handler of the changes of the selection.

    Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the box.

    Source

    is_text_selection_enabled

    fn is_text_selection_enabled(self: &Self) -> bool
    

    Source

    set_is_text_selection_enabled

    fn set_is_text_selection_enabled(self: &Self, value: bool)
    

    Source

    selection_highlight_color

    fn selection_highlight_color(self: &Self) -> Option<Rc<dyn IBrush>>
    

    Source

    set_selection_highlight_color

    fn set_selection_highlight_color(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    selection_highlight_color_when_not_focused

    fn selection_highlight_color_when_not_focused(self: &Self) -> Option<Rc<dyn IBrush>>
    

    Source

    set_selection_highlight_color_when_not_focused

    fn set_selection_highlight_color_when_not_focused(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    selection_foreground_brush

    fn selection_foreground_brush(self: &Self) -> Option<Rc<dyn IBrush>>
    

    Source

    set_selection_foreground_brush

    fn set_selection_foreground_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    caret_brush

    fn caret_brush(self: &Self) -> Option<Rc<dyn IBrush>>
    

    Source

    set_caret_brush

    fn set_caret_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    letter_spacing

    fn letter_spacing(self: &Self) -> f64
    

    Source

    language

    fn language(self: &Self) -> ferroui_base::utilities::Locale
    

    Source

    set_language

    fn set_language(self: &Self, value: ferroui_base::utilities::Locale)
    

    Source

    set_letter_spacing

    fn set_letter_spacing(self: &Self, value: f64)
    

    Source

    text_alignment

    fn text_alignment(self: &Self) -> TextAlignment
    

    Source

    set_text_alignment

    fn set_text_alignment(self: &Self, value: TextAlignment)
    

    Source

    text_wrapping

    fn text_wrapping(self: &Self) -> TextWrapping
    

    Source

    set_text_wrapping

    fn set_text_wrapping(self: &Self, value: TextWrapping)
    

    Source

    line_height

    fn line_height(self: &Self) -> f64
    

    Source

    set_line_height

    fn set_line_height(self: &Self, value: f64)
    

    Source

    text_indent

    fn text_indent(self: &Self) -> f64
    

    Source

    set_text_indent

    fn set_text_indent(self: &Self, value: f64)
    

    Source

    line_stacking_strategy

    fn line_stacking_strategy(self: &Self) -> LineStackingStrategy
    

    Source

    set_line_stacking_strategy

    fn set_line_stacking_strategy(self: &Self, value: LineStackingStrategy)
    

    Source

    text_decorations

    fn text_decorations(self: &Self) -> Option<TextDecorationCollection>
    

    Source

    set_text_decorations

    fn set_text_decorations(self: &Self, value: Option<TextDecorationCollection>)
    

    Source

    cursor_rectangle

    fn cursor_rectangle(self: &Self) -> Rect
    

    The caret rectangle in the owning control's coordinate system. The caret rectangle. While an edit is being published (TextChanging handlers and the input method run before the view takes the new selection) it is the caret of the editor, not the view's earlier one (#243 review, N4).

    Source

    get_rect_from_character_index

    fn get_rect_from_character_index(self: &Self, index: usize) -> Rect
    

    Source

    get_rect_from_text_position

    fn get_rect_from_text_position(self: &Self, position: TextPosition) -> Rect
    

    Source

    selection_rects

    fn selection_rects(self: &Self) -> Vec<Rect>
    

    Source

    get_rects_for_range

    fn get_rects_for_range(self: &Self, range: Range<usize>) -> Vec<Rect>
    

    Source

    hit_test_text_position

    fn hit_test_text_position(self: &Self, point: Point) -> usize
    

    Source

    line_metrics

    fn line_metrics(self: &Self) -> Vec<RichTextLineMetrics>
    

    Source

    is_read_only

    fn is_read_only(self: &Self) -> bool
    

    Source

    set_is_read_only

    fn set_is_read_only(self: &Self, value: bool)
    

    Source

    fn caret_blink_interval(self: &Self) -> Duration
    

    The framework caret period. Zero or a negative interval keeps the caret steady.

    Source

    fn set_caret_blink_interval(self: &Self, value: Duration)
    

    Source

    accepts_return

    fn accepts_return(self: &Self) -> bool
    

    Source

    set_accepts_return

    fn set_accepts_return(self: &Self, value: bool)
    

    Source

    accepts_tab

    fn accepts_tab(self: &Self) -> bool
    

    Source

    set_accepts_tab

    fn set_accepts_tab(self: &Self, value: bool)
    

    Source

    max_length

    fn max_length(self: &Self) -> usize
    

    Source

    set_max_length

    fn set_max_length(self: &Self, value: usize)
    

    Source

    clipboard_copy_format

    fn clipboard_copy_format(self: &Self) -> RichEditClipboardFormat
    

    Source

    set_clipboard_copy_format

    fn set_clipboard_copy_format(self: &Self, value: RichEditClipboardFormat)
    

    Source

    disabled_formatting_accelerators

    fn disabled_formatting_accelerators(self: &Self) -> DisabledFormattingAccelerators
    

    Source

    set_disabled_formatting_accelerators

    fn set_disabled_formatting_accelerators(self: &Self, value: DisabledFormattingAccelerators)
    

    Source

    character_casing

    fn character_casing(self: &Self) -> RichEditCharacterCasing
    

    Source

    set_character_casing

    fn set_character_casing(self: &Self, value: RichEditCharacterCasing)
    

    Source

    is_text_prediction_enabled

    fn is_text_prediction_enabled(self: &Self) -> bool
    

    Source

    set_is_text_prediction_enabled

    fn set_is_text_prediction_enabled(self: &Self, value: bool)
    

    Source

    input_scope

    fn input_scope(self: &Self) -> Option<Ref<InputScope>>
    

    Source

    set_input_scope

    fn set_input_scope(self: &Self, value: impl Into<Option<Ref<InputScope>>>)
    

    Source

    placeholder_text

    fn placeholder_text(self: &Self) -> String
    

    Source

    set_placeholder_text

    fn set_placeholder_text(self: &Self, value: impl Into<String>)
    

    Source

    placeholder_foreground

    fn placeholder_foreground(self: &Self) -> Option<Rc<dyn IBrush>>
    

    Source

    set_placeholder_foreground

    fn set_placeholder_foreground(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    header

    fn header(self: &Self) -> Option<BoxedValue>
    

    Source

    set_header

    fn set_header(self: &Self, value: Option<BoxedValue>)
    

    Source

    header_template

    fn header_template(self: &Self) -> Option<Rc<dyn IDataTemplate>>
    

    Source

    set_header_template

    fn set_header_template(self: &Self, value: Option<Rc<dyn IDataTemplate>>)
    

    Source

    description

    fn description(self: &Self) -> Option<BoxedValue>
    

    Source

    set_description

    fn set_description(self: &Self, value: Option<BoxedValue>)
    

    Source

    header_presenter

    fn header_presenter(self: &Self) -> Option<Ref<ContentPresenter>>
    

    The framework presenter for header data or a HeaderTemplate.

    Source

    description_presenter

    fn description_presenter(self: &Self) -> Option<Ref<ContentPresenter>>
    

    Source

    placeholder_presenter

    fn placeholder_presenter(self: &Self) -> Option<Ref<TextBlock>>
    

    Source

    is_undo_enabled

    fn is_undo_enabled(self: &Self) -> bool
    

    Source

    set_is_undo_enabled

    fn set_is_undo_enabled(self: &Self, value: bool)
    

    Source

    undo_limit

    fn undo_limit(self: &Self) -> usize
    

    Source

    set_undo_limit

    fn set_undo_limit(self: &Self, value: usize)
    

    Source

    can_undo

    fn can_undo(self: &Self) -> bool
    

    Source

    can_redo

    fn can_redo(self: &Self) -> bool
    

    Source

    can_copy

    fn can_copy(self: &Self) -> bool
    

    Source

    can_cut

    fn can_cut(self: &Self) -> bool
    

    Source

    can_paste

    fn can_paste(self: &Self) -> bool
    

    Source

    text

    fn text(self: &Self) -> String
    

    Source

    text_document

    fn text_document(self: &Self) -> RichEditTextDocument
    

    Text-object editing services sharing the view's document, selection, and undo history.

    Source

    set_text

    fn set_text(self: &Self, text: &str) -> Result<(), EditError>
    

    Replaces all content programmatically. The public document is not limited by the UI's input policies. Selection and user undo history are reset after replacement.

    Source

    editor

    fn editor(self: &Self) -> Rc<RichTextEditor>
    

    Source

    caret_visible

    fn caret_visible(self: &Self) -> bool
    

    Source

    insert_text

    fn insert_text(self: &Self, text: &str) -> Result<bool, EditError>
    

    Source

    replace_selection

    fn replace_selection(self: &Self, fragment: &DocumentSnapshot) -> Result<bool, EditError>
    

    Source

    delete_backward

    fn delete_backward(self: &Self, whole_word: bool) -> Result<bool, EditError>
    

    Source

    delete_forward

    fn delete_forward(self: &Self, whole_word: bool) -> Result<bool, EditError>
    

    Source

    apply_format

    fn apply_format(self: &Self, format: &CharacterFormat) -> Result<(), EditError>
    

    Source

    apply_paragraph_format

    fn apply_paragraph_format(self: &Self, format: &ParagraphFormat) -> Result<(), EditError>
    

    Source

    undo

    fn undo(self: &Self) -> Result<bool, EditError>
    

    Source

    redo

    fn redo(self: &Self) -> Result<bool, EditError>
    

    Source

    select_all

    fn select_all(self: &Self)
    

    Source

    set_preedit_text

    fn set_preedit_text(self: &Self, text: Option<&str>, cursor: Option<usize>) -> Result<(), EditError>
    

    Source

    cancel_composition

    fn cancel_composition(self: &Self) -> Result<bool, EditError>
    

    Source

    commit_composition

    fn commit_composition(self: &Self, text: &str) -> Result<bool, EditError>
    

    Source

    export_rtf

    fn export_rtf(self: &Self) -> Result<String, RtfError>
    

    Source

    import_rtf

    fn import_rtf(self: &Self, bytes: &[u8]) -> Result<(), Box<dyn std::error::Error>>
    

    Source

    copy

    fn copy(self: &Self)
    

    Source

    cut

    fn cut(self: &Self)
    

    Source

    paste

    fn paste(self: &Self)
    

    Source

    copy_to_clipboard_async

    fn copy_to_clipboard_async(self: &Self, clipboard: Rc<dyn IClipboard>, cut: bool) -> LocalBoxFuture<Result<(), ClipboardError>>
    

    Source

    paste_from_clipboard_async

    fn paste_from_clipboard_async(self: &Self, clipboard: Rc<dyn IClipboard>, plain_text_only: bool) -> LocalBoxFuture<Result<(), ClipboardError>>
    

    Source

    edit_failed

    fn edit_failed(self: &Self, handler: impl Fn(&EditError) -> () + 'static) -> Subscription
    

    Adds a handler of the edits that failed.

    Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the box.

    Source

    clipboard_failed

    fn clipboard_failed(self: &Self, handler: impl Fn(&ClipboardError) -> () + 'static) -> Subscription
    

    Adds a handler of the clipboard operations that failed.

    Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the box.

    Source

    text_input_method_client

    fn text_input_method_client(self: &Self) -> Rc<dyn TextInputMethodClient>
    

    Source

    selection_changed_event

    fn selection_changed_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Source

    text_changed_event

    fn text_changed_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Source

    text_changing_event

    fn text_changing_event() -> &'static RoutedEvent<RichEditBoxTextChangingEventArgs>
    

    Source

    selection_changing_event

    fn selection_changing_event() -> &'static RoutedEvent<RichEditBoxSelectionChangingEventArgs>
    

    Source

    copying_to_clipboard_event

    fn copying_to_clipboard_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Source

    cutting_to_clipboard_event

    fn cutting_to_clipboard_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Source

    pasting_from_clipboard_event

    fn pasting_from_clipboard_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Source

    text_composition_started_event

    fn text_composition_started_event() -> &'static RoutedEvent<RichEditCompositionEventArgs>
    

    Source

    text_composition_changed_event

    fn text_composition_changed_event() -> &'static RoutedEvent<RichEditCompositionEventArgs>
    

    Source

    text_composition_ended_event

    fn text_composition_ended_event() -> &'static RoutedEvent<RichEditCompositionEventArgs>
    

    Source

    text_changed

    fn text_changed(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
    

    Source

    text_changing

    fn text_changing(self: &Self, handler: impl Fn(&Interactive, &RichEditBoxTextChangingEventArgs) -> () + 'static) -> RoutedEventHandlerToken
    

    Source

    selection_changing

    fn selection_changing(self: &Self, handler: impl Fn(&Interactive, &RichEditBoxSelectionChangingEventArgs) -> () + 'static) -> RoutedEventHandlerToken
    

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.