pub struct Node<M>(/* private fields */);Expand description
A piece of UI. Build it with the functions in this module.
Implementations§
Source§impl<M> Node<M>
impl<M> Node<M>
Sourcepub fn tone(self, tone: Tone) -> Self
pub fn tone(self, tone: Tone) -> Self
Sets the tone of this text, or of every text inside this node that has none yet.
Sourcepub fn on_hover(self, index: usize) -> Self
pub fn on_hover(self, index: usize) -> Self
For an alternate: shows the option at index while the pointer is over the item,
whatever current is. Other nodes have nothing to show on hover and ignore it.
Sourcepub fn on_secondary(self, message: M) -> Self
pub fn on_secondary(self, message: M) -> Self
Sourcepub fn prominent(self) -> Self
pub fn prominent(self) -> Self
For a button: the main action of its page, filled so it stands out. Other nodes ignore
it.
Sourcepub fn on_press(self, message: M) -> Self
pub fn on_press(self, message: M) -> Self
For a list_item: sent on a click on it. Other nodes ignore it.
Sourcepub fn trailing(self, node: Node<M>) -> Self
pub fn trailing(self, node: Node<M>) -> Self
For a list_item, section, header, text_input or text_area: a node at the
far end, like a lock or an info button. Other nodes ignore it.
Sourcepub fn shortcut(self, id: impl Into<String>, key: Shortcut) -> Self
pub fn shortcut(self, id: impl Into<String>, key: Shortcut) -> Self
For a list_item with an on_press, or a button in a popover or
dialog: a key that presses it while that is open, named id. key is the default: the
user can give it another key, or none, under that name in config.toml
(keys = { chat-1 = "alt+1" }). The host shows the key at the row’s end, or on the
button. A key with no Ctrl, Alt or Super does nothing while a text field has the focus, so
it can be typed. Nothing inside tabs gets a key. Other nodes ignore it.
Sourcepub fn selected(self, yes: bool) -> Self
pub fn selected(self, yes: bool) -> Self
For a list_item: marks it as the one in use. Other nodes ignore it.
Sourcepub fn on_back(self, message: M) -> Self
pub fn on_back(self, message: M) -> Self
For a header: shows a back button that sends message. Other nodes ignore it.
Sourcepub fn step(self, by: f32) -> Self
pub fn step(self, by: f32) -> Self
For a slider: the step its value snaps to (1 by default). Other nodes ignore it.
Sourcepub fn on_release(self, message: M) -> Self
pub fn on_release(self, message: M) -> Self
For a slider: sent when it’s let go. Other nodes ignore it.
Sourcepub fn on_submit(self, message: M) -> Self
pub fn on_submit(self, message: M) -> Self
For a text_input or text_area: sent on Enter. Other nodes ignore it.
Sourcepub fn secret(self, yes: bool) -> Self
pub fn secret(self, yes: bool) -> Self
For a text_input: hides what’s typed, like a password. Other nodes ignore it.
Sourcepub fn looping(self) -> Self
pub fn looping(self) -> Self
For a sprite: plays for as long as it shows, not only when it shows up or changes.
Every frame redraws the bar, so keep it for what wants your eye, or for popovers. Other
nodes ignore it.
Sourcepub fn large(self) -> Self
pub fn large(self) -> Self
For a cover: drawn big, as the main picture of a popover, not as an icon. Other nodes
ignore it.
Sourcepub fn bottom(self) -> Self
pub fn bottom(self) -> Self
For a scroll: keeps its end in view as content arrives there, unless you’ve scrolled
up to read. Other nodes ignore it.