diff --git a/Cargo.lock b/Cargo.lock index e6ea77e..293ecdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -464,6 +464,7 @@ dependencies = [ "directories", "icalendar", "iced", + "iced_aw", "log", "lttng-ust", "lttng-ust-generate", @@ -1597,6 +1598,14 @@ dependencies = [ "thiserror", ] +[[package]] +name = "iced_aw" +version = "0.8.0" +dependencies = [ + "cfg-if", + "iced", +] + [[package]] name = "iced_core" version = "0.13.0-dev" diff --git a/Cargo.toml b/Cargo.toml index 4d68a7f..7a7ee3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ tracing = ["dep:lttng-ust"] #iced = "0.4.2" #iced_native = "0.5.1" iced = { path = "../iced", features = ["advanced"] } +iced_aw = { path = "../iced_aw", default-features = false, features = ["segmented_button", "tab_bar", "icons"] } chrono = "0.4" lttng-ust = { version = "0.1.0", optional = true } icalendar = "0.15.4" diff --git a/src/ui/controls.rs b/src/ui/controls.rs index 538e5ea..445f708 100644 --- a/src/ui/controls.rs +++ b/src/ui/controls.rs @@ -10,12 +10,13 @@ use iced::{ Length, widget::{ button, + row, Row, Button, - Text, - pick_list, + Text, text, }, }; +use iced_aw::widgets::segmented_button::SegmentedButton; //#[derive(Default)] pub struct Controls { @@ -56,13 +57,11 @@ impl Controls { .align_items(Alignment::Center) .padding(5) .spacing(10) - .push( - pick_list( - &Controls::MODES[..], - self.mode, - Message::ViewModeSelected, - ).placeholder("mode") - ) + .push(row![ + SegmentedButton::new(text("Week"), ViewMode::Week, self.mode, Message::ViewModeSelected), + SegmentedButton::new(text("Month"), ViewMode::Month, self.mode, Message::ViewModeSelected), + SegmentedButton::new(text("Year"), ViewMode::Year, self.mode, Message::ViewModeSelected), + ]) .push( Button::new(Text::new("<")) .on_press(self.get_msg_prev())