summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/client/app/src/ui/model/checkbox.rs
blob: 8923e33558983b8a134e3c139a9a9d98639ef6bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use crate::data::Property;

/// A checkbox (with optional label).
#[derive(Default, Debug)]
pub struct Checkbox {
    pub checked: Property<bool>,
    pub label: Option<String>,
}

impl super::ElementBuilder<Checkbox> {
    pub fn checked(&mut self, value: impl Into<Property<bool>>) {
        self.element_type.checked = value.into();
    }

    pub fn label<S: Into<String>>(&mut self, label: S) {
        self.element_type.label = Some(label.into());
    }
}