fltk_builder/extensions/builder/
button.rs

1use fltk::{
2    enums::{FrameType, Shortcut},
3    prelude::ButtonExt,
4};
5
6/// Adds builder pattern friendly versions of several setter functions for Button widgets
7pub trait ButtonBuilderExt {
8    /// Sets the shortcut associated with a button
9    fn with_shortcut(self, shortcut: Shortcut) -> Self;
10    /// Set the `down_box` of the widget
11    fn with_down_frame(self, f: FrameType) -> Self;
12}
13
14impl<B> ButtonBuilderExt for B
15where
16    B: ButtonExt,
17{
18    fn with_shortcut(mut self, shortcut: Shortcut) -> Self {
19        self.set_shortcut(shortcut);
20        self
21    }
22
23    fn with_down_frame(mut self, f: FrameType) -> Self {
24        self.set_down_frame(f);
25        self
26    }
27}