chore: Rebase Iced

This commit is contained in:
Michael Aaron Murphy 2022-12-19 17:03:13 +01:00
parent 50b8131e21
commit 6e30394270
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
4 changed files with 11 additions and 15 deletions

View file

@ -8,7 +8,7 @@ use cosmic::{
},
iced::{self, Alignment, Application, Command, Length},
iced_lazy::responsive,
iced_winit::window::{drag, toggle_maximize, minimize},
iced_winit::window::{close, drag, toggle_maximize, minimize},
theme::{self, Theme},
widget::{button, nav_button, nav_bar, nav_bar_page, nav_bar_section, header_bar, settings, scrollable, toggler, spin_button::{SpinButtonModel, SpinMessage}},
Element,
@ -31,7 +31,6 @@ pub struct Window {
sidebar_toggled: bool,
show_minimize: bool,
show_maximize: bool,
exit: bool,
}
impl Window {
@ -108,9 +107,9 @@ impl Application for Window {
},
Message::TogglerToggled(value) => self.toggler_value = value,
Message::PickListSelected(value) => self.pick_list_selected = Some(value),
Message::Close => self.exit = true,
Message::ToggleSidebar => self.sidebar_toggled = !self.sidebar_toggled,
Message::Drag => return drag(window::Id::new(0)),
Message::Close => return close(window::Id::new(0)),
Message::Minimize => return minimize(window::Id::new(0), true),
Message::Maximize => return toggle_maximize(window::Id::new(0)),
Message::RowSelected(row) => println!("Selected row {row}"),
@ -330,10 +329,6 @@ impl Application for Window {
column(vec![header, content]).into()
}
fn should_exit(&self) -> bool {
self.exit
}
fn theme(&self) -> Theme {
self.theme
}

2
iced

@ -1 +1 @@
Subproject commit 8ce93dd2922aebfe134b43302209f78f93c43546
Subproject commit 4c92b828a3866d524d31738dd68e5dd84f208d0d

View file

@ -164,7 +164,7 @@ impl button::StyleSheet for Theme {
if let Button::Custom {active, ..} = style {
return active(self);
}
let cosmic = style.cosmic(self);
button::Appearance {
@ -182,7 +182,7 @@ impl button::StyleSheet for Theme {
if let Button::Custom {hover, ..} = style {
return hover(self);
}
let active = self.active(&style);
let cosmic = style.cosmic(self);
@ -728,15 +728,15 @@ impl Hash for Svg {
impl svg::StyleSheet for Theme {
type Style = Svg;
fn appearance(&self, style: Self::Style) -> svg::Appearance {
fn appearance(&self, style: &Self::Style) -> svg::Appearance {
match style {
Svg::Default => svg::Appearance::default(),
Svg::Custom(appearance) => appearance(self),
Svg::Symbolic => svg::Appearance {
fill: Some(self.extended_palette().background.base.text),
color: Some(self.extended_palette().background.base.text),
},
Svg::SymbolicActive => svg::Appearance {
fill: Some(self.cosmic().accent.base.into()),
color: Some(self.cosmic().accent.base.into()),
},
}
}

View file

@ -66,8 +66,9 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
let mut widget = widget::row(packed)
.height(Length::Units(50))
.padding(10)
.apply(widget::event_container)
.center_y();
.apply(widget::container)
.center_y()
.apply(widget::mouse_listener);
if let Some(message) = self.on_drag.clone() {
widget = widget.on_press(message);