From 9c1ad93ae92b31557eccb3fc15b59697e68ebbf1 Mon Sep 17 00:00:00 2001 From: Leopold Luley Date: Sun, 25 Oct 2020 13:25:08 +0100 Subject: [PATCH 1/2] Add Checkbox::set_label function. --- CHANGELOG.md | 2 ++ druid/src/widget/checkbox.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a4c43155c..50db28e5c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ You can find its changes [documented below](#060---2020-06-01). - TextBox supports vertical movement ([#1280] by [@cmyr]) - Widgets can specify a baseline, flex rows can align baselines ([#1295] by [@cmyr]) - `TextBox::with_text_color` and `TextBox::set_text_color` ([#1320] by [@cmyr]) +- `Checkbox::set_label` to update the label. ([#1346] by [@finnerale]) ### Changed @@ -512,6 +513,7 @@ Last release without a changelog :( [#1311]: https://github.com/linebender/druid/pull/1311 [#1320]: https://github.com/linebender/druid/pull/1320 [#1326]: https://github.com/linebender/druid/pull/1326 +[#1346]: https://github.com/linebender/druid/pull/1346 [Unreleased]: https://github.com/linebender/druid/compare/v0.6.0...master [0.6.0]: https://github.com/linebender/druid/compare/v0.5.0...v0.6.0 diff --git a/druid/src/widget/checkbox.rs b/druid/src/widget/checkbox.rs index 09a6e91b19..6db64b348b 100644 --- a/druid/src/widget/checkbox.rs +++ b/druid/src/widget/checkbox.rs @@ -31,6 +31,11 @@ impl Checkbox { child_label: Label::new(label), } } + + /// Update the label. + pub fn set_label(&mut self, label: impl Into>) { + self.child_label.set_text(label); + } } impl Widget for Checkbox { From 57135f5afe8922c36c775e5f6c3b3c0b61f7c624 Mon Sep 17 00:00:00 2001 From: Leopold Luley Date: Sun, 25 Oct 2020 18:39:24 +0100 Subject: [PATCH 2/2] Clarify wording of Checkbox methods. --- CHANGELOG.md | 2 +- druid/src/widget/checkbox.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50db28e5c7..7a4af253ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ You can find its changes [documented below](#060---2020-06-01). - TextBox supports vertical movement ([#1280] by [@cmyr]) - Widgets can specify a baseline, flex rows can align baselines ([#1295] by [@cmyr]) - `TextBox::with_text_color` and `TextBox::set_text_color` ([#1320] by [@cmyr]) -- `Checkbox::set_label` to update the label. ([#1346] by [@finnerale]) +- `Checkbox::set_text` to update the label. ([#1346] by [@finnerale]) ### Changed diff --git a/druid/src/widget/checkbox.rs b/druid/src/widget/checkbox.rs index 6db64b348b..757547a73b 100644 --- a/druid/src/widget/checkbox.rs +++ b/druid/src/widget/checkbox.rs @@ -25,15 +25,15 @@ pub struct Checkbox { } impl Checkbox { - /// Create a new `Checkbox` with a label. - pub fn new(label: impl Into>) -> Checkbox { + /// Create a new `Checkbox` with a text label. + pub fn new(text: impl Into>) -> Checkbox { Checkbox { - child_label: Label::new(label), + child_label: Label::new(text), } } - /// Update the label. - pub fn set_label(&mut self, label: impl Into>) { + /// Update the text label. + pub fn set_text(&mut self, label: impl Into>) { self.child_label.set_text(label); } }