modified: src/widget.rs

This commit is contained in:
Michael Wain 2024-12-14 05:21:43 +03:00
parent cb6beb71d8
commit 3d89e51418

View File

@ -13,20 +13,20 @@ pub fn basic_btn(s: &str) -> button::Button<Message> {
} }
// the value T should be something, that inherits ActionWindow // the value T should be something, that inherits ActionWindow
enum SidebarTab<T> where T: ActionWindow { enum SidebarTab {
Youtube(T), Youtube(String),
/*Spotify(T), Spotify(String),
Soundcloud(T), Soundcloud(String),
ITunes(T), ITunes(String),
Playlists(T), Playlists(String),
FileSystem(T), FileSystem(String),
Metadata(T), Metadata(String),
FindCopies(T),*/ FindCopies(String),
Settings(SettingsWindow) Settings(String)
} }
pub struct SidebarGroup { pub struct SidebarGroup {
tabs: Vec<SidebarTab<dyn ActionWindow>>, tabs: Vec<(SidebarTab, Box<dyn ActionWindow>)>,
name: String name: String
} }
@ -57,9 +57,21 @@ impl ActionWindow for SettingsWindow {
} }
} }
pub struct YTWindow {}
impl ActionWindow for YTWindow {
fn view(&self) -> Element<Message> {
todo!()
}
fn update(&mut self, message: Message) -> Command<Message> {
todo!()
}
}
pub struct SplitView<T> where T: ActionWindow { pub struct SplitView<T> where T: ActionWindow {
sidebar: Vec<SidebarGroup>, sidebar: Vec<SidebarGroup>,
main: Option<T> selected: Option<(SidebarTab, Box<dyn ActionWindow>)>
} }
impl<T: ActionWindow> SplitView<T> { impl<T: ActionWindow> SplitView<T> {
@ -72,6 +84,6 @@ impl<T: ActionWindow> SplitView<T> {
} }
pub fn new() -> Self { pub fn new() -> Self {
Self{ sidebar: Vec::new(), main: None } Self{ sidebar: Vec::new(), selected: None }
} }
} }