pub struct Text { /* private fields */ }Expand description
A line of text.
The text, ellipsis and max_lines change the layout. Color and font
come from the nearest widget whose Style sets them, starting with the
text’s own.
Implementations§
Source§impl Text
impl Text
Sourcepub fn new(text: impl IntoProp<String>) -> Text
pub fn new(text: impl IntoProp<String>) -> Text
Text showing text: a string, or a closure that returns a String.
Sourcepub fn ellipsis(self, ellipsis: impl IntoProp<bool>) -> Text
pub fn ellipsis(self, ellipsis: impl IntoProp<bool>) -> Text
When on, text that doesn’t fit ends in “…” instead of being cut off. Off by default.
Sourcepub fn max_lines(self, max_lines: impl IntoProp<u32>) -> Text
pub fn max_lines(self, max_lines: impl IntoProp<u32>) -> Text
Lets the text wrap onto at most this many lines, at word boundaries, or inside a word too long for a line. The default is 1, which never wraps. 0 counts as 1.
Sourcepub fn visible(self, visible: impl IntoProp<bool>) -> Self
pub fn visible(self, visible: impl IntoProp<bool>) -> Self
Shows or hides the widget. Hidden, it is taken out of the layout, so its space goes to the others, and it isn’t drawn, hit or reached by Tab; it drops the keyboard focus and the pointer. Its bindings and state stay, so it shows again as it was. Shown by default.
Sourcepub fn geometry(self, geometry: Signal<Rect>) -> Self
pub fn geometry(self, geometry: Signal<Rect>) -> Self
Shares where the widget is: after each layout that moves or
resizes it, its laid-out rectangle in the window’s logical
pixels, scrolled with any scroll view around it but not moved by
a style’s translate, scale or rotate, is written to geometry. A
hidden widget writes nothing. An effect that reads it may change
the layout: the window is laid out again at once, until nothing
moves.