TextPresenter
struct · ferroui-controls · v0.5.0
struct TextPresenter
The control that displays the text of a text box: the text, the selection, the pre-edit text of an input method and the caret.
Every text position (CaretIndex, SelectionStart, SelectionEnd, the
positions of CharacterHit) is a UTF-16 code unit index.
Members
TYPEto_refcreate_text_layoutinvalidate_text_layouttext_paragraph_styles_propertytext_style_overrides_propertyshow_selection_highlight_propertycaret_index_propertyreveal_password_propertypassword_char_propertyselection_brush_propertyselection_foreground_brush_propertycaret_brush_propertycaret_blink_interval_propertyselection_start_propertyselection_end_propertytext_propertypreedit_text_propertypreedit_text_cursor_position_propertytext_alignment_propertytext_wrapping_propertyline_height_propertyletter_spacing_propertybackground_propertyconstructnewcaret_bounds_changedbackgroundset_backgroundshow_selection_highlightset_show_selection_highlighttextset_textpreedit_textset_preedit_textpreedit_text_cursor_positionset_preedit_text_cursor_positiontext_style_overridestext_paragraph_stylesset_text_paragraph_stylesset_text_style_overridesfont_familyset_font_familyfont_featuresset_font_featuresfont_sizeset_font_sizefont_styleset_font_stylefont_weightset_font_weightfont_stretchset_font_stretchforegroundset_foregroundtext_wrappingset_text_wrappingline_heightset_line_heightletter_spacingset_letter_spacingtext_alignmentset_text_alignmenttext_layoutcaret_indexset_caret_indexcursor_rectanglepassword_charset_password_charreveal_passwordset_reveal_passwordselection_brushset_selection_brushselection_foreground_brushset_selection_foreground_brushcaret_brushset_caret_brushcaret_blink_intervalset_caret_blink_intervalselection_startset_selection_startselection_endset_selection_endcurrent_im_clientset_current_im_clientshow_carethide_caretmove_caret_to_text_positionmove_caret_to_pointmove_caret_verticalget_next_character_hitmove_caret_horizontal
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<TextPresenter>
Returns a strong reference to this object.
create_text_layout
fn create_text_layout(self: &Self) -> Rc<TextLayout>
Creates the TextLayout used to render the text.
invalidate_text_layout
fn invalidate_text_layout(self: &Self)
Drops the text layout and the shaped runs it was built from.
text_paragraph_styles_property
fn text_paragraph_styles_property() -> &'static StyledProperty<Option<TextParagraphStyles>>
Defines the TextParagraphStyles property.
text_style_overrides_property
fn text_style_overrides_property() -> &'static StyledProperty<Option<TextStyleOverrides>>
Defines the TextStyleOverrides property.
show_selection_highlight_property
fn show_selection_highlight_property() -> &'static StyledProperty<bool>
Defines the ShowSelectionHighlight property.
caret_index_property
fn caret_index_property() -> &'static StyledProperty<i32>
Defines the CaretIndex property.
reveal_password_property
fn reveal_password_property() -> &'static StyledProperty<bool>
Defines the RevealPassword property.
password_char_property
fn password_char_property() -> &'static StyledProperty<char>
Defines the PasswordChar property.
selection_brush_property
fn selection_brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
Defines the SelectionBrush property.
selection_foreground_brush_property
fn selection_foreground_brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
Defines the SelectionForegroundBrush property.
caret_brush_property
fn caret_brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
Defines the CaretBrush property.
caret_blink_interval_property
fn caret_blink_interval_property() -> &'static StyledProperty<Duration>
Defines the CaretBlinkInterval property.
selection_start_property
fn selection_start_property() -> &'static StyledProperty<i32>
Defines the SelectionStart property.
selection_end_property
fn selection_end_property() -> &'static StyledProperty<i32>
Defines the SelectionEnd property.
text_property
fn text_property() -> &'static StyledProperty<Option<String>>
Defines the Text property.
preedit_text_property
fn preedit_text_property() -> &'static StyledProperty<Option<String>>
Defines the PreeditText property.
preedit_text_cursor_position_property
fn preedit_text_cursor_position_property() -> &'static StyledProperty<Option<i32>>
Defines the PreeditTextCursorPosition property.
text_alignment_property
fn text_alignment_property() -> &'static AttachedProperty<TextAlignment>
Defines the TextAlignment property.
text_wrapping_property
fn text_wrapping_property() -> &'static AttachedProperty<TextWrapping>
Defines the TextWrapping property.
line_height_property
fn line_height_property() -> &'static AttachedProperty<f64>
Defines the LineHeight property.
letter_spacing_property
fn letter_spacing_property() -> &'static AttachedProperty<f64>
Defines the LetterSpacing property.
background_property
fn background_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
Defines the Background property.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
Initializes a new instance of the TextPresenter class.
caret_bounds_changed
fn caret_bounds_changed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Occurs when the bounds of the caret change.
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the presenter.
background
fn background(self: &Self) -> Option<Rc<dyn IBrush>>
A brush used to paint the control's background.
set_background
fn set_background(self: &Self, value: Option<Rc<dyn IBrush>>)
show_selection_highlight
fn show_selection_highlight(self: &Self) -> bool
Whether the presenter shows a selection highlight.
set_show_selection_highlight
fn set_show_selection_highlight(self: &Self, value: bool)
text
fn text(self: &Self) -> Option<String>
The text.
set_text
fn set_text(self: &Self, value: Option<&str>)
preedit_text
fn preedit_text(self: &Self) -> Option<String>
The text an input method is composing, displayed at the caret.
set_preedit_text
fn set_preedit_text(self: &Self, value: Option<&str>)
preedit_text_cursor_position
fn preedit_text_cursor_position(self: &Self) -> Option<i32>
The position of the cursor within the pre-edit text.
set_preedit_text_cursor_position
fn set_preedit_text_cursor_position(self: &Self, value: Option<i32>)
text_style_overrides
fn text_style_overrides(self: &Self) -> Option<TextStyleOverrides>
Complete run properties at UTF-16 ranges of committed Text.
text_paragraph_styles
fn text_paragraph_styles(self: &Self) -> Option<TextParagraphStyles>
set_text_paragraph_styles
fn set_text_paragraph_styles(self: &Self, value: Option<TextParagraphStyles>)
set_text_style_overrides
fn set_text_style_overrides(self: &Self, value: Option<TextStyleOverrides>)
Selection colors and IME decorations preserve these properties. The collection is immutable; assign a new one after editing the text.
font_family
fn font_family(self: &Self) -> FontFamily
The font family.
set_font_family
fn set_font_family(self: &Self, value: FontFamily)
font_features
fn font_features(self: &Self) -> Option<FontFeatureCollection>
The font features.
set_font_features
fn set_font_features(self: &Self, value: Option<FontFeatureCollection>)
font_size
fn font_size(self: &Self) -> f64
The font size.
set_font_size
fn set_font_size(self: &Self, value: f64)
font_style
fn font_style(self: &Self) -> FontStyle
The font style.
set_font_style
fn set_font_style(self: &Self, value: FontStyle)
font_weight
fn font_weight(self: &Self) -> FontWeight
The font weight.
set_font_weight
fn set_font_weight(self: &Self, value: FontWeight)
font_stretch
fn font_stretch(self: &Self) -> FontStretch
The font stretch.
set_font_stretch
fn set_font_stretch(self: &Self, value: FontStretch)
foreground
fn foreground(self: &Self) -> Option<Rc<dyn IBrush>>
A brush used to paint the text.
set_foreground
fn set_foreground(self: &Self, value: Option<Rc<dyn IBrush>>)
text_wrapping
fn text_wrapping(self: &Self) -> TextWrapping
The control's text wrapping mode.
set_text_wrapping
fn set_text_wrapping(self: &Self, value: TextWrapping)
line_height
fn line_height(self: &Self) -> f64
The line height. By default, this is set to NaN, which determines the appropriate height automatically.
set_line_height
fn set_line_height(self: &Self, value: f64)
letter_spacing
fn letter_spacing(self: &Self) -> f64
The letter spacing.
set_letter_spacing
fn set_letter_spacing(self: &Self, value: f64)
text_alignment
fn text_alignment(self: &Self) -> TextAlignment
The text alignment.
set_text_alignment
fn set_text_alignment(self: &Self, value: TextAlignment)
text_layout
fn text_layout(self: &Self) -> Rc<TextLayout>
The TextLayout used to render the text.
caret_index
fn caret_index(self: &Self) -> i32
set_caret_index
fn set_caret_index(self: &Self, value: i32)
cursor_rectangle
fn cursor_rectangle(self: &Self) -> Rect
The caret rectangle relative to this presenter.
The rectangle has zero width. Its X/Y position and height describe the caret location within the presenter's text layout coordinates.
password_char
fn password_char(self: &Self) -> char
The character displayed in place of every character of the text
('\0': none).
set_password_char
fn set_password_char(self: &Self, value: char)
reveal_password
fn reveal_password(self: &Self) -> bool
set_reveal_password
fn set_reveal_password(self: &Self, value: bool)
selection_brush
fn selection_brush(self: &Self) -> Option<Rc<dyn IBrush>>
set_selection_brush
fn set_selection_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
selection_foreground_brush
fn selection_foreground_brush(self: &Self) -> Option<Rc<dyn IBrush>>
set_selection_foreground_brush
fn set_selection_foreground_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
caret_brush
fn caret_brush(self: &Self) -> Option<Rc<dyn IBrush>>
set_caret_brush
fn set_caret_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
caret_blink_interval
fn caret_blink_interval(self: &Self) -> Duration
The caret blink rate.
set_caret_blink_interval
fn set_caret_blink_interval(self: &Self, value: Duration)
selection_start
fn selection_start(self: &Self) -> i32
set_selection_start
fn set_selection_start(self: &Self, value: i32)
selection_end
fn selection_end(self: &Self) -> i32
set_selection_end
fn set_selection_end(self: &Self, value: i32)
current_im_client
fn current_im_client(self: &Self) -> Option<Rc<TextBoxTextInputMethodClient>>
The input method client that currently edits the text of the presenter. The client refers to the presenter, so the presenter refers to it weakly.
set_current_im_client
fn set_current_im_client(self: &Self, value: Option<Rc<TextBoxTextInputMethodClient>>)
show_caret
fn show_caret(self: &Self)
hide_caret
fn hide_caret(self: &Self)
move_caret_to_text_position
fn move_caret_to_text_position(self: &Self, text_position: i32, trailing_edge: bool)
move_caret_to_point
fn move_caret_to_point(self: &Self, point: Point)
move_caret_vertical
fn move_caret_vertical(self: &Self, direction: LogicalDirection)
get_next_character_hit
fn get_next_character_hit(self: &Self, direction: LogicalDirection) -> CharacterHit
move_caret_horizontal
fn move_caret_horizontal(self: &Self, direction: LogicalDirection)
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTextPresenterImplExtControlImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDropDerefUpcast<T>Upcast<TextPresenter>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleInteractiveImplInputElementImplControlImplStyledElementImplFerroObjectImplVisualImplLayoutableImplTextPresenterImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.