zoodex/src/ui/collatable_container/collation_menu/mod.rs

56 lines
1.3 KiB
Rust

mod sort_button ;
use {
gtk4 :: { Box , Align :: * , Orientation :: * , prelude :: * } ,
std :: ops :: * ,
} ;
use crate :: ui :: {
component :: * , utility :: * ,
collatable_container :: { * , collation_menu :: sort_button :: * } ,
} ;
pub struct FilmCollationMenu { widget : Box }
pub struct SeriesCollationMenu { widget : Box }
impl FilmCollationMenu {
pub fn new < F : Fn (FilmsSorting) + 'static > ( on_sort : F ) -> Self {
let film_sort_button = FilmSortButton :: new (on_sort) ;
let widget = g_box ! (
@ orientation : Horizontal ;
@ halign : Center ;
@ spacing : 20 ;
@ widget_name : "film-collation-menu" ;
@ css_classes : [ "toolbar" ] ;
* film_sort_button . get_widget () ,
) ;
Self { widget }
}
}
impl SeriesCollationMenu {
pub fn new < F : Fn (SeriesSorting) + 'static > ( on_sort : F ) -> Self {
let series_sort_button = SeriesSortButton :: new (on_sort) ;
let widget = g_box ! (
@ orientation : Horizontal ;
@ halign : Center ;
@ spacing : 20 ;
@ widget_name : "series-collation-menu" ;
@ css_classes : [ "toolbar" ] ;
* series_sort_button . get_widget () ,
) ;
Self { widget }
}
}
impl Component <Box> for FilmCollationMenu {
fn get_widget ( & self ) -> & Box { & self . widget }
}
impl Component <Box> for SeriesCollationMenu {
fn get_widget ( & self ) -> & Box { & self . widget }
}