Draft Editor API and TextEditor widget
This commit is contained in:
parent
346af3f8b0
commit
6448429103
25 changed files with 1384 additions and 92 deletions
|
|
@ -43,6 +43,7 @@ impl Renderer for Null {
|
|||
impl text::Renderer for Null {
|
||||
type Font = Font;
|
||||
type Paragraph = ();
|
||||
type Editor = ();
|
||||
|
||||
const ICON_FONT: Font = Font::DEFAULT;
|
||||
const CHECKMARK_ICON: char = '0';
|
||||
|
|
@ -66,6 +67,14 @@ impl text::Renderer for Null {
|
|||
) {
|
||||
}
|
||||
|
||||
fn fill_editor(
|
||||
&mut self,
|
||||
_editor: &Self::Editor,
|
||||
_position: Point,
|
||||
_color: Color,
|
||||
) {
|
||||
}
|
||||
|
||||
fn fill_text(
|
||||
&mut self,
|
||||
_paragraph: Text<'_, Self::Font>,
|
||||
|
|
@ -106,3 +115,32 @@ impl text::Paragraph for () {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl text::Editor for () {
|
||||
type Font = Font;
|
||||
|
||||
fn with_text(_text: &str) -> Self {}
|
||||
|
||||
fn cursor(&self) -> text::editor::Cursor {
|
||||
text::editor::Cursor::Caret(Point::ORIGIN)
|
||||
}
|
||||
|
||||
fn perform(&mut self, _action: text::editor::Action) {}
|
||||
|
||||
fn bounds(&self) -> Size {
|
||||
Size::ZERO
|
||||
}
|
||||
|
||||
fn min_bounds(&self) -> Size {
|
||||
Size::ZERO
|
||||
}
|
||||
|
||||
fn update(
|
||||
&mut self,
|
||||
_new_bounds: Size,
|
||||
_new_font: Self::Font,
|
||||
_new_size: Pixels,
|
||||
_new_line_height: text::LineHeight,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue