Remove the label! macro
This commit is contained in:
parent
68598db7e3
commit
6de93cb0ec
5 changed files with 8 additions and 15 deletions
|
@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
* Changed default font to [Ubuntu-Light](https://fonts.google.com/specimen/Ubuntu).
|
* Changed default font to [Ubuntu-Light](https://fonts.google.com/specimen/Ubuntu).
|
||||||
|
|
||||||
|
### Removed 🔥
|
||||||
|
|
||||||
|
* Removed the `label!` macro
|
||||||
|
|
||||||
## 0.4.0 - 2020-11-28
|
## 0.4.0 - 2020-11-28
|
||||||
|
|
||||||
### Added ⭐
|
### Added ⭐
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl DemoWindow {
|
||||||
ui.add(Slider::usize(&mut self.num_columns, 1..=10).text("Columns"));
|
ui.add(Slider::usize(&mut self.num_columns, 1..=10).text("Columns"));
|
||||||
ui.columns(self.num_columns, |cols| {
|
ui.columns(self.num_columns, |cols| {
|
||||||
for (i, col) in cols.iter_mut().enumerate() {
|
for (i, col) in cols.iter_mut().enumerate() {
|
||||||
col.add(label!("Column {} out of {}", i + 1, self.num_columns));
|
col.label(format!("Column {} out of {}", i + 1, self.num_columns));
|
||||||
if i + 1 == self.num_columns && col.button("Delete this").clicked {
|
if i + 1 == self.num_columns && col.button("Delete this").clicked {
|
||||||
self.num_columns -= 1;
|
self.num_columns -= 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl FractalClock {
|
||||||
|
|
||||||
fn options_ui(&mut self, ui: &mut Ui, seconds_since_midnight: Option<f64>) {
|
fn options_ui(&mut self, ui: &mut Ui, seconds_since_midnight: Option<f64>) {
|
||||||
if seconds_since_midnight.is_some() {
|
if seconds_since_midnight.is_some() {
|
||||||
ui.add(label!(
|
ui.label(format!(
|
||||||
"Local time: {:02}:{:02}:{:02}.{:03}",
|
"Local time: {:02}:{:02}:{:02}.{:03}",
|
||||||
(self.time % (24.0 * 60.0 * 60.0) / 3600.0).floor(),
|
(self.time % (24.0 * 60.0 * 60.0) / 3600.0).floor(),
|
||||||
(self.time % (60.0 * 60.0) / 60.0).floor(),
|
(self.time % (60.0 * 60.0) / 60.0).floor(),
|
||||||
|
@ -77,9 +77,7 @@ impl FractalClock {
|
||||||
(self.time % 1.0 * 100.0).floor()
|
(self.time % 1.0 * 100.0).floor()
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
ui.add(label!(
|
ui.label("The fractal_clock clock is not showing the correct time");
|
||||||
"The fractal_clock clock is not showing the correct time"
|
|
||||||
));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ui.checkbox(&mut self.paused, "Paused");
|
ui.checkbox(&mut self.paused, "Paused");
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl Widgets {
|
||||||
{
|
{
|
||||||
self.count += 1;
|
self.count += 1;
|
||||||
}
|
}
|
||||||
ui.add(label!("The button has been clicked {} times", self.count));
|
ui.label(format!("The button has been clicked {} times", self.count));
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.separator();
|
ui.separator();
|
||||||
|
|
|
@ -123,15 +123,6 @@ impl Label {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shortcut for creating a `Label` widget.
|
|
||||||
///
|
|
||||||
/// Usage: `label!("Foo: {}", bar)` equivalent to `Label::new(format!("Foo: {}", bar))`.
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! label {
|
|
||||||
($fmt:expr) => ($crate::widgets::Label::new($fmt));
|
|
||||||
($fmt:expr, $($arg:tt)*) => ($crate::widgets::Label::new(format!($fmt, $($arg)*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Widget for Label {
|
impl Widget for Label {
|
||||||
fn ui(self, ui: &mut Ui) -> Response {
|
fn ui(self, ui: &mut Ui) -> Response {
|
||||||
let galley = self.layout(ui);
|
let galley = self.layout(ui);
|
||||||
|
|
Loading…
Reference in a new issue