From 5eec3a8867f4fbd54e2e28e5d984c2ca7ec0fea4 Mon Sep 17 00:00:00 2001 From: Friz64 Date: Mon, 25 Nov 2019 20:27:15 +0100 Subject: First implementation --- native/src/renderer/null.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'native/src/renderer/null.rs') diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs index 182f033a..c8852ad1 100644 --- a/native/src/renderer/null.rs +++ b/native/src/renderer/null.rs @@ -1,7 +1,7 @@ use crate::{ button, checkbox, column, radio, row, scrollable, text, text_input, Background, Color, Element, Font, HorizontalAlignment, Layout, Point, - Rectangle, Renderer, Size, VerticalAlignment, + Rectangle, Renderer, ScrollbarGrab, Size, VerticalAlignment, }; /// A renderer that does nothing. @@ -61,13 +61,14 @@ impl text::Renderer for Null { } impl scrollable::Renderer for Null { - fn is_mouse_over_scrollbar( + fn scrollbar_grab( &self, _bounds: Rectangle, _content_bounds: Rectangle, + _offset: u32, _cursor_position: Point, - ) -> bool { - false + ) -> Option { + None } fn draw( -- cgit From 9a733bb3c89e15ada05fc90efb71eeae12b8c9c1 Mon Sep 17 00:00:00 2001 From: Friz64 Date: Sat, 30 Nov 2019 18:16:01 +0100 Subject: Support null renderer --- native/src/renderer/null.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'native/src/renderer/null.rs') diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs index c8852ad1..c06d1dfa 100644 --- a/native/src/renderer/null.rs +++ b/native/src/renderer/null.rs @@ -61,11 +61,21 @@ impl text::Renderer for Null { } impl scrollable::Renderer for Null { - fn scrollbar_grab( + fn scrollbar_bounds( &self, _bounds: Rectangle, _content_bounds: Rectangle, _offset: u32, + ) -> (Rectangle, Rectangle) { + Default::default() + } + + fn scrollbar_grab( + &self, + _bounds: Rectangle, + _content_bounds: Rectangle, + _background_bounds: Rectangle, + _scroller_bounds: Rectangle, _cursor_position: Point, ) -> Option { None -- cgit From 6943041e0fad65927a741e316509bf07bdaa2f61 Mon Sep 17 00:00:00 2001 From: Friz64 Date: Mon, 2 Dec 2019 18:51:34 +0100 Subject: Address suggestions --- native/src/renderer/null.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'native/src/renderer/null.rs') diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs index c06d1dfa..2ce150c0 100644 --- a/native/src/renderer/null.rs +++ b/native/src/renderer/null.rs @@ -1,7 +1,7 @@ use crate::{ button, checkbox, column, radio, row, scrollable, text, text_input, Background, Color, Element, Font, HorizontalAlignment, Layout, Point, - Rectangle, Renderer, ScrollbarGrab, Size, VerticalAlignment, + Rectangle, Renderer, Size, VerticalAlignment, }; /// A renderer that does nothing. @@ -61,24 +61,17 @@ impl text::Renderer for Null { } impl scrollable::Renderer for Null { - fn scrollbar_bounds( - &self, - _bounds: Rectangle, - _content_bounds: Rectangle, - _offset: u32, - ) -> (Rectangle, Rectangle) { + fn scrollbar_bounds(_bounds: Rectangle) -> Rectangle { Default::default() } - fn scrollbar_grab( - &self, + fn scroller_bounds( _bounds: Rectangle, _content_bounds: Rectangle, - _background_bounds: Rectangle, - _scroller_bounds: Rectangle, - _cursor_position: Point, - ) -> Option { - None + _scrollbar_bounds: Rectangle, + _offset: u32, + ) -> Rectangle { + Default::default() } fn draw( @@ -88,6 +81,8 @@ impl scrollable::Renderer for Null { _content_bounds: Rectangle, _is_mouse_over: bool, _is_mouse_over_scrollbar: bool, + _scrollbar_bounds: Rectangle, + _scroller_bounds: Rectangle, _offset: u32, _content: Self::Output, ) { -- cgit From 31e3b6fbcb06bd5e1e5773a7c2febd0cb0092819 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 3 Dec 2019 06:48:29 +0100 Subject: Unify logic by introducing `scrollable::Scrollbar` --- native/src/renderer/null.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'native/src/renderer/null.rs') diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs index 2ce150c0..da0e5159 100644 --- a/native/src/renderer/null.rs +++ b/native/src/renderer/null.rs @@ -61,17 +61,13 @@ impl text::Renderer for Null { } impl scrollable::Renderer for Null { - fn scrollbar_bounds(_bounds: Rectangle) -> Rectangle { - Default::default() - } - - fn scroller_bounds( + fn scrollbar( + &self, _bounds: Rectangle, _content_bounds: Rectangle, - _scrollbar_bounds: Rectangle, _offset: u32, - ) -> Rectangle { - Default::default() + ) -> Option { + None } fn draw( @@ -81,8 +77,7 @@ impl scrollable::Renderer for Null { _content_bounds: Rectangle, _is_mouse_over: bool, _is_mouse_over_scrollbar: bool, - _scrollbar_bounds: Rectangle, - _scroller_bounds: Rectangle, + _scrollbar: Option, _offset: u32, _content: Self::Output, ) { -- cgit