@@ -55,8 +55,14 @@ pub use geometry::{Affine, Point, Rect, Size, Vec2};
55
55
pub enum Role {
56
56
#[ default]
57
57
Unknown ,
58
+
59
+ /// Should be used for selectable Text. For each line of text one `TextRun` should be used.
60
+ /// Each one of them should be added as a child to a `Label`, `TextInput`, `MultiLineTextInput`
61
+ /// or similar [`Node`]. The selection can be specified with [`Node::set_text_selection`] on the
62
+ /// parent [`Node`].
58
63
TextRun ,
59
64
Cell ,
65
+ /// If the text should be selectable see the documentation at [`Role::MultilineTextInput`].
60
66
Label ,
61
67
Image ,
62
68
Link ,
@@ -79,6 +85,8 @@ pub enum Role {
79
85
80
86
CheckBox ,
81
87
RadioButton ,
88
+
89
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
82
90
TextInput ,
83
91
Button ,
84
92
DefaultButton ,
@@ -94,17 +102,31 @@ pub enum Role {
94
102
Switch ,
95
103
Menu ,
96
104
105
+ /// `MultilineTextInput` should have a child with [`Role::TextRun`] for each line of text.
106
+ /// For text selection [`Node::set_text_selection`] and [`Node::set_character_lengths`] are necessary.
107
+ /// These should be used on the `MultilineTextInput` node and not on the `TextRun` nodes.
97
108
MultilineTextInput ,
109
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
98
110
SearchInput ,
111
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
99
112
DateInput ,
113
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
100
114
DateTimeInput ,
115
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
101
116
WeekInput ,
117
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
102
118
MonthInput ,
119
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
103
120
TimeInput ,
121
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
104
122
EmailInput ,
123
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
105
124
NumberInput ,
125
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
106
126
PasswordInput ,
127
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
107
128
PhoneNumberInput ,
129
+ /// To make the text selectable see the documentation at [`Role::MultilineTextInput`].
108
130
UrlInput ,
109
131
110
132
Abbr ,
@@ -1989,6 +2011,11 @@ property_methods! {
1989
2011
/// [`transform`]: Node::transform
1990
2012
( Bounds , bounds, get_rect_property, Option <Rect >, set_bounds, set_rect_property, Rect , clear_bounds) ,
1991
2013
2014
+ /// Text selection should be added to the parent [`Node`] of the `TextRun` nodes.
2015
+ /// In [`TextSelection`] the line of selected text is specified by setting the [`NodeId`]
2016
+ /// to the `TextRun` that holds the selected line.
2017
+ ///
2018
+ /// For text selection to work correctly [`Node::character_lengths`] needs to be set as well.
1992
2019
( TextSelection , text_selection, get_text_selection_property, Option <& TextSelection >, set_text_selection, set_text_selection_property, impl Into <Box <TextSelection >>, clear_text_selection)
1993
2020
}
1994
2021
0 commit comments