2023-08-30 04:31:21 +02:00
|
|
|
use crate::alignment;
|
2024-03-22 05:27:31 +01:00
|
|
|
use crate::image;
|
2021-10-14 16:59:19 +07:00
|
|
|
use crate::renderer::{self, Renderer};
|
2024-03-22 05:41:15 +01:00
|
|
|
use crate::svg;
|
2021-10-31 16:13:03 +07:00
|
|
|
use crate::text::{self, Text};
|
2023-10-24 05:34:03 +02:00
|
|
|
use crate::{
|
2024-05-02 15:21:22 +02:00
|
|
|
Background, Color, Font, Pixels, Point, Radians, Rectangle, Size,
|
|
|
|
|
Transformation,
|
2023-10-24 05:34:03 +02:00
|
|
|
};
|
2019-11-21 13:47:20 +01:00
|
|
|
|
2024-03-22 05:27:31 +01:00
|
|
|
impl Renderer for () {
|
2024-04-03 21:07:54 +02:00
|
|
|
fn start_layer(&mut self, _bounds: Rectangle) {}
|
2021-10-25 16:16:35 +07:00
|
|
|
|
2024-04-09 22:25:16 +02:00
|
|
|
fn end_layer(&mut self) {}
|
2024-03-21 22:27:17 +01:00
|
|
|
|
2024-04-03 21:07:54 +02:00
|
|
|
fn start_transformation(&mut self, _transformation: Transformation) {}
|
2024-03-21 22:27:17 +01:00
|
|
|
|
2024-04-09 22:25:16 +02:00
|
|
|
fn end_transformation(&mut self) {}
|
2021-10-14 16:59:19 +07:00
|
|
|
|
|
|
|
|
fn clear(&mut self) {}
|
2021-10-18 14:47:49 +07:00
|
|
|
|
2021-11-04 19:22:29 +07:00
|
|
|
fn fill_quad(
|
|
|
|
|
&mut self,
|
|
|
|
|
_quad: renderer::Quad,
|
|
|
|
|
_background: impl Into<Background>,
|
|
|
|
|
) {
|
|
|
|
|
}
|
2019-11-21 13:47:20 +01:00
|
|
|
}
|
|
|
|
|
|
2024-03-22 05:27:31 +01:00
|
|
|
impl text::Renderer for () {
|
2020-04-23 22:17:11 +02:00
|
|
|
type Font = Font;
|
2023-08-30 04:31:21 +02:00
|
|
|
type Paragraph = ();
|
2023-09-12 14:51:00 +02:00
|
|
|
type Editor = ();
|
2020-04-23 22:17:11 +02:00
|
|
|
|
2023-03-30 00:56:00 +02:00
|
|
|
const ICON_FONT: Font = Font::DEFAULT;
|
2021-10-21 19:06:22 +07:00
|
|
|
const CHECKMARK_ICON: char = '0';
|
|
|
|
|
const ARROW_DOWN_ICON: char = '0';
|
|
|
|
|
|
2023-02-04 07:33:33 +01:00
|
|
|
fn default_font(&self) -> Self::Font {
|
2023-03-30 00:56:00 +02:00
|
|
|
Font::default()
|
2023-02-04 07:33:33 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-30 04:31:21 +02:00
|
|
|
fn default_size(&self) -> Pixels {
|
|
|
|
|
Pixels(16.0)
|
2020-06-19 00:08:28 +02:00
|
|
|
}
|
2019-11-21 13:47:20 +01:00
|
|
|
|
2023-08-30 04:31:21 +02:00
|
|
|
fn fill_paragraph(
|
|
|
|
|
&mut self,
|
|
|
|
|
_paragraph: &Self::Paragraph,
|
|
|
|
|
_position: Point,
|
|
|
|
|
_color: Color,
|
2023-12-02 15:53:02 +01:00
|
|
|
_clip_bounds: Rectangle,
|
2023-08-30 04:31:21 +02:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 14:51:00 +02:00
|
|
|
fn fill_editor(
|
|
|
|
|
&mut self,
|
|
|
|
|
_editor: &Self::Editor,
|
|
|
|
|
_position: Point,
|
|
|
|
|
_color: Color,
|
2023-12-02 15:53:02 +01:00
|
|
|
_clip_bounds: Rectangle,
|
2023-09-12 14:51:00 +02:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-30 04:31:21 +02:00
|
|
|
fn fill_text(
|
|
|
|
|
&mut self,
|
2024-04-01 11:30:01 +02:00
|
|
|
_paragraph: Text,
|
2023-08-30 04:31:21 +02:00
|
|
|
_position: Point,
|
|
|
|
|
_color: Color,
|
2023-12-02 15:53:02 +01:00
|
|
|
_clip_bounds: Rectangle,
|
2023-08-30 04:31:21 +02:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl text::Paragraph for () {
|
|
|
|
|
type Font = Font;
|
|
|
|
|
|
2024-04-01 11:30:01 +02:00
|
|
|
fn with_text(_text: Text<&str>) -> Self {}
|
2023-08-30 04:31:21 +02:00
|
|
|
|
2023-09-11 02:47:24 +02:00
|
|
|
fn resize(&mut self, _new_bounds: Size) {}
|
2023-08-30 04:31:21 +02:00
|
|
|
|
2024-04-01 11:30:01 +02:00
|
|
|
fn compare(&self, _text: Text<&str>) -> text::Difference {
|
2023-09-11 02:47:24 +02:00
|
|
|
text::Difference::None
|
2023-08-30 04:31:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn horizontal_alignment(&self) -> alignment::Horizontal {
|
|
|
|
|
alignment::Horizontal::Left
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn vertical_alignment(&self) -> alignment::Vertical {
|
|
|
|
|
alignment::Vertical::Top
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn grapheme_position(&self, _line: usize, _index: usize) -> Option<Point> {
|
2021-09-15 14:49:13 +07:00
|
|
|
None
|
2021-08-21 10:31:26 -07:00
|
|
|
}
|
2019-11-21 13:47:20 +01:00
|
|
|
|
2023-08-30 04:31:21 +02:00
|
|
|
fn min_bounds(&self) -> Size {
|
|
|
|
|
Size::ZERO
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn hit_test(&self, _point: Point) -> Option<text::Hit> {
|
|
|
|
|
None
|
|
|
|
|
}
|
2019-11-21 13:47:20 +01:00
|
|
|
}
|
2023-09-12 14:51:00 +02:00
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-18 19:07:41 +02:00
|
|
|
fn cursor_position(&self) -> (usize, usize) {
|
|
|
|
|
(0, 0)
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-16 15:27:25 +02:00
|
|
|
fn selection(&self) -> Option<String> {
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn line(&self, _index: usize) -> Option<&str> {
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn line_count(&self) -> usize {
|
|
|
|
|
0
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 14:51:00 +02:00
|
|
|
fn perform(&mut self, _action: text::editor::Action) {}
|
|
|
|
|
|
|
|
|
|
fn bounds(&self) -> Size {
|
|
|
|
|
Size::ZERO
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-07 21:48:28 +01:00
|
|
|
fn min_bounds(&self) -> Size {
|
|
|
|
|
Size::ZERO
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 14:51:00 +02:00
|
|
|
fn update(
|
|
|
|
|
&mut self,
|
|
|
|
|
_new_bounds: Size,
|
|
|
|
|
_new_font: Self::Font,
|
|
|
|
|
_new_size: Pixels,
|
|
|
|
|
_new_line_height: text::LineHeight,
|
2023-09-17 15:29:14 +02:00
|
|
|
_new_highlighter: &mut impl text::Highlighter,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn highlight<H: text::Highlighter>(
|
|
|
|
|
&mut self,
|
|
|
|
|
_font: Self::Font,
|
|
|
|
|
_highlighter: &mut H,
|
|
|
|
|
_format_highlight: impl Fn(
|
|
|
|
|
&H::Highlight,
|
|
|
|
|
) -> text::highlighter::Format<Self::Font>,
|
2023-09-12 14:51:00 +02:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-22 05:27:31 +01:00
|
|
|
|
|
|
|
|
impl image::Renderer for () {
|
|
|
|
|
type Handle = ();
|
|
|
|
|
|
|
|
|
|
fn measure_image(&self, _handle: &Self::Handle) -> Size<u32> {
|
|
|
|
|
Size::default()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn draw_image(
|
|
|
|
|
&mut self,
|
|
|
|
|
_handle: Self::Handle,
|
|
|
|
|
_filter_method: image::FilterMethod,
|
|
|
|
|
_bounds: Rectangle,
|
2024-05-02 15:21:22 +02:00
|
|
|
_rotation: Radians,
|
2024-05-03 13:25:58 +02:00
|
|
|
_opacity: f32,
|
2024-03-22 05:27:31 +01:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-22 05:41:15 +01:00
|
|
|
|
|
|
|
|
impl svg::Renderer for () {
|
|
|
|
|
fn measure_svg(&self, _handle: &svg::Handle) -> Size<u32> {
|
|
|
|
|
Size::default()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn draw_svg(
|
|
|
|
|
&mut self,
|
|
|
|
|
_handle: svg::Handle,
|
|
|
|
|
_color: Option<Color>,
|
|
|
|
|
_bounds: Rectangle,
|
2024-05-02 15:21:22 +02:00
|
|
|
_rotation: Radians,
|
2024-05-03 13:25:58 +02:00
|
|
|
_opacity: f32,
|
2024-03-22 05:41:15 +01:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|