pub struct Editor<'a, Message> { /* private fields */ }Expand description
The editor widget. Borrows the document to draw; publishes Actions.
Implementations§
Source§impl<'a, Message> Editor<'a, Message>
impl<'a, Message> Editor<'a, Message>
Sourcepub fn new(
doc: &'a Document,
on_action: impl Fn(Action) -> Message + 'a,
) -> Self
pub fn new( doc: &'a Document, on_action: impl Fn(Action) -> Message + 'a, ) -> Self
An editor rendering doc; on_action(action) is published for each
input the widget interprets. Defaults to Font::MONOSPACE at 14 px.
Sourcepub fn popup(self, popup: Option<&'a PopupList>) -> Self
pub fn popup(self, popup: Option<&'a PopupList>) -> Self
Supply the open completion popup to render over the editor. The app
holds the completion controller and passes its PopupList here each
frame; None when no popup is open.
Sourcepub fn snippet_active(self, active: bool) -> Self
pub fn snippet_active(self, active: bool) -> Self
Tell the editor a snippet session is active, so it captures Tab / Shift+Tab / Escape to drive it (the app owns the session).
Sourcepub fn signature(self, signature: Option<&'a SignatureInfo>) -> Self
pub fn signature(self, signature: Option<&'a SignatureInfo>) -> Self
Supply the active signature-help box to render above the caret.
Sourcepub fn hover(self, hover: Option<&'a HoverInfo>) -> Self
pub fn hover(self, hover: Option<&'a HoverInfo>) -> Self
Supply the open hover popup to render at the hovered word.
Sourcepub fn id(self, id: impl Into<Id>) -> Self
pub fn id(self, id: impl Into<Id>) -> Self
Give the editor a widget Id so the application can move
keyboard focus to it through iced’s focus operations (focus,
focus_next, …) — the addressing half of the focus protocol a multi-pane
host needs. Without an id the editor can be unfocused by a focus
elsewhere but never targeted by one (a None id never matches).
Sourcepub fn font(self, font: Font) -> Self
pub fn font(self, font: Font) -> Self
Set the (monospace) font. The cell advance is re-measured for it.
Sourcepub fn text_size(self, size: f32) -> Self
pub fn text_size(self, size: f32) -> Self
Set the font size in logical pixels; the row height follows unless later
overridden with Editor::line_height.
Sourcepub fn line_height(self, line_height: f32) -> Self
pub fn line_height(self, line_height: f32) -> Self
Override the row height in logical pixels.
Trait Implementations§
Source§impl<Message> Widget<Message, Theme, Renderer<Renderer, Renderer>> for Editor<'_, Message>
impl<Message> Widget<Message, Theme, Renderer<Renderer, Renderer>> for Editor<'_, Message>
Source§fn operate(
&mut self,
tree: &mut Tree,
layout: Layout<'_>,
_renderer: &Renderer,
operation: &mut dyn Operation,
)
fn operate( &mut self, tree: &mut Tree, layout: Layout<'_>, _renderer: &Renderer, operation: &mut dyn Operation, )
Source§fn draw(
&self,
tree: &Tree,
renderer: &mut Renderer,
theme: &Theme,
_style: &Style,
layout: Layout<'_>,
cursor: Cursor,
_viewport: &Rectangle,
)
fn draw( &self, tree: &Tree, renderer: &mut Renderer, theme: &Theme, _style: &Style, layout: Layout<'_>, cursor: Cursor, _viewport: &Rectangle, )
Widget using the associated Renderer.Source§fn update(
&mut self,
tree: &mut Tree,
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
_renderer: &Renderer,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
_viewport: &Rectangle,
)
fn update( &mut self, tree: &mut Tree, event: &Event, layout: Layout<'_>, cursor: Cursor, _renderer: &Renderer, clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, _viewport: &Rectangle, )
Source§fn mouse_interaction(
&self,
tree: &Tree,
layout: Layout<'_>,
cursor: Cursor,
_viewport: &Rectangle,
_renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, tree: &Tree, layout: Layout<'_>, cursor: Cursor, _viewport: &Rectangle, _renderer: &Renderer, ) -> Interaction
Auto Trait Implementations§
impl<'a, Message> !RefUnwindSafe for Editor<'a, Message>
impl<'a, Message> !Send for Editor<'a, Message>
impl<'a, Message> !Sync for Editor<'a, Message>
impl<'a, Message> !UnwindSafe for Editor<'a, Message>
impl<'a, Message> Freeze for Editor<'a, Message>
impl<'a, Message> Unpin for Editor<'a, Message>
impl<'a, Message> UnsafeUnpin for Editor<'a, Message>
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> 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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.