diff options
author | 2024-09-04 21:25:59 +0200 | |
---|---|---|
committer | 2024-09-04 21:26:47 +0200 | |
commit | f98328f4f1ee58b6288e4f19d7475e7eeb9a7ba7 (patch) | |
tree | 8fb3e8b470bff711e0ca2f1bf120ab6c66ba9a9d /widget/src/checkbox.rs | |
parent | 8d826cc662554b337282e7c982383f5db428d7aa (diff) | |
download | iced-f98328f4f1ee58b6288e4f19d7475e7eeb9a7ba7.tar.gz iced-f98328f4f1ee58b6288e4f19d7475e7eeb9a7ba7.tar.bz2 iced-f98328f4f1ee58b6288e4f19d7475e7eeb9a7ba7.zip |
Add `text::Wrapping` support
Co-authored-by: Neeraj Jaiswal <neerajj85@gmail.com>
Diffstat (limited to 'widget/src/checkbox.rs')
-rw-r--r-- | widget/src/checkbox.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs index e5abfbb4..32db5090 100644 --- a/widget/src/checkbox.rs +++ b/widget/src/checkbox.rs @@ -50,6 +50,7 @@ pub struct Checkbox< text_size: Option<Pixels>, text_line_height: text::LineHeight, text_shaping: text::Shaping, + text_wrapping: text::Wrapping, font: Option<Renderer::Font>, icon: Icon<Renderer::Font>, class: Theme::Class<'a>, @@ -81,7 +82,8 @@ where spacing: Self::DEFAULT_SPACING, text_size: None, text_line_height: text::LineHeight::default(), - text_shaping: text::Shaping::Basic, + text_shaping: text::Shaping::default(), + text_wrapping: text::Wrapping::default(), font: None, icon: Icon { font: Renderer::ICON_FONT, @@ -158,6 +160,12 @@ where self } + /// Sets the [`text::Wrapping`] strategy of the [`Checkbox`]. + pub fn text_wrapping(mut self, wrapping: text::Wrapping) -> Self { + self.text_wrapping = wrapping; + self + } + /// Sets the [`Renderer::Font`] of the text of the [`Checkbox`]. /// /// [`Renderer::Font`]: crate::core::text::Renderer @@ -240,6 +248,7 @@ where alignment::Horizontal::Left, alignment::Vertical::Top, self.text_shaping, + self.text_wrapping, ) }, ) @@ -348,6 +357,7 @@ where horizontal_alignment: alignment::Horizontal::Center, vertical_alignment: alignment::Vertical::Center, shaping: *shaping, + wrapping: text::Wrapping::default(), }, bounds.center(), style.icon_color, |