summaryrefslogtreecommitdiffstats
path: root/native/src/renderer
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-14 16:07:22 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-14 16:07:22 +0700
commit03b34931383e701c39c653a7662a616fe21a0947 (patch)
tree8c0773d50b615dbc62210db8919ecb97ca912bd9 /native/src/renderer
parent3aae45c1913e6a6f60b009f19d00d10add7ad11e (diff)
downloadiced-03b34931383e701c39c653a7662a616fe21a0947.tar.gz
iced-03b34931383e701c39c653a7662a616fe21a0947.tar.bz2
iced-03b34931383e701c39c653a7662a616fe21a0947.zip
Remove trait-specific draw logic in `iced_native`
Diffstat (limited to 'native/src/renderer')
-rw-r--r--native/src/renderer/null.rs191
1 files changed, 2 insertions, 189 deletions
diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs
index b5921582..1ffca5c9 100644
--- a/native/src/renderer/null.rs
+++ b/native/src/renderer/null.rs
@@ -1,20 +1,15 @@
-use crate::alignment;
use crate::button;
use crate::checkbox;
-use crate::column;
use crate::container;
use crate::pane_grid;
use crate::progress_bar;
use crate::radio;
-use crate::row;
use crate::scrollable;
use crate::slider;
use crate::text;
use crate::text_input;
use crate::toggler;
-use crate::{
- Color, Element, Font, Layout, Padding, Point, Rectangle, Renderer, Size,
-};
+use crate::{Font, Padding, Point, Rectangle, Renderer, Size};
/// A renderer that does nothing.
///
@@ -30,35 +25,9 @@ impl Null {
}
impl Renderer for Null {
- type Output = ();
type Defaults = ();
- fn overlay(&mut self, _base: (), _overlay: (), _overlay_bounds: Rectangle) {
- }
-}
-
-impl column::Renderer for Null {
- fn draw<Message>(
- &mut self,
- _defaults: &Self::Defaults,
- _content: &[Element<'_, Message, Self>],
- _layout: Layout<'_>,
- _cursor_position: Point,
- _viewport: &Rectangle,
- ) {
- }
-}
-
-impl row::Renderer for Null {
- fn draw<Message>(
- &mut self,
- _defaults: &Self::Defaults,
- _content: &[Element<'_, Message, Self>],
- _layout: Layout<'_>,
- _cursor_position: Point,
- _viewport: &Rectangle,
- ) {
- }
+ fn with_layer(&mut self, _bounds: Rectangle, _f: impl FnOnce(&mut Self)) {}
}
impl text::Renderer for Null {
@@ -89,19 +58,6 @@ impl text::Renderer for Null {
) -> Option<text::Hit> {
None
}
-
- fn draw(
- &mut self,
- _defaults: &Self::Defaults,
- _bounds: Rectangle,
- _content: &str,
- _size: u16,
- _font: Font,
- _color: Option<Color>,
- _horizontal_alignment: alignment::Horizontal,
- _vertical_alignment: alignment::Vertical,
- ) {
- }
}
impl scrollable::Renderer for Null {
@@ -118,20 +74,6 @@ impl scrollable::Renderer for Null {
) -> Option<scrollable::Scrollbar> {
None
}
-
- fn draw(
- &mut self,
- _scrollable: &scrollable::State,
- _bounds: Rectangle,
- _content_bounds: Rectangle,
- _is_mouse_over: bool,
- _is_mouse_over_scrollbar: bool,
- _scrollbar: Option<scrollable::Scrollbar>,
- _offset: u32,
- _style: &Self::Style,
- _content: Self::Output,
- ) {
- }
}
impl text_input::Renderer for Null {
@@ -151,39 +93,12 @@ impl text_input::Renderer for Null {
) -> f32 {
0.0
}
-
- fn draw(
- &mut self,
- _bounds: Rectangle,
- _text_bounds: Rectangle,
- _cursor_position: Point,
- _font: Font,
- _size: u16,
- _placeholder: &str,
- _value: &text_input::Value,
- _state: &text_input::State,
- _style: &Self::Style,
- ) -> Self::Output {
- }
}
impl button::Renderer for Null {
const DEFAULT_PADDING: Padding = Padding::ZERO;
type Style = ();
-
- fn draw<Message>(
- &mut self,
- _defaults: &Self::Defaults,
- _bounds: Rectangle,
- _cursor_position: Point,
- _is_disabled: bool,
- _is_pressed: bool,
- _style: &Self::Style,
- _content: &Element<'_, Message, Self>,
- _content_layout: Layout<'_>,
- ) -> Self::Output {
- }
}
impl radio::Renderer for Null {
@@ -191,16 +106,6 @@ impl radio::Renderer for Null {
const DEFAULT_SIZE: u16 = 20;
const DEFAULT_SPACING: u16 = 15;
-
- fn draw(
- &mut self,
- _bounds: Rectangle,
- _is_selected: bool,
- _is_mouse_over: bool,
- _label: Self::Output,
- _style: &Self::Style,
- ) {
- }
}
impl checkbox::Renderer for Null {
@@ -208,122 +113,30 @@ impl checkbox::Renderer for Null {
const DEFAULT_SIZE: u16 = 20;
const DEFAULT_SPACING: u16 = 15;
-
- fn draw(
- &mut self,
- _bounds: Rectangle,
- _is_checked: bool,
- _is_mouse_over: bool,
- _label: Self::Output,
- _style: &Self::Style,
- ) {
- }
}
impl slider::Renderer for Null {
type Style = ();
const DEFAULT_HEIGHT: u16 = 30;
-
- fn draw(
- &mut self,
- _bounds: Rectangle,
- _cursor_position: Point,
- _range: std::ops::RangeInclusive<f32>,
- _value: f32,
- _is_dragging: bool,
- _style_sheet: &Self::Style,
- ) {
- }
}
impl progress_bar::Renderer for Null {
type Style = ();
const DEFAULT_HEIGHT: u16 = 30;
-
- fn draw(
- &self,
- _bounds: Rectangle,
- _range: std::ops::RangeInclusive<f32>,
- _value: f32,
- _style: &Self::Style,
- ) {
- }
}
impl container::Renderer for Null {
type Style = ();
-
- fn draw<Message>(
- &mut self,
- _defaults: &Self::Defaults,
- _bounds: Rectangle,
- _cursor_position: Point,
- _viewport: &Rectangle,
- _style: &Self::Style,
- _content: &Element<'_, Message, Self>,
- _content_layout: Layout<'_>,
- ) {
- }
}
impl pane_grid::Renderer for Null {
type Style = ();
-
- fn draw<Message>(
- &mut self,
- _defaults: &Self::Defaults,
- _content: &[(pane_grid::Pane, pane_grid::Content<'_, Message, Self>)],
- _dragging: Option<(pane_grid::Pane, Point)>,
- _resizing: Option<(pane_grid::Axis, Rectangle, bool)>,
- _layout: Layout<'_>,
- _style: &<Self as pane_grid::Renderer>::Style,
- _cursor_position: Point,
- _viewport: &Rectangle,
- ) {
- }
-
- fn draw_pane<Message>(
- &mut self,
- _defaults: &Self::Defaults,
- _bounds: Rectangle,
- _style: &<Self as container::Renderer>::Style,
- _title_bar: Option<(
- &pane_grid::TitleBar<'_, Message, Self>,
- Layout<'_>,
- )>,
- _body: (&Element<'_, Message, Self>, Layout<'_>),
- _cursor_position: Point,
- _viewport: &Rectangle,
- ) {
- }
-
- fn draw_title_bar<Message>(
- &mut self,
- _defaults: &Self::Defaults,
- _bounds: Rectangle,
- _style: &<Self as container::Renderer>::Style,
- _content: (&Element<'_, Message, Self>, Layout<'_>),
- _controls: Option<(&Element<'_, Message, Self>, Layout<'_>)>,
- _cursor_position: Point,
- _viewport: &Rectangle,
- ) {
- }
}
impl toggler::Renderer for Null {
type Style = ();
const DEFAULT_SIZE: u16 = 20;
-
- fn draw(
- &mut self,
- _bounds: Rectangle,
- _is_checked: bool,
- _is_mouse_over: bool,
- _label: Option<Self::Output>,
- _style: &Self::Style,
- ) {
- }
}