diff options
author | 2024-06-10 23:03:02 +0200 | |
---|---|---|
committer | 2024-06-10 23:03:02 +0200 | |
commit | bda01567d59c00e42e5a208ee6d9ec4153d5c195 (patch) | |
tree | 77b52f1fc6598abd983ee9f955a92c26d4e0db7d /widget | |
parent | 49affc44ff57ad879a73d9b4d329863d6f4b1d2c (diff) | |
parent | e2b00f98a0fab96da6502610b135a4c86fbd63b5 (diff) | |
download | iced-bda01567d59c00e42e5a208ee6d9ec4153d5c195.tar.gz iced-bda01567d59c00e42e5a208ee6d9ec4153d5c195.tar.bz2 iced-bda01567d59c00e42e5a208ee6d9ec4153d5c195.zip |
Merge pull request #2457 from PolyMeilex/pick-list-menu-style
Allow for styling of the menu of a pick list
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/pick_list.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs index edccfdaa..97de5b48 100644 --- a/widget/src/pick_list.rs +++ b/widget/src/pick_list.rs @@ -161,6 +161,19 @@ where self } + /// Sets the style of the [`Menu`]. + #[must_use] + pub fn menu_style( + mut self, + style: impl Fn(&Theme) -> menu::Style + 'a, + ) -> Self + where + <Theme as menu::Catalog>::Class<'a>: From<menu::StyleFn<'a, Theme>>, + { + self.menu_class = (Box::new(style) as menu::StyleFn<'a, Theme>).into(); + self + } + /// Sets the style class of the [`PickList`]. #[cfg(feature = "advanced")] #[must_use] @@ -171,6 +184,17 @@ where self.class = class.into(); self } + + /// Sets the style class of the [`Menu`]. + #[cfg(feature = "advanced")] + #[must_use] + pub fn menu_class( + mut self, + class: impl Into<<Theme as menu::Catalog>::Class<'a>>, + ) -> Self { + self.menu_class = class.into(); + self + } } impl<'a, T, L, V, Message, Theme, Renderer> Widget<Message, Theme, Renderer> |