diff options
author | 2023-03-04 05:37:11 +0100 | |
---|---|---|
committer | 2023-03-04 05:37:11 +0100 | |
commit | 3a0d34c0240f4421737a6a08761f99d6f8140d02 (patch) | |
tree | c9a4a6b8e9c1db1b8fcd05bc98e3f131d5ef4bd5 /native/src/renderer/null.rs | |
parent | c54409d1711e1f615c7ea4b02c082954e340632a (diff) | |
download | iced-3a0d34c0240f4421737a6a08761f99d6f8140d02.tar.gz iced-3a0d34c0240f4421737a6a08761f99d6f8140d02.tar.bz2 iced-3a0d34c0240f4421737a6a08761f99d6f8140d02.zip |
Create `iced_widget` subcrate and re-organize the whole codebase
Diffstat (limited to 'native/src/renderer/null.rs')
-rw-r--r-- | native/src/renderer/null.rs | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs deleted file mode 100644 index 150ee786..00000000 --- a/native/src/renderer/null.rs +++ /dev/null @@ -1,82 +0,0 @@ -use crate::renderer::{self, Renderer}; -use crate::text::{self, Text}; -use crate::{Background, Font, Point, Rectangle, Size, Theme, Vector}; - -use std::borrow::Cow; - -/// A renderer that does nothing. -/// -/// It can be useful if you are writing tests! -#[derive(Debug, Clone, Copy, Default)] -pub struct Null; - -impl Null { - /// Creates a new [`Null`] renderer. - pub fn new() -> Null { - Null - } -} - -impl Renderer for Null { - type Theme = Theme; - - fn with_layer(&mut self, _bounds: Rectangle, _f: impl FnOnce(&mut Self)) {} - - fn with_translation( - &mut self, - _translation: Vector, - _f: impl FnOnce(&mut Self), - ) { - } - - fn clear(&mut self) {} - - fn fill_quad( - &mut self, - _quad: renderer::Quad, - _background: impl Into<Background>, - ) { - } -} - -impl text::Renderer for Null { - type Font = Font; - - const ICON_FONT: Font = Font::SansSerif; - const CHECKMARK_ICON: char = '0'; - const ARROW_DOWN_ICON: char = '0'; - - fn default_font(&self) -> Self::Font { - Font::SansSerif - } - - fn default_size(&self) -> f32 { - 16.0 - } - - fn load_font(&mut self, _font: Cow<'static, [u8]>) {} - - fn measure( - &self, - _content: &str, - _size: f32, - _font: Font, - _bounds: Size, - ) -> (f32, f32) { - (0.0, 20.0) - } - - fn hit_test( - &self, - _contents: &str, - _size: f32, - _font: Self::Font, - _bounds: Size, - _point: Point, - _nearest_only: bool, - ) -> Option<text::Hit> { - None - } - - fn fill_text(&mut self, _text: Text<'_, Self::Font>) {} -} |