Browse Source

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

pull/20/head
Emil Ernerfeldt 4 years ago
parent
commit
5f919e22a9
  1. 5
      egui/src/ui.rs
  2. 4
      egui/src/widgets.rs

5
egui/src/ui.rs

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

4
egui/src/widgets.rs

@ -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…
Cancel
Save