updated grapher to use new widtgets system (not working yet but close)

made a basic app using the widgets system

implemented CgTextEdit for CgLineEdit (now fully working, but there may be bugs so i'll address them tomorrow)
This commit is contained in:
FantasyPvP
2023-11-24 00:40:27 +00:00
parent 467a42a5fa
commit 140ac0ab32
13 changed files with 288 additions and 419 deletions
+5 -5
View File
@@ -18,12 +18,12 @@ pub trait CgComponent {
fn render(&self) -> Result<Frame, RenderError>;
}
/// trait for components that can have editable text, such as search boxes, command palletes, terminals, text inputs etc.
/// trait for components that can have editable text, such as search boxes, command palettes, terminals, text inputs etc.
pub trait CgTextEdit: CgComponent {
fn write_char(&self) -> Result<Frame, RenderError>; // this can also be implemented in a way that inserts characters
fn delete_char(&self) -> Result<Frame, RenderError>;
fn move_cursor(&self, direction: bool) -> Result<(), RenderError>; // true = right, false = left
fn clear(&self) -> Result<Frame, RenderError>;
fn write_char(&mut self, c: char); // this can also be implemented in a way that inserts characters
fn backspace(&mut self);
fn move_cursor(&mut self, direction: bool); // true = right, false = left
fn clear(&mut self);
}