pub struct RichEditHandle { /* private fields */ }Expand description
A cheap, cloneable handle to a shared RichEditCore, so a toolbar can
drive the same editor the widget renders. All mutating calls request a
redraw.
Implementations§
Source§impl RichEditHandle
impl RichEditHandle
Sourcepub fn exec(&self, cmd: &RichCommand)
pub fn exec(&self, cmd: &RichCommand)
Apply a formatting command through the shared core.
Sourcepub fn common_style_of_selection(&self) -> CommonStyle
pub fn common_style_of_selection(&self) -> CommonStyle
Summary of the styles under the current selection (drives toolbar state).
Sourcepub fn select_all(&self)
pub fn select_all(&self)
Select the whole document, then request a redraw.
Sourcepub fn set_caret(&self, pos: DocPos)
pub fn set_caret(&self, pos: DocPos)
Move the caret to pos (clamped onto a valid position), collapsing any
selection, and request a redraw.
Sourcepub fn set_selection(&self, range: DocRange)
pub fn set_selection(&self, range: DocRange)
Set the selection to range — range.start becomes the fixed anchor and
range.end the moving caret, each clamped onto a valid position — and
request a redraw.
Sourcepub fn selection(&self) -> DocRange
pub fn selection(&self) -> DocRange
The current selection (anchor → caret; collapsed when they coincide).
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
The document’s plain text (blocks joined by \n).
Sourcepub fn load(&self, doc: RichDoc)
pub fn load(&self, doc: RichDoc)
Replace the editor’s document with doc, resetting the caret to the
start and discarding the undo/redo history (the loaded document is
the new baseline). Requests a redraw.
Sourcepub fn begin_preview(&self)
pub fn begin_preview(&self)
Begin a live-preview session — see RichEditCore::begin_preview.
Call when a colour dialog opens, before any preview exec.
Sourcepub fn commit_preview(&self)
pub fn commit_preview(&self)
Commit the live preview (dialog’s Select) — see
RichEditCore::commit_preview.
Sourcepub fn cancel_preview(&self)
pub fn cancel_preview(&self)
Cancel the live preview (dialog’s Cancel / Escape / close) — restores
the state captured when the preview began. See
RichEditCore::cancel_preview.
Sourcepub fn is_previewing(&self) -> bool
pub fn is_previewing(&self) -> bool
Whether a live preview is currently active. Exposed so a host can assert (in tests) that every dialog-dismissal route unwinds the session.
Sourcepub fn is_preview_dirty(&self) -> bool
pub fn is_preview_dirty(&self) -> bool
Whether the active preview session has changed the document. The colour
dialog’s click-away handler reads this to decide whether to commit the
live change (one undo step) or cancel it silently. See
RichEditCore::is_preview_dirty.
Trait Implementations§
Source§impl Clone for RichEditHandle
impl Clone for RichEditHandle
Source§fn clone(&self) -> RichEditHandle
fn clone(&self) -> RichEditHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RichEditHandle
impl !Send for RichEditHandle
impl !Sync for RichEditHandle
impl !UnwindSafe for RichEditHandle
impl Freeze for RichEditHandle
impl Unpin for RichEditHandle
impl UnsafeUnpin for RichEditHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more