pub struct TextEditor { /* private fields */ }Expand description
Text editor state
Implementations§
Source§impl TextEditor
impl TextEditor
Sourcepub fn new(file_path: Option<String>) -> Result<Self, KernelError>
pub fn new(file_path: Option<String>) -> Result<Self, KernelError>
Create a new text editor
Sourcepub fn load_file(&mut self, path: &str) -> Result<(), KernelError>
pub fn load_file(&mut self, path: &str) -> Result<(), KernelError>
Load file from filesystem
Sourcepub fn save_file(&mut self) -> Result<(), KernelError>
pub fn save_file(&mut self) -> Result<(), KernelError>
Save file to filesystem
Sourcepub fn process_input(&mut self, event: InputEvent) -> Result<(), KernelError>
pub fn process_input(&mut self, event: InputEvent) -> Result<(), KernelError>
Process input event
Sourcepub fn render(
&self,
buf: &mut [u8],
width: usize,
height: usize,
) -> Result<(), KernelError>
pub fn render( &self, buf: &mut [u8], width: usize, height: usize, ) -> Result<(), KernelError>
Render text editor to a BGRA pixel buffer.
buf is widthheight4 bytes in BGRA format.
Sourcepub fn surface_id(&self) -> u32
pub fn surface_id(&self) -> u32
Get compositor surface ID
Sourcepub fn render_to_surface(&self)
pub fn render_to_surface(&self)
Render text editor contents to its compositor surface.
The surface includes a 28px title bar; content is at y-offset 28.