pub enum Message {
Show 40 variants
CharacterInput(char),
Backspace,
Delete,
Enter,
Tab,
ArrowKey(ArrowDirection, bool),
MouseClick(Point),
MouseDrag(Point),
MouseRelease,
Copy,
Paste(String),
DeleteSelection,
Tick,
PageUp,
PageDown,
Home(bool),
End(bool),
CtrlHome,
CtrlEnd,
Scrolled(Viewport),
Undo,
Redo,
OpenSearch,
OpenSearchReplace,
CloseSearch,
SearchQueryChanged(String),
ReplaceQueryChanged(String),
ToggleCaseSensitive,
FindNext,
FindPrevious,
ReplaceNext,
ReplaceAll,
SearchDialogTab,
SearchDialogShiftTab,
CanvasFocusGained,
CanvasFocusLost,
ImeOpened,
ImePreedit(String, Option<Range<usize>>),
ImeCommit(String),
ImeClosed,
}Expand description
Messages emitted by the code editor
Variants§
CharacterInput(char)
Character typed
Backspace
Backspace pressed
Delete
Delete pressed
Enter
Enter pressed
Tab
Tab pressed (inserts 4 spaces)
ArrowKey(ArrowDirection, bool)
Arrow key pressed (direction, shift_pressed)
MouseClick(Point)
Mouse clicked at position
MouseDrag(Point)
Mouse drag for selection
MouseRelease
Mouse released
Copy
Copy selected text (Ctrl+C)
Paste(String)
Paste text from clipboard (Ctrl+V)
DeleteSelection
Delete selected text (Shift+Delete)
Tick
Request redraw for cursor blink
PageUp
Page Up pressed
PageDown
Page Down pressed
Home(bool)
Home key pressed (move to start of line, shift_pressed)
End(bool)
End key pressed (move to end of line, shift_pressed)
CtrlHome
Ctrl+Home pressed (move to start of document)
CtrlEnd
Ctrl+End pressed (move to end of document)
Scrolled(Viewport)
Viewport scrolled - track scroll position
Undo
Undo last operation (Ctrl+Z)
Redo
Redo last undone operation (Ctrl+Y)
OpenSearch
Open search dialog (Ctrl+F)
OpenSearchReplace
Open search and replace dialog (Ctrl+H)
CloseSearch
Close search dialog (Escape)
SearchQueryChanged(String)
Search query text changed
ReplaceQueryChanged(String)
Replace text changed
ToggleCaseSensitive
Toggle case sensitivity
FindNext
Find next match (F3)
FindPrevious
Find previous match (Shift+F3)
ReplaceNext
Replace current match
ReplaceAll
Replace all matches
SearchDialogTab
Tab pressed in search dialog (cycle forward)
SearchDialogShiftTab
Shift+Tab pressed in search dialog (cycle backward)
CanvasFocusGained
Canvas gained focus (mouse click)
CanvasFocusLost
Canvas lost focus (external widget interaction)
ImeOpened
IME input method opened
ImePreedit(String, Option<Range<usize>>)
IME pre-edit update (content, selection range)
ImeCommit(String)
IME commit text
ImeClosed
IME input method closed
Trait Implementations§
Source§impl Program<Message> for CodeEditor
impl Program<Message> for CodeEditor
Source§fn draw(
&self,
_state: &Self::State,
renderer: &Renderer,
_theme: &Theme,
bounds: Rectangle,
_cursor: Cursor,
) -> Vec<Geometry> ⓘ
fn draw( &self, _state: &Self::State, renderer: &Renderer, _theme: &Theme, bounds: Rectangle, _cursor: Cursor, ) -> Vec<Geometry> ⓘ
Renders the code editor’s visual elements on the canvas, including text layout, syntax highlighting, cursor positioning, and other graphical aspects.
§Arguments
state- The current state of the canvasrenderer- The renderer used for drawingtheme- The theme for stylingbounds- The rectangle bounds of the canvascursor- The mouse cursor position
§Returns
A vector of Geometry objects representing the drawn elements
Source§fn update(
&self,
_state: &mut Self::State,
event: &Event,
bounds: Rectangle,
cursor: Cursor,
) -> Option<Action<Message>>
fn update( &self, _state: &mut Self::State, event: &Event, bounds: Rectangle, cursor: Cursor, ) -> Option<Action<Message>>
Handles Canvas trait events, specifically keyboard input events and focus management for the code editor widget.
§Arguments
_state- The mutable state of the canvas (unused in this implementation)event- The input event to handle, such as keyboard pressesbounds- The rectangle bounds of the canvas widgetcursor- The current mouse cursor position and status
§Returns
An optional Action<Message> to perform, such as sending a message or redrawing the canvas
Source§fn mouse_interaction(
&self,
_state: &Self::State,
_bounds: Rectangle,
_cursor: Cursor,
) -> Interaction
fn mouse_interaction( &self, _state: &Self::State, _bounds: Rectangle, _cursor: Cursor, ) -> Interaction
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for 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
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>. 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> DowncastSync for T
impl<T> DowncastSync for T
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.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