diff options
author | 2020-07-08 07:04:20 +0200 | |
---|---|---|
committer | 2020-07-08 11:29:21 +0200 | |
commit | 69ac47f463fd5c392f1f8e788fcf89b1a76abcae (patch) | |
tree | f4a4f6618766acd15d1d7ca726668c07ec9857dc /native/src/widget/combo_box.rs | |
parent | 1c12bad866d06b320f16609576d5937413418a0c (diff) | |
download | iced-69ac47f463fd5c392f1f8e788fcf89b1a76abcae.tar.gz iced-69ac47f463fd5c392f1f8e788fcf89b1a76abcae.tar.bz2 iced-69ac47f463fd5c392f1f8e788fcf89b1a76abcae.zip |
Implement `font` method for `ComboBox`
Diffstat (limited to 'native/src/widget/combo_box.rs')
-rw-r--r-- | native/src/widget/combo_box.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/native/src/widget/combo_box.rs b/native/src/widget/combo_box.rs index f6da076a..84789789 100644 --- a/native/src/widget/combo_box.rs +++ b/native/src/widget/combo_box.rs @@ -17,6 +17,7 @@ where width: Length, padding: u16, text_size: Option<u16>, + font: Renderer::Font, style: <Renderer as self::Renderer>::Style, } @@ -45,7 +46,8 @@ where width: Length::Shrink, text_size: None, padding: Renderer::DEFAULT_PADDING, - style: <Renderer as self::Renderer>::Style::default(), + font: Default::default(), + style: Default::default(), } } @@ -70,6 +72,11 @@ where self } + pub fn font(mut self, font: Renderer::Font) -> Self { + self.font = font; + self + } + /// Sets the style of the [`ComboBox`]. /// /// [`ComboBox`]: struct.ComboBox.html @@ -200,8 +207,9 @@ where layout.bounds(), cursor_position, self.selected.as_ref().map(ToString::to_string), - self.text_size.unwrap_or(renderer.default_size()), self.padding, + self.text_size.unwrap_or(renderer.default_size()), + self.font, &self.style, ) } @@ -244,8 +252,9 @@ pub trait Renderer: text::Renderer + menu::Renderer { bounds: Rectangle, cursor_position: Point, selected: Option<String>, - text_size: u16, padding: u16, + text_size: u16, + font: Self::Font, style: &<Self as Renderer>::Style, ) -> Self::Output; } |