forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-electron.menu.d.ts
63 lines (61 loc) · 2.29 KB
/
github-electron.menu.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
// 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.browser-window.d.ts" />
/// <reference path="github-electron.event-emitter.d.ts" />
/// <reference path="github-electron.menu-item.d.ts" />
declare namespace Electron {
/**
* The Menu class is used to create native menus that can be used as application
* menus and context menus. This module is a main process module which can be used
* in a render process via the remote module.
*
* Each menu consists of multiple menu items, and each menu item can have a submenu.
*/
class Menu extends EventEmitter {
/**
* Creates a new menu.
*/
constructor();
/**
* Sets menu as the application menu on OS X. On Windows and Linux, the menu
* will be set as each window's top menu.
*/
static setApplicationMenu(menu: Menu): void;
/**
* Sends the action to the first responder of application.
* This is used for emulating default Cocoa menu behaviors,
* usually you would just use the role property of MenuItem.
*
* Note: This method is OS X only.
*/
static sendActionToFirstResponder(action: string): void;
/**
* @param template Generally, just an array of options for constructing MenuItem.
* You can also attach other fields to element of the template, and they will
* become properties of the constructed menu items.
*/
static buildFromTemplate(template: MenuItemOptions[]): Menu;
/**
* Popups this menu as a context menu in the browserWindow. You can optionally
* provide a (x,y) coordinate to place the menu at, otherwise it will be placed
* at the current mouse cursor position.
* @param x Horizontal coordinate where the menu will be placed.
* @param y Vertical coordinate where the menu will be placed.
*/
popup(browserWindow?: BrowserWindow, x?: number, y?: number): void;
/**
* Appends the menuItem to the menu.
*/
append(menuItem: MenuItem): void;
/**
* Inserts the menuItem to the pos position of the menu.
*/
insert(position: number, menuItem: MenuItem): void;
/**
* @returns an array containing the menu’s items.
*/
items: MenuItem[];
}
}