summaryrefslogtreecommitdiff
path: root/iced_builder/src/widget.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2024-12-26 00:05:21 +0100
committerpml68 <contact@pml68.dev>2024-12-26 00:05:21 +0100
commit0515571231b387c2fa9c15f23b0d5a13958fae8b (patch)
treee92d0109599622984b2c485cc020951da288cec3 /iced_builder/src/widget.rs
parentrefactor: `views` -> `panes`, `mod.rs` -> `{panes,types}.rs` (diff)
downloadiced-builder-0515571231b387c2fa9c15f23b0d5a13958fae8b.tar.gz
feat: add `tip` widget helper from `hecrj/icebreaker`
Diffstat (limited to 'iced_builder/src/widget.rs')
-rw-r--r--iced_builder/src/widget.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/iced_builder/src/widget.rs b/iced_builder/src/widget.rs
new file mode 100644
index 0000000..ed2073a
--- /dev/null
+++ b/iced_builder/src/widget.rs
@@ -0,0 +1,21 @@
+use iced::widget::{container, text, tooltip};
+use iced::Element;
+
+pub mod tip {
+ pub use super::tooltip::Position;
+}
+
+pub fn tip<'a, Message: 'a>(
+ target: impl Into<Element<'a, Message>>,
+ tip: &'a str,
+ position: tip::Position,
+) -> Element<'a, Message> {
+ tooltip(
+ target,
+ container(text(tip).size(14))
+ .padding(5)
+ .style(container::rounded_box),
+ position,
+ )
+ .into()
+}