summaryrefslogtreecommitdiffstats
path: root/widget/src/combo_box.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-12 16:40:56 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-12 16:40:56 +0100
commitb721fd935c6b689b1365e21dfc864e43bf3a5895 (patch)
tree3b556e5c4b3398d64339ee8e0a35bd860753a350 /widget/src/combo_box.rs
parent3e190b9ee0d95d73008dab23b18117e0a21223d8 (diff)
downloadiced-b721fd935c6b689b1365e21dfc864e43bf3a5895.tar.gz
iced-b721fd935c6b689b1365e21dfc864e43bf3a5895.tar.bz2
iced-b721fd935c6b689b1365e21dfc864e43bf3a5895.zip
Use closures for `PickList::style`
Diffstat (limited to 'widget/src/combo_box.rs')
-rw-r--r--widget/src/combo_box.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/widget/src/combo_box.rs b/widget/src/combo_box.rs
index 95667882..ee24d742 100644
--- a/widget/src/combo_box.rs
+++ b/widget/src/combo_box.rs
@@ -42,7 +42,7 @@ pub struct ComboBox<
on_option_hovered: Option<Box<dyn Fn(T) -> Message>>,
on_close: Option<Message>,
on_input: Option<Box<dyn Fn(String) -> Message>>,
- menu_style: menu::Style<Theme>,
+ menu_style: menu::Style<'a, Theme>,
padding: Padding,
size: Option<f32>,
}
@@ -125,7 +125,7 @@ where
}
/// Sets the style of the [`ComboBox`].
- pub fn style(mut self, style: impl Into<Style<Theme>>) -> Self
+ pub fn style(mut self, style: impl Into<Style<'a, Theme>>) -> Self
where
Theme: 'a,
{
@@ -672,7 +672,7 @@ where
self.state.sync_filtered_options(filtered_options);
- let mut menu = menu::Menu::with_style(
+ let mut menu = menu::Menu::new(
menu,
&filtered_options.options,
hovered_option,
@@ -686,7 +686,7 @@ where
(self.on_selected)(x)
},
self.on_option_hovered.as_deref(),
- self.menu_style,
+ &self.menu_style,
)
.width(bounds.width)
.padding(self.padding);
@@ -765,27 +765,27 @@ where
/// The style of a [`ComboBox`].
#[allow(missing_debug_implementations)]
-pub struct Style<Theme> {
+pub struct Style<'a, Theme> {
/// The style of the [`TextInput`] of the [`ComboBox`].
- pub text_input: text_input::Style<'static, Theme>,
+ pub text_input: text_input::Style<'a, Theme>,
/// The style of the [`Menu`] of the [`ComboBox`].
///
/// [`Menu`]: menu::Menu
- pub menu: menu::Style<Theme>,
+ pub menu: menu::Style<'a, Theme>,
}
/// The default style of a [`ComboBox`].
pub trait DefaultStyle: Sized {
/// Returns the default style of a [`ComboBox`].
- fn default_style() -> Style<Self>;
+ fn default_style() -> Style<'static, Self>;
}
impl DefaultStyle for Theme {
- fn default_style() -> Style<Self> {
+ fn default_style() -> Style<'static, Self> {
Style {
text_input: Box::new(text_input::default),
- menu: menu::Style::DEFAULT,
+ menu: menu::DefaultStyle::default_style(),
}
}
}