pub struct CodeEditor {
    pub font_size: f32,
    pub cursor_pos: (usize, usize),
    pub cursor_rect: (usize, usize, usize, usize),
    pub mode: CodeEditorMode,
    pub theme: Theme,
    pub settings: Settings,
    pub drag_pos: Option<(usize, usize)>,
    /* private fields */
}

Fields§

§font_size: f32§cursor_pos: (usize, usize)§cursor_rect: (usize, usize, usize, usize)§mode: CodeEditorMode§theme: Theme§settings: Settings§drag_pos: Option<(usize, usize)>

Implementations§

source§

impl CodeEditor

source

pub fn new() -> Selfwhere Self: Sized,

source

pub fn set_font(&mut self, path: &str)

Sets the path to the font file

source

pub fn set_font_data(&mut self, font: Font)

Sets the font directly

source

pub fn set_font_size(&mut self, font_size: f32)

Sets the font size

source

pub fn set_text(&mut self, text: String)

Set the text / code to be edited

source

pub fn get_text(&mut self) -> String

Returns the edited text

source

pub fn set_theme(&mut self, theme: Theme)

source

pub fn set_error(&mut self, error: Option<(String, Option<usize>)>)

source

pub fn set_mode(&mut self, mode: CodeEditorMode)

Sets the mode of the editor

source

pub fn draw( &mut self, frame: &mut [u8], rect: (usize, usize, usize, usize), stride: usize )

source

pub fn set_cursor(&mut self, pos: (usize, usize))

Sets the cursor to the given position

source

pub fn key_down(&mut self, char: Option<char>, key: Option<WidgetKey>) -> bool

source

pub fn mouse_down(&mut self, p: (usize, usize)) -> bool

source

pub fn mouse_up(&mut self, _pos: (usize, usize)) -> bool

source

pub fn mouse_dragged(&mut self, pos: (usize, usize)) -> bool

source

pub fn mouse_hover(&mut self, _pos: (usize, usize)) -> bool

source

pub fn mouse_wheel(&mut self, delta: (isize, isize)) -> bool

source

pub fn modifier_changed( &mut self, shift: bool, ctrl: bool, alt: bool, logo: bool ) -> bool

source

pub fn cut(&mut self) -> String

source

pub fn copy(&mut self) -> String

source

pub fn paste(&mut self, text: String)

source

pub fn undo(&mut self)

Undo

source

pub fn redo(&mut self)

Redo

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.