1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

[ui] add ui.heading(text) helper function

This commit is contained in:
Emil Ernerfeldt
2020-08-28 15:47:43 +02:00
parent 056c0ad794
commit 5f919e22a9
2 changed files with 9 additions and 0 deletions

View File

@@ -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))

View File

@@ -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