2020-01-10 01:58:55 +01:00
|
|
|
use crate::{Color, Layout, Point, Renderer, Widget};
|
2019-10-09 05:36:49 +02:00
|
|
|
|
|
|
|
|
/// A renderer able to graphically explain a [`Layout`].
|
|
|
|
|
///
|
2020-01-10 01:58:55 +01:00
|
|
|
/// [`Layout`]: struct.Layout.html
|
|
|
|
|
pub trait Debugger: Renderer {
|
2019-10-09 05:36:49 +02:00
|
|
|
/// Explains the [`Layout`] of an [`Element`] for debugging purposes.
|
|
|
|
|
///
|
|
|
|
|
/// This will be called when [`Element::explain`] has been used. It should
|
|
|
|
|
/// _explain_ the given [`Layout`] graphically.
|
|
|
|
|
///
|
|
|
|
|
/// A common approach consists in recursively rendering the bounds of the
|
|
|
|
|
/// [`Layout`] and its children.
|
|
|
|
|
///
|
|
|
|
|
/// [`Layout`]: struct.Layout.html
|
2020-01-10 01:58:55 +01:00
|
|
|
/// [`Element`]: ../struct.Element.html
|
|
|
|
|
/// [`Element::explain`]: ../struct.Element.html#method.explain
|
2019-10-09 05:36:49 +02:00
|
|
|
fn explain<Message>(
|
|
|
|
|
&mut self,
|
2019-12-30 12:14:26 +01:00
|
|
|
defaults: &Self::Defaults,
|
2019-10-09 05:36:49 +02:00
|
|
|
widget: &dyn Widget<Message, Self>,
|
|
|
|
|
layout: Layout<'_>,
|
|
|
|
|
cursor_position: Point,
|
|
|
|
|
color: Color,
|
2019-10-11 22:15:39 +02:00
|
|
|
) -> Self::Output;
|
2019-10-09 05:36:49 +02:00
|
|
|
}
|