use segmented_button from iced_aw (personal branch for latest iced)

Signed-off-by: Fabrizio Iannetti <fabrizio.iannetti@gmail.com>
This commit is contained in:
Fabrizio Iannetti 2024-04-27 09:40:47 +02:00
parent 0d528bd961
commit f670e0c83d
3 changed files with 18 additions and 9 deletions

9
Cargo.lock generated
View File

@ -464,6 +464,7 @@ dependencies = [
"directories", "directories",
"icalendar", "icalendar",
"iced", "iced",
"iced_aw",
"log", "log",
"lttng-ust", "lttng-ust",
"lttng-ust-generate", "lttng-ust-generate",
@ -1597,6 +1598,14 @@ dependencies = [
"thiserror", "thiserror",
] ]
[[package]]
name = "iced_aw"
version = "0.8.0"
dependencies = [
"cfg-if",
"iced",
]
[[package]] [[package]]
name = "iced_core" name = "iced_core"
version = "0.13.0-dev" version = "0.13.0-dev"

View File

@ -10,6 +10,7 @@ tracing = ["dep:lttng-ust"]
#iced = "0.4.2" #iced = "0.4.2"
#iced_native = "0.5.1" #iced_native = "0.5.1"
iced = { path = "../iced", features = ["advanced"] } iced = { path = "../iced", features = ["advanced"] }
iced_aw = { path = "../iced_aw", default-features = false, features = ["segmented_button", "tab_bar", "icons"] }
chrono = "0.4" chrono = "0.4"
lttng-ust = { version = "0.1.0", optional = true } lttng-ust = { version = "0.1.0", optional = true }
icalendar = "0.15.4" icalendar = "0.15.4"

View File

@ -10,12 +10,13 @@ use iced::{
Length, Length,
widget::{ widget::{
button, button,
row,
Row, Row,
Button, Button,
Text, Text, text,
pick_list,
}, },
}; };
use iced_aw::widgets::segmented_button::SegmentedButton;
//#[derive(Default)] //#[derive(Default)]
pub struct Controls { pub struct Controls {
@ -56,13 +57,11 @@ impl Controls {
.align_items(Alignment::Center) .align_items(Alignment::Center)
.padding(5) .padding(5)
.spacing(10) .spacing(10)
.push( .push(row![
pick_list( SegmentedButton::new(text("Week"), ViewMode::Week, self.mode, Message::ViewModeSelected),
&Controls::MODES[..], SegmentedButton::new(text("Month"), ViewMode::Month, self.mode, Message::ViewModeSelected),
self.mode, SegmentedButton::new(text("Year"), ViewMode::Year, self.mode, Message::ViewModeSelected),
Message::ViewModeSelected, ])
).placeholder("mode")
)
.push( .push(
Button::new(Text::new("<")) Button::new(Text::new("<"))
.on_press(self.get_msg_prev()) .on_press(self.get_msg_prev())