wip: slowly putting it back together

This commit is contained in:
🪞👃🪞 2024-09-04 22:39:43 +03:00
parent 7fbb40fad6
commit 461c60d6b3
18 changed files with 788 additions and 774 deletions

View file

@ -1,7 +1,7 @@
use crate::*;
/// A component that may contain [Focusable] components.
pub trait Focus <'a, const N: usize, T, U>: Render<'a, T, U> + Handle {
pub trait Focus <const N: usize, T, U>: Render<T, U> + Handle<T, U> {
fn focus (&self) -> usize;
fn focus_mut (&mut self) -> &mut usize;
fn focusable (&self) -> [&dyn Focusable<T, U>;N];
@ -33,13 +33,13 @@ pub trait Focus <'a, const N: usize, T, U>: Render<'a, T, U> + Handle {
}
/// A component that may be focused.
pub trait Focusable<'a, T, U>: Render<'a, T, U> + Handle {
pub trait Focusable<T, U>: Render<T, U> + Handle<T, U> {
fn is_focused (&self) -> bool;
fn set_focused (&mut self, focused: bool);
}
impl<'a, F: Focusable<'a, T, U>, T, U> Focusable<'a, T, U> for Option<F>
where Option<F>: Render<'a, T, U>
impl<F: Focusable<T, U>, T, U> Focusable<T, U> for Option<F>
where Option<F>: Render<T, U>
{
fn is_focused (&self) -> bool {
match self {