electron_sys/interface/
popup_options.rs

1use crate::class::BrowserWindow;
2use js_sys::Function;
3use wasm_bindgen::prelude::*;
4
5#[wasm_bindgen]
6#[derive(Clone, Debug)]
7pub struct PopupOptions {
8    callback: Option<Function>,
9    positioning_item: Option<usize>,
10    window: Option<BrowserWindow>,
11    x: Option<usize>,
12    y: Option<usize>,
13}
14
15#[wasm_bindgen]
16impl PopupOptions {
17    #[wasm_bindgen(constructor)]
18    pub fn new(
19        callback: Option<Function>,
20        positioning_item: Option<usize>,
21        window: Option<BrowserWindow>,
22        x: Option<usize>,
23        y: Option<usize>,
24    ) -> PopupOptions {
25        PopupOptions {
26            callback,
27            positioning_item,
28            window,
29            x,
30            y,
31        }
32    }
33
34    #[wasm_bindgen(getter)]
35    pub fn callback(&self) -> Option<Function> {
36        self.callback.clone()
37    }
38
39    #[wasm_bindgen(setter)]
40    pub fn set_callback(&mut self, value: Option<Function>) {
41        self.callback = value;
42    }
43
44    #[wasm_bindgen(getter)]
45    pub fn positioning_item(&self) -> Option<usize> {
46        self.positioning_item
47    }
48
49    #[wasm_bindgen(setter)]
50    pub fn set_positioning_item(&mut self, value: Option<usize>) {
51        self.positioning_item = value;
52    }
53
54    #[wasm_bindgen(getter)]
55    pub fn window(&self) -> Option<BrowserWindow> {
56        self.window.clone()
57    }
58
59    #[wasm_bindgen(setter)]
60    pub fn set_window(&mut self, value: Option<BrowserWindow>) {
61        self.window = value;
62    }
63
64    #[wasm_bindgen(getter)]
65    pub fn x(&self) -> Option<usize> {
66        self.x
67    }
68
69    #[wasm_bindgen(setter)]
70    pub fn set_x(&mut self, value: Option<usize>) {
71        self.x = value;
72    }
73
74    #[wasm_bindgen(getter)]
75    pub fn y(&self) -> Option<usize> {
76        self.y
77    }
78
79    #[wasm_bindgen(setter)]
80    pub fn set_y(&mut self, value: Option<usize>) {
81        self.y = value;
82    }
83}