Move Debugger and Windowed to a better location
We move `renderer::Debugger` to `layout::Debugger` and `renderer::Windowed` to `window::Renderer`.
This commit is contained in:
parent
d15d1156bd
commit
e45497dfd6
10 changed files with 27 additions and 29 deletions
|
|
@ -1,26 +0,0 @@
|
|||
use crate::{Color, Layout, Point, Widget};
|
||||
|
||||
/// A renderer able to graphically explain a [`Layout`].
|
||||
///
|
||||
/// [`Layout`]: ../struct.Layout.html
|
||||
pub trait Debugger: super::Renderer {
|
||||
/// 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
|
||||
/// [`Element`]: struct.Element.html
|
||||
/// [`Element::explain`]: struct.Element.html#method.explain
|
||||
fn explain<Message>(
|
||||
&mut self,
|
||||
defaults: &Self::Defaults,
|
||||
widget: &dyn Widget<Message, Self>,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
color: Color,
|
||||
) -> Self::Output;
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
use crate::MouseCursor;
|
||||
|
||||
use raw_window_handle::HasRawWindowHandle;
|
||||
|
||||
/// A renderer that can target windows.
|
||||
pub trait Windowed: super::Renderer + Sized {
|
||||
/// The settings of the renderer.
|
||||
type Settings: Default;
|
||||
|
||||
/// The type of target.
|
||||
type Target: Target<Renderer = Self>;
|
||||
|
||||
/// Creates a new [`Windowed`] renderer.
|
||||
///
|
||||
/// [`Windowed`]: trait.Windowed.html
|
||||
fn new(settings: Self::Settings) -> Self;
|
||||
|
||||
/// Performs the drawing operations described in the output on the given
|
||||
/// target.
|
||||
///
|
||||
/// The overlay can be a bunch of debug text logs. It should be rendered on
|
||||
/// top of the GUI on most scenarios.
|
||||
fn draw<T: AsRef<str>>(
|
||||
&mut self,
|
||||
output: &Self::Output,
|
||||
overlay: &[T],
|
||||
target: &mut Self::Target,
|
||||
) -> MouseCursor;
|
||||
}
|
||||
|
||||
/// A rendering target.
|
||||
pub trait Target {
|
||||
/// The renderer of this target.
|
||||
type Renderer;
|
||||
|
||||
/// Creates a new rendering [`Target`] from the given window handle, width,
|
||||
/// height and dpi factor.
|
||||
///
|
||||
/// [`Target`]: trait.Target.html
|
||||
fn new<W: HasRawWindowHandle>(
|
||||
window: &W,
|
||||
width: u16,
|
||||
height: u16,
|
||||
dpi: f32,
|
||||
renderer: &Self::Renderer,
|
||||
) -> Self;
|
||||
|
||||
/// Resizes the current [`Target`].
|
||||
///
|
||||
/// [`Target`]: trait.Target.html
|
||||
fn resize(
|
||||
&mut self,
|
||||
width: u16,
|
||||
height: u16,
|
||||
dpi: f32,
|
||||
renderer: &Self::Renderer,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue