[ui] add ui.heading(text) helper function
This commit is contained in:
parent
056c0ad794
commit
5f919e22a9
2 changed files with 9 additions and 0 deletions
|
@ -456,6 +456,11 @@ impl Ui {
|
|||
self.add(label.into())
|
||||
}
|
||||
|
||||
/// Shortcut for `add(Label::new(text).heading())`
|
||||
pub fn heading(&mut self, label: impl Into<Label>) -> GuiResponse {
|
||||
self.add(label.into().heading())
|
||||
}
|
||||
|
||||
/// Shortcut for `add(Hyperlink::new(url))`
|
||||
pub fn hyperlink(&mut self, url: impl Into<String>) -> GuiResponse {
|
||||
self.add(Hyperlink::new(url))
|
||||
|
|
|
@ -67,6 +67,10 @@ impl Label {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn heading(self) -> Self {
|
||||
self.text_style(TextStyle::Heading)
|
||||
}
|
||||
|
||||
pub fn text_color(mut self, text_color: Color) -> Self {
|
||||
self.text_color = Some(text_color);
|
||||
self
|
||||
|
|
Loading…
Reference in a new issue