use iced::Container; use iced::Row; use iced::Element; use iced::Sandbox; use iced::Length; mod lyrics; mod styles; use styles::Theme; #[derive(Clone, Debug)] pub struct DelyriumApp { lyrics_component: lyrics::Lyrics, theme: Theme, } #[derive(Clone, Debug)] pub enum Message { LyricChanged { line_no: usize, new_value: String, }, } impl Sandbox for DelyriumApp { type Message = Message; fn new() -> Self { DelyriumApp { lyrics_component: lyrics::Lyrics::new(), theme: Theme::default(), } } fn title(&self) -> String { String::from("Delyrium") } fn update(&mut self, message: Message) { self.lyrics_component.update(&message); } fn view(&mut self) -> Element { Container::new( Row::new() .push(self.lyrics_component.view()) ) .style(self.theme) .height(Length::Fill) .into() } }