aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
blob: d103b638225bf5b32d286a05bc83805f153f2b80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
}