2019-11-21 13:47:20 +01:00
|
|
|
use crate::{
|
|
|
|
|
button, checkbox, column, radio, row, scrollable, text, text_input,
|
|
|
|
|
Background, Color, Element, Font, HorizontalAlignment, Layout, Point,
|
2019-11-25 20:27:15 +01:00
|
|
|
Rectangle, Renderer, ScrollbarGrab, Size, VerticalAlignment,
|
2019-11-21 13:47:20 +01:00
|
|
|
};
|
|
|
|
|
|
2019-11-22 19:36:57 +01:00
|
|
|
/// A renderer that does nothing.
|
2019-11-22 21:16:40 +01:00
|
|
|
#[derive(Debug, Clone, Copy)]
|
2019-11-21 13:47:20 +01:00
|
|
|
pub struct Null;
|
|
|
|
|
|
|
|
|
|
impl Renderer for Null {
|
|
|
|
|
type Output = ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl column::Renderer for Null {
|
|
|
|
|
fn draw<Message>(
|
|
|
|
|
&mut self,
|
|
|
|
|
_content: &[Element<'_, Message, Self>],
|
|
|
|
|
_layout: Layout<'_>,
|
|
|
|
|
_cursor_position: Point,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl row::Renderer for Null {
|
|
|
|
|
fn draw<Message>(
|
|
|
|
|
&mut self,
|
|
|
|
|
_content: &[Element<'_, Message, Self>],
|
|
|
|
|
_layout: Layout<'_>,
|
|
|
|
|
_cursor_position: Point,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl text::Renderer for Null {
|
|
|
|
|
fn default_size(&self) -> u16 {
|
|
|
|
|
20
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn measure(
|
|
|
|
|
&self,
|
|
|
|
|
_content: &str,
|
|
|
|
|
_size: u16,
|
|
|
|
|
_font: Font,
|
|
|
|
|
_bounds: Size,
|
|
|
|
|
) -> (f32, f32) {
|
|
|
|
|
(0.0, 20.0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn draw(
|
|
|
|
|
&mut self,
|
|
|
|
|
_bounds: Rectangle,
|
|
|
|
|
_content: &str,
|
|
|
|
|
_size: u16,
|
|
|
|
|
_font: Font,
|
|
|
|
|
_color: Option<Color>,
|
|
|
|
|
_horizontal_alignment: HorizontalAlignment,
|
|
|
|
|
_vertical_alignment: VerticalAlignment,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl scrollable::Renderer for Null {
|
2019-11-25 20:27:15 +01:00
|
|
|
fn scrollbar_grab(
|
2019-11-21 13:47:20 +01:00
|
|
|
&self,
|
|
|
|
|
_bounds: Rectangle,
|
|
|
|
|
_content_bounds: Rectangle,
|
2019-11-25 20:27:15 +01:00
|
|
|
_offset: u32,
|
2019-11-21 13:47:20 +01:00
|
|
|
_cursor_position: Point,
|
2019-11-25 20:27:15 +01:00
|
|
|
) -> Option<ScrollbarGrab> {
|
|
|
|
|
None
|
2019-11-21 13:47:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn draw(
|
|
|
|
|
&mut self,
|
|
|
|
|
_scrollable: &scrollable::State,
|
|
|
|
|
_bounds: Rectangle,
|
|
|
|
|
_content_bounds: Rectangle,
|
|
|
|
|
_is_mouse_over: bool,
|
|
|
|
|
_is_mouse_over_scrollbar: bool,
|
|
|
|
|
_offset: u32,
|
|
|
|
|
_content: Self::Output,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl text_input::Renderer for Null {
|
|
|
|
|
fn default_size(&self) -> u16 {
|
|
|
|
|
20
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn draw(
|
|
|
|
|
&mut self,
|
|
|
|
|
_bounds: Rectangle,
|
|
|
|
|
_text_bounds: Rectangle,
|
|
|
|
|
_cursor_position: Point,
|
|
|
|
|
_size: u16,
|
|
|
|
|
_placeholder: &str,
|
|
|
|
|
_value: &text_input::Value,
|
|
|
|
|
_state: &text_input::State,
|
|
|
|
|
) -> Self::Output {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl button::Renderer for Null {
|
|
|
|
|
fn draw(
|
|
|
|
|
&mut self,
|
|
|
|
|
_bounds: Rectangle,
|
|
|
|
|
_cursor_position: Point,
|
|
|
|
|
_is_pressed: bool,
|
|
|
|
|
_background: Option<Background>,
|
|
|
|
|
_border_radius: u16,
|
|
|
|
|
_content: Self::Output,
|
|
|
|
|
) -> Self::Output {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl radio::Renderer for Null {
|
|
|
|
|
fn default_size(&self) -> u32 {
|
|
|
|
|
20
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn draw(
|
|
|
|
|
&mut self,
|
|
|
|
|
_bounds: Rectangle,
|
|
|
|
|
_is_selected: bool,
|
|
|
|
|
_is_mouse_over: bool,
|
|
|
|
|
_label: Self::Output,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl checkbox::Renderer for Null {
|
|
|
|
|
fn default_size(&self) -> u32 {
|
|
|
|
|
20
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn draw(
|
|
|
|
|
&mut self,
|
|
|
|
|
_bounds: Rectangle,
|
|
|
|
|
_is_checked: bool,
|
|
|
|
|
_is_mouse_over: bool,
|
|
|
|
|
_label: Self::Output,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
}
|