summaryrefslogtreecommitdiffstats
path: root/widget/src/button.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-06-27 20:37:19 +0200
committerLibravatar GitHub <noreply@github.com>2023-06-27 20:37:19 +0200
commitf6966268bb6d58b4b03ba61fc5732e1bf016e2a1 (patch)
treec8e79670b59fdd19103cb1a3a6d18783136e2294 /widget/src/button.rs
parentef18ecf4ef0fe654578380059b467fe2fb34aa0a (diff)
parent5b6e205e998cbb20b3c8aaff8b515d78315d6703 (diff)
downloadiced-f6966268bb6d58b4b03ba61fc5732e1bf016e2a1.tar.gz
iced-f6966268bb6d58b4b03ba61fc5732e1bf016e2a1.tar.bz2
iced-f6966268bb6d58b4b03ba61fc5732e1bf016e2a1.zip
Merge pull request #1845 from bungoboingo/feat/offscreen-rendering
Feat: Offscreen Rendering & Screenshots
Diffstat (limited to 'widget/src/button.rs')
-rw-r--r--widget/src/button.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/widget/src/button.rs b/widget/src/button.rs
index 0f3cbde2..8ebc9657 100644
--- a/widget/src/button.rs
+++ b/widget/src/button.rs
@@ -102,8 +102,17 @@ where
/// Sets the message that will be produced when the [`Button`] is pressed.
///
/// Unless `on_press` is called, the [`Button`] will be disabled.
- pub fn on_press(mut self, msg: Message) -> Self {
- self.on_press = Some(msg);
+ pub fn on_press(mut self, on_press: Message) -> Self {
+ self.on_press = Some(on_press);
+ self
+ }
+
+ /// Sets the message that will be produced when the [`Button`] is pressed,
+ /// if `Some`.
+ ///
+ /// If `None`, the [`Button`] will be disabled.
+ pub fn on_press_maybe(mut self, on_press: Option<Message>) -> Self {
+ self.on_press = on_press;
self
}