Process -> Audio; Layers2 -> Layers

This commit is contained in:
🪞👃🪞 2024-09-10 11:45:18 +03:00
parent 1cbf8de4e4
commit cd8a808c21
20 changed files with 334 additions and 414 deletions

View file

@ -3,7 +3,10 @@ use crate::*;
pub trait Widget: Send + Sync {
type Engine: Engine;
fn layout (&self, to: <<Self as Widget>::Engine as Engine>::Area) ->
Perhaps<<<Self as Widget>::Engine as Engine>::Area>;
Perhaps<<<Self as Widget>::Engine as Engine>::Area>
{
Ok(Some(to))
}
fn render (&self, to: &mut Self::Engine) ->
Perhaps<<<Self as Widget>::Engine as Engine>::Area>;
}
@ -86,7 +89,10 @@ impl<E: Engine, W: Content<Engine = E>> Widget for W {
self.content().layout(to)
}
fn render (&self, to: &mut E) -> Perhaps<E::Area> {
self.content().render(to)
match self.layout(to.area())? {
Some(area) => to.render_in(area, &self.content()),
None => Ok(None)
}
}
}