Add Ui::hyperlink_to
This commit is contained in:
parent
9e38674d13
commit
21c99e1130
4 changed files with 16 additions and 8 deletions
|
@ -11,8 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
### Added ⭐
|
||||
|
||||
* Added `egui::plot::Plot` to plot some 2D data
|
||||
|
||||
* Add `egui::plot::Plot` to plot some 2D data
|
||||
* Add `Ui::hyperlink_to(label, url)`.
|
||||
|
||||
## 0.9.0 - 2021-02-07 - Light Mode and much more
|
||||
|
||||
|
|
|
@ -819,6 +819,16 @@ impl Ui {
|
|||
self.add(Hyperlink::new(url))
|
||||
}
|
||||
|
||||
/// Shortcut for `add(Hyperlink::new(url).text(label))`
|
||||
///
|
||||
/// ```
|
||||
/// # let ui = &mut egui::Ui::__test();
|
||||
/// ui.hyperlink_to("egui on GitHub", "https://www.github.com/emilk/egui/");
|
||||
/// ```
|
||||
pub fn hyperlink_to(&mut self, label: impl Into<String>, url: impl Into<String>) -> Response {
|
||||
self.add(Hyperlink::new(url).text(label))
|
||||
}
|
||||
|
||||
#[deprecated = "Use `text_edit_singleline` or `text_edit_multiline`"]
|
||||
pub fn text_edit(&mut self, text: &mut String) -> Response {
|
||||
self.text_edit_multiline(text)
|
||||
|
|
|
@ -100,9 +100,7 @@ impl DemoWindows {
|
|||
|
||||
ScrollArea::auto_sized().show(ui, |ui| {
|
||||
ui.label("egui is an immediate mode GUI library written in Rust.");
|
||||
ui.add(
|
||||
egui::Hyperlink::new("https://github.com/emilk/egui").text(" egui home page"),
|
||||
);
|
||||
ui.hyperlink_to(" egui home page", "https://github.com/emilk/egui");
|
||||
|
||||
ui.label("egui can be run on the web, or natively on 🐧");
|
||||
|
||||
|
|
|
@ -93,9 +93,9 @@ impl FractalClock {
|
|||
|
||||
egui::reset_button(ui, self);
|
||||
|
||||
ui.add(
|
||||
Hyperlink::new("http://www.dqd.com/~mayoff/programs/FractalClock/")
|
||||
.text("Inspired by a screensaver by Rob Mayoff"),
|
||||
ui.hyperlink_to(
|
||||
"Inspired by a screensaver by Rob Mayoff",
|
||||
"http://www.dqd.com/~mayoff/programs/FractalClock/",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue