use crate::{
list::{List, ListItem},
paragraph::Paragraph,
table::{Row, Table},
};
pub trait Focusable {
fn focus(self, focus: bool) -> Self;
fn is_focused(&self) -> bool;
}
impl<'a, Item, Message> Focusable for List<'a, Item, Message>
where
Item: Clone + Into<ListItem<'a>>,
{
fn focus(mut self, focus: bool) -> Self {
self.focus = focus;
self
}
fn is_focused(&self) -> bool {
self.focus
}
}
impl<'a, Item, Message> Focusable for Table<'a, Item, Message>
where
Item: Clone + Into<Row<'a>>,
{
fn focus(mut self, focus: bool) -> Self {
self.focus = focus;
self
}
fn is_focused(&self) -> bool {
self.focus
}
}
impl<'a> Focusable for Paragraph<'a> {
fn focus(mut self, focus: bool) -> Self {
self.focus = focus;
self
}
fn is_focused(&self) -> bool {
self.focus
}
}