-
Notifications
You must be signed in to change notification settings - Fork 29.8k
/
menubar.ts
68 lines (54 loc) · 2.21 KB
/
menubar.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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
export interface ICommonMenubarService {
updateMenubar(windowId: number, menuData: IMenubarData): Promise<void>;
}
export interface IMenubarData {
menus: { [id: string]: IMenubarMenu };
keybindings: { [id: string]: IMenubarKeybinding };
}
export interface IMenubarMenu {
items: Array<MenubarMenuItem>;
}
export interface IMenubarKeybinding {
label: string;
userSettingsLabel?: string;
isNative?: boolean; // Assumed true if missing
}
export interface IMenubarMenuItemAction {
id: string;
label: string;
checked?: boolean; // Assumed false if missing
enabled?: boolean; // Assumed true if missing
}
export interface IMenubarMenuRecentItemAction {
id: string;
label: string;
uri: URI;
remoteAuthority?: string;
enabled?: boolean;
}
export interface IMenubarMenuItemSubmenu {
id: string;
label: string;
submenu: IMenubarMenu;
}
export interface IMenubarMenuItemSeparator {
id: 'vscode.menubar.separator';
}
export type MenubarMenuItem = IMenubarMenuItemAction | IMenubarMenuItemSubmenu | IMenubarMenuItemSeparator | IMenubarMenuRecentItemAction;
export function isMenubarMenuItemSubmenu(menuItem: MenubarMenuItem): menuItem is IMenubarMenuItemSubmenu {
return (<IMenubarMenuItemSubmenu>menuItem).submenu !== undefined;
}
export function isMenubarMenuItemSeparator(menuItem: MenubarMenuItem): menuItem is IMenubarMenuItemSeparator {
return (<IMenubarMenuItemSeparator>menuItem).id === 'vscode.menubar.separator';
}
export function isMenubarMenuItemRecentAction(menuItem: MenubarMenuItem): menuItem is IMenubarMenuRecentItemAction {
return (<IMenubarMenuRecentItemAction>menuItem).uri !== undefined;
}
export function isMenubarMenuItemAction(menuItem: MenubarMenuItem): menuItem is IMenubarMenuItemAction {
return !isMenubarMenuItemSubmenu(menuItem) && !isMenubarMenuItemSeparator(menuItem) && !isMenubarMenuItemRecentAction(menuItem);
}