electron_sys/interface/
sources_options.rs

1use crate::interface::Size;
2use wasm_bindgen::prelude::*;
3
4#[wasm_bindgen]
5#[derive(Clone, Debug, PartialEq)]
6pub struct SourcesOptions {
7    types: Box<[JsValue]>,
8    thumbnail_size: Option<Size>,
9    fetch_window_icons: Option<bool>,
10}
11
12#[wasm_bindgen]
13impl SourcesOptions {
14    #[wasm_bindgen(constructor)]
15    pub fn new(
16        types: Box<[JsValue]>,
17        thumbnail_size: Option<Size>,
18        fetch_window_icons: Option<bool>,
19    ) -> SourcesOptions {
20        SourcesOptions {
21            types,
22            thumbnail_size,
23            fetch_window_icons,
24        }
25    }
26
27    #[wasm_bindgen(getter)]
28    pub fn types(&self) -> Box<[JsValue]> {
29        self.types.clone()
30    }
31
32    #[wasm_bindgen(setter)]
33    pub fn set_types(&mut self, value: Box<[JsValue]>) {
34        self.types = value;
35    }
36
37    #[wasm_bindgen(getter)]
38    pub fn thumbnail_size(&self) -> Option<Size> {
39        self.thumbnail_size
40    }
41
42    #[wasm_bindgen(setter)]
43    pub fn set_thumbnail_size(&mut self, value: Option<Size>) {
44        self.thumbnail_size = value;
45    }
46
47    #[wasm_bindgen(getter)]
48    pub fn fetch_window_icons(&self) -> Option<bool> {
49        self.fetch_window_icons
50    }
51
52    #[wasm_bindgen(setter)]
53    pub fn set_fetch_window_icons(&mut self, value: Option<bool>) {
54        self.fetch_window_icons = value;
55    }
56}