aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..d103b63
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,29 @@
+//! A text selection API built around `iced`'s [`Paragraph`].
+//!
+//! [`Paragraph`]: https://docs.iced.rs/iced_graphics/text/paragraph/struct.Paragraph.html
+
+pub mod selection;
+
+pub mod text;
+
+use iced_widget::core;
+pub use text::Text;
+
+/// Creates a new [`Text`] widget with the provided content.
+#[macro_export]
+macro_rules! text {
+ ($($arg:tt)*) => {
+ $crate::Text::new(format!($($arg)*))
+ };
+}
+
+/// Creates a new [`Text`] widget with the provided content.
+pub fn text<'a, Theme, Renderer>(
+ text: impl core::text::IntoFragment<'a>,
+) -> Text<'a, Theme, Renderer>
+where
+ Theme: text::Catalog + 'a,
+ Renderer: core::text::Renderer,
+{
+ Text::new(text)
+}