diff options
author | 2024-01-19 20:41:52 +0100 | |
---|---|---|
committer | 2024-01-19 20:41:52 +0100 | |
commit | 1781068e1c3a65551db1e832fdbaddba99124051 (patch) | |
tree | 60e0b3854cc0541712572fbb0e56f14435951ea9 /core/src/renderer | |
parent | 41dec5bd203ff5b1574a33a17d5f7358ae1beea2 (diff) | |
parent | 7ae7fcb89855002519bab752fd3686106ce448db (diff) | |
download | iced-1781068e1c3a65551db1e832fdbaddba99124051.tar.gz iced-1781068e1c3a65551db1e832fdbaddba99124051.tar.bz2 iced-1781068e1c3a65551db1e832fdbaddba99124051.zip |
Merge branch 'master' into remove-vertex-indexing
Diffstat (limited to 'core/src/renderer')
-rw-r--r-- | core/src/renderer/null.rs | 94 |
1 files changed, 66 insertions, 28 deletions
diff --git a/core/src/renderer/null.rs b/core/src/renderer/null.rs index 55d58a59..7accd34e 100644 --- a/core/src/renderer/null.rs +++ b/core/src/renderer/null.rs @@ -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'; @@ -58,21 +59,21 @@ impl text::Renderer for Null { fn load_font(&mut self, _font: Cow<'static, [u8]>) {} - fn create_paragraph(&self, _text: Text<'_, Self::Font>) -> Self::Paragraph { - } - - fn resize_paragraph( - &self, - _paragraph: &mut Self::Paragraph, - _new_bounds: Size, + fn fill_paragraph( + &mut self, + _paragraph: &Self::Paragraph, + _position: Point, + _color: Color, + _clip_bounds: Rectangle, ) { } - fn fill_paragraph( + fn fill_editor( &mut self, - _paragraph: &Self::Paragraph, + _editor: &Self::Editor, _position: Point, _color: Color, + _clip_bounds: Rectangle, ) { } @@ -81,6 +82,7 @@ impl text::Renderer for Null { _paragraph: Text<'_, Self::Font>, _position: Point, _color: Color, + _clip_bounds: Rectangle, ) { } } @@ -88,47 +90,83 @@ impl text::Renderer for Null { impl text::Paragraph for () { type Font = Font; - fn content(&self) -> &str { - "" + fn with_text(_text: Text<'_, Self::Font>) -> Self {} + + fn resize(&mut self, _new_bounds: Size) {} + + fn compare(&self, _text: Text<'_, Self::Font>) -> text::Difference { + text::Difference::None } - fn text_size(&self) -> Pixels { - Pixels(16.0) + fn horizontal_alignment(&self) -> alignment::Horizontal { + alignment::Horizontal::Left } - fn font(&self) -> Self::Font { - Font::default() + fn vertical_alignment(&self) -> alignment::Vertical { + alignment::Vertical::Top } - fn line_height(&self) -> text::LineHeight { - text::LineHeight::default() + fn grapheme_position(&self, _line: usize, _index: usize) -> Option<Point> { + None } - fn shaping(&self) -> text::Shaping { - text::Shaping::default() + fn min_bounds(&self) -> Size { + Size::ZERO } - fn horizontal_alignment(&self) -> alignment::Horizontal { - alignment::Horizontal::Left + fn hit_test(&self, _point: Point) -> Option<text::Hit> { + None } +} - fn vertical_alignment(&self) -> alignment::Vertical { - alignment::Vertical::Top +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 grapheme_position(&self, _line: usize, _index: usize) -> Option<Point> { + fn cursor_position(&self) -> (usize, usize) { + (0, 0) + } + + fn selection(&self) -> Option<String> { + None + } + + fn line(&self, _index: usize) -> Option<&str> { None } + fn line_count(&self) -> usize { + 0 + } + + 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, + _new_highlighter: &mut impl text::Highlighter, + ) { } - fn hit_test(&self, _point: Point) -> Option<text::Hit> { - None + fn highlight<H: text::Highlighter>( + &mut self, + _font: Self::Font, + _highlighter: &mut H, + _format_highlight: impl Fn( + &H::Highlight, + ) -> text::highlighter::Format<Self::Font>, + ) { } } |