TextHighlighter
struct · ferroui-controls · v0.5.0
struct TextHighlighter
Paints foreground and background over its ranges without editing text.
A null brush uses the view's TextControlHighlighterForeground or TextControlHighlighterBackground theme resource. As in WinUI, only solid color brushes are accepted. Mutable brushes and range changes invalidate all observing collections; observers never retain this object.
Members
TYPEto_refforeground_propertybackground_propertyconstructnewrangesforegroundbackgroundset_foregroundset_backgroundtry_set_foregroundtry_set_backgroundadd_childas_add_childinvalidated
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<TextHighlighter>
Returns a strong reference to this object.
foreground_property
fn foreground_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
background_property
fn background_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
construct
fn construct() -> Self
new
fn new() -> Ref<Self>
ranges
fn ranges(self: &Self) -> TextRangeCollection
foreground
fn foreground(self: &Self) -> Option<Rc<dyn IBrush>>
background
fn background(self: &Self) -> Option<Rc<dyn IBrush>>
set_foreground
fn set_foreground(self: &Self, value: Option<Rc<dyn IBrush>>) -> Result<(), TextHighlightError>
Sets a solid brush, returning a validation error without changing the previous value when supplied a different brush kind.
set_background
fn set_background(self: &Self, value: Option<Rc<dyn IBrush>>) -> Result<(), TextHighlightError>
try_set_foreground
fn try_set_foreground(self: &Self, value: Option<Rc<dyn IBrush>>) -> Result<(), TextHighlightError>
try_set_background
fn try_set_background(self: &Self, value: Option<Rc<dyn IBrush>>) -> Result<(), TextHighlightError>
add_child
fn add_child(self: &Self, range: TextHighlightRange)
as_add_child
fn as_add_child(this: Ref<Self>) -> Rc<dyn IAddChild<TextHighlightRange>>
invalidated
fn invalidated(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the highlighter.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyFerroObjectImplExtClassDefaultsErasedDestructorIntoEitherDerefUpcast<T>Upcast<TextHighlighter>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.