ferroui_base/media/
text_decorations.rs1use crate::media::{TextDecoration, TextDecorationCollection, TextDecorationLocation};
2
3pub struct TextDecorations;
5
6fn create(location: TextDecorationLocation) -> TextDecorationCollection {
7 let text_decoration = TextDecoration::new();
8 text_decoration.set_location(location);
9 TextDecorationCollection::from_items([text_decoration])
10}
11
12macro_rules! text_decorations {
13 ($(#[$meta:meta])* $name:ident, $location:ident) => {
14 $(#[$meta])*
15 pub fn $name() -> TextDecorationCollection {
16 crate::ferro_thread_local! {
17 static VALUE: TextDecorationCollection = create(TextDecorationLocation::$location);
18 }
19 VALUE.with(Clone::clone)
20 }
21 };
22}
23
24impl TextDecorations {
25 text_decorations!(
26 underline, Underline
28 );
29
30 text_decorations!(
31 strikethrough, Strikethrough
33 );
34
35 text_decorations!(
36 overline, Overline
38 );
39
40 text_decorations!(
41 baseline, Baseline
43 );
44}