electron_sys/class/
tray.rs

1use crate::{
2    class::{Menu, NativeImage},
3    interface::{DisplayBalloonOptions, Point, Rectangle},
4};
5use js_sys::JsString;
6use node_sys::events::EventEmitter;
7use wasm_bindgen::prelude::*;
8
9#[wasm_bindgen(module = "electron")]
10extern {
11    #[wasm_bindgen(extends = EventEmitter)]
12    #[derive(Clone, Debug)]
13    /// Docs: http://electronjs.org/docs/api/tray
14    pub type Tray;
15
16    //*************//
17    // Constructor //
18    //*************//
19
20    #[wasm_bindgen(constructor)]
21    pub fn new(image: &NativeImage) -> Tray;
22
23    //******************//
24    // Instance Methods //
25    //******************//
26
27    #[wasm_bindgen(method)]
28    pub fn destroy(this: &Tray);
29
30    #[wasm_bindgen(method, js_name = "displayBalloon")]
31    pub fn display_balloon(this: &Tray, options: DisplayBalloonOptions);
32
33    #[wasm_bindgen(method)]
34    pub fn focus(this: &Tray);
35
36    #[wasm_bindgen(method, js_name = "getBounds")]
37    pub fn get_bounds(this: &Tray) -> Rectangle;
38
39    #[wasm_bindgen(method, js_name = "getIgnoreDoubleClickEvents")]
40    pub fn get_ignore_double_click_events(this: &Tray) -> bool;
41
42    #[wasm_bindgen(method, js_name = "getTitle")]
43    pub fn get_title(this: &Tray) -> JsString;
44
45    #[wasm_bindgen(method, js_name = "isDestroyed")]
46    pub fn is_destroyed(this: &Tray) -> bool;
47
48    #[wasm_bindgen(method, js_name = "popUpContextMenu")]
49    pub fn pop_up_context_menu(this: &Tray, menu: Option<Menu>, position: Option<Point>);
50
51    #[wasm_bindgen(method, js_name = "removeBalloon")]
52    pub fn remove_balloon(this: &Tray);
53
54    #[wasm_bindgen(method, js_name = "setContextMenu")]
55    pub fn set_context_menu(this: &Tray, menu: Option<Menu>);
56
57    #[wasm_bindgen(method, js_name = "setIgnoreDoubleClickEvents")]
58    pub fn set_ignore_double_click_events(this: &Tray, ignore: bool);
59
60    #[wasm_bindgen(method, js_name = "setImage")]
61    pub fn set_image(this: &Tray, image: NativeImage);
62
63    #[wasm_bindgen(method, js_name = "setPressedImage")]
64    pub fn set_pressed_image(this: &Tray, image: NativeImage);
65
66    #[wasm_bindgen(method, js_name = "setTitle")]
67    pub fn set_title(this: &Tray, title: &str);
68
69    #[wasm_bindgen(method, js_name = "setToolTip")]
70    pub fn set_tool_tip(this: &Tray, tool_tip: &str);
71}