forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-electron.tray.d.ts
133 lines (130 loc) · 4.28 KB
/
github-electron.tray.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Type definitions for Electron v0.37.2
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="github-electron.event-emitter.d.ts" />
/// <reference path="github-electron.menu.d.ts" />
/// <reference path="github-electron.native-image.d.ts" />
/// <reference path="github-electron.screen.d.ts" />
declare namespace Electron {
/**
* A Tray represents an icon in an operating system's notification area.
*/
class Tray extends EventEmitter {
/**
* Emitted when the tray icon is clicked.
* Note: The bounds payload is only implemented on OS X and Windows.
*/
on(event: 'click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this;
/**
* Emitted when the tray icon is right clicked.
* Note: This is only implemented on OS X and Windows.
*/
on(event: 'right-click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this;
/**
* Emitted when the tray icon is double clicked.
* Note: This is only implemented on OS X and Windows.
*/
on(event: 'double-click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this;
/**
* Emitted when the tray balloon shows.
* Note: This is only implemented on Windows.
*/
on(event: 'balloon-show', listener: Function): this;
/**
* Emitted when the tray balloon is clicked.
* Note: This is only implemented on Windows.
*/
on(event: 'balloon-click', listener: Function): this;
/**
* Emitted when the tray balloon is closed because of timeout or user manually closes it.
* Note: This is only implemented on Windows.
*/
on(event: 'balloon-closed', listener: Function): this;
/**
* Emitted when any dragged items are dropped on the tray icon.
* Note: This is only implemented on OS X.
*/
on(event: 'drop', listener: Function): this;
/**
* Emitted when dragged files are dropped in the tray icon.
* Note: This is only implemented on OS X
*/
on(event: 'drop-files', listener: (event: Event, files: string[]) => void): this;
/**
* Emitted when a drag operation enters the tray icon.
* Note: This is only implemented on OS X
*/
on(event: 'drag-enter', listener: Function): this;
/**
* Emitted when a drag operation exits the tray icon.
* Note: This is only implemented on OS X
*/
on(event: 'drag-leave', listener: Function): this;
/**
* Emitted when a drag operation ends on the tray or ends at another location.
* Note: This is only implemented on OS X
*/
on(event: 'drag-end', listener: Function): this;
on(event: string, listener: Function): this;
/**
* Creates a new tray icon associated with the image.
*/
constructor(image: NativeImage|string);
/**
* Destroys the tray icon immediately.
*/
destroy(): void;
/**
* Sets the image associated with this tray icon.
*/
setImage(image: NativeImage|string): void;
/**
* Sets the image associated with this tray icon when pressed.
*/
setPressedImage(image: NativeImage): void;
/**
* Sets the hover text for this tray icon.
*/
setToolTip(toolTip: string): void;
/**
* Sets the title displayed aside of the tray icon in the status bar.
* Note: This is only implemented on OS X.
*/
setTitle(title: string): void;
/**
* Sets whether the tray icon is highlighted when it is clicked.
* Note: This is only implemented on OS X.
*/
setHighlightMode(highlight: boolean): void;
/**
* Displays a tray balloon.
* Note: This is only implemented on Windows.
*/
displayBalloon(options?: {
icon?: NativeImage;
title?: string;
content?: string;
}): void;
/**
* Popups the context menu of tray icon. When menu is passed,
* the menu will showed instead of the tray's context menu.
* The position is only available on Windows, and it is (0, 0) by default.
* Note: This is only implemented on OS X and Windows.
*/
popUpContextMenu(menu?: Menu, position?: {
x: number;
y: number;
}): void;
/**
* Sets the context menu for this icon.
*/
setContextMenu(menu: Menu): void;
}
interface Modifiers {
altKey: boolean;
shiftKey: boolean;
ctrlKey: boolean;
metaKey: boolean;
}
}