From 69ac47f463fd5c392f1f8e788fcf89b1a76abcae Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 8 Jul 2020 07:04:20 +0200 Subject: Implement `font` method for `ComboBox` --- native/src/widget/combo_box.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'native/src/widget') 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, + font: Renderer::Font, style: ::Style, } @@ -45,7 +46,8 @@ where width: Length::Shrink, text_size: None, padding: Renderer::DEFAULT_PADDING, - style: ::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, - text_size: u16, padding: u16, + text_size: u16, + font: Self::Font, style: &::Style, ) -> Self::Output; } -- cgit