summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-02-23 03:16:37 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-02-23 03:16:37 +0100
commit2f766b73413fe60cd881e139fa0e84a0f0134d91 (patch)
tree8f640e109dd4f87653dd853c40b57ad82d89ed07 /native
parent9f60a256fc909dda0c30e301020d03d7ec28d722 (diff)
downloadiced-2f766b73413fe60cd881e139fa0e84a0f0134d91.tar.gz
iced-2f766b73413fe60cd881e139fa0e84a0f0134d91.tar.bz2
iced-2f766b73413fe60cd881e139fa0e84a0f0134d91.zip
Introduce `Tooltip::gap` to control spacing
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/tooltip.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/native/src/widget/tooltip.rs b/native/src/widget/tooltip.rs
index 72d03c1a..6da7b0ca 100644
--- a/native/src/widget/tooltip.rs
+++ b/native/src/widget/tooltip.rs
@@ -15,6 +15,7 @@ pub struct Tooltip<'a, Message, Renderer: self::Renderer + text::Renderer> {
content: Element<'a, Message, Renderer>,
tooltip: Text<Renderer>,
position: Position,
+ gap: u16,
}
impl<'a, Message, Renderer> Tooltip<'a, Message, Renderer>
@@ -33,8 +34,15 @@ where
content: content.into(),
tooltip,
position,
+ gap: 0,
}
}
+
+ /// Sets the gap between the content and its [`Tooltip`].
+ pub fn gap(mut self, gap: u16) -> Self {
+ self.gap = gap;
+ self
+ }
}
/// The position of the tooltip. Defaults to following the cursor.
@@ -109,6 +117,7 @@ where
&self.content,
&self.tooltip,
self.position,
+ self.gap,
)
}
@@ -143,6 +152,7 @@ pub trait Renderer: crate::Renderer + text::Renderer {
content: &Element<'_, Message, Self>,
tooltip: &Text<Self>,
position: Position,
+ gap: u16,
) -> Self::Output;
}