| import { MenuItemBase, newMenu } from './base.js'; |
| import { invoke } from '../core.js'; |
| import { transformImage } from '../image.js'; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| var NativeIcon; |
| (function (NativeIcon) { |
| |
| NativeIcon["Add"] = "Add"; |
| |
| NativeIcon["Advanced"] = "Advanced"; |
| |
| NativeIcon["Bluetooth"] = "Bluetooth"; |
| |
| NativeIcon["Bookmarks"] = "Bookmarks"; |
| |
| NativeIcon["Caution"] = "Caution"; |
| |
| NativeIcon["ColorPanel"] = "ColorPanel"; |
| |
| NativeIcon["ColumnView"] = "ColumnView"; |
| |
| NativeIcon["Computer"] = "Computer"; |
| |
| NativeIcon["EnterFullScreen"] = "EnterFullScreen"; |
| |
| NativeIcon["Everyone"] = "Everyone"; |
| |
| NativeIcon["ExitFullScreen"] = "ExitFullScreen"; |
| |
| NativeIcon["FlowView"] = "FlowView"; |
| |
| NativeIcon["Folder"] = "Folder"; |
| |
| NativeIcon["FolderBurnable"] = "FolderBurnable"; |
| |
| NativeIcon["FolderSmart"] = "FolderSmart"; |
| |
| NativeIcon["FollowLinkFreestanding"] = "FollowLinkFreestanding"; |
| |
| NativeIcon["FontPanel"] = "FontPanel"; |
| |
| NativeIcon["GoLeft"] = "GoLeft"; |
| |
| NativeIcon["GoRight"] = "GoRight"; |
| |
| NativeIcon["Home"] = "Home"; |
| |
| NativeIcon["IChatTheater"] = "IChatTheater"; |
| |
| NativeIcon["IconView"] = "IconView"; |
| |
| NativeIcon["Info"] = "Info"; |
| |
| NativeIcon["InvalidDataFreestanding"] = "InvalidDataFreestanding"; |
| |
| NativeIcon["LeftFacingTriangle"] = "LeftFacingTriangle"; |
| |
| NativeIcon["ListView"] = "ListView"; |
| |
| NativeIcon["LockLocked"] = "LockLocked"; |
| |
| NativeIcon["LockUnlocked"] = "LockUnlocked"; |
| |
| NativeIcon["MenuMixedState"] = "MenuMixedState"; |
| |
| NativeIcon["MenuOnState"] = "MenuOnState"; |
| |
| NativeIcon["MobileMe"] = "MobileMe"; |
| |
| NativeIcon["MultipleDocuments"] = "MultipleDocuments"; |
| |
| NativeIcon["Network"] = "Network"; |
| |
| NativeIcon["Path"] = "Path"; |
| |
| NativeIcon["PreferencesGeneral"] = "PreferencesGeneral"; |
| |
| NativeIcon["QuickLook"] = "QuickLook"; |
| |
| NativeIcon["RefreshFreestanding"] = "RefreshFreestanding"; |
| |
| NativeIcon["Refresh"] = "Refresh"; |
| |
| NativeIcon["Remove"] = "Remove"; |
| |
| NativeIcon["RevealFreestanding"] = "RevealFreestanding"; |
| |
| NativeIcon["RightFacingTriangle"] = "RightFacingTriangle"; |
| |
| NativeIcon["Share"] = "Share"; |
| |
| NativeIcon["Slideshow"] = "Slideshow"; |
| |
| NativeIcon["SmartBadge"] = "SmartBadge"; |
| |
| NativeIcon["StatusAvailable"] = "StatusAvailable"; |
| |
| NativeIcon["StatusNone"] = "StatusNone"; |
| |
| NativeIcon["StatusPartiallyAvailable"] = "StatusPartiallyAvailable"; |
| |
| NativeIcon["StatusUnavailable"] = "StatusUnavailable"; |
| |
| NativeIcon["StopProgressFreestanding"] = "StopProgressFreestanding"; |
| |
| NativeIcon["StopProgress"] = "StopProgress"; |
| |
| NativeIcon["TrashEmpty"] = "TrashEmpty"; |
| |
| NativeIcon["TrashFull"] = "TrashFull"; |
| |
| NativeIcon["User"] = "User"; |
| |
| NativeIcon["UserAccounts"] = "UserAccounts"; |
| |
| NativeIcon["UserGroup"] = "UserGroup"; |
| |
| NativeIcon["UserGuest"] = "UserGuest"; |
| })(NativeIcon || (NativeIcon = {})); |
| |
| |
| |
| |
| class IconMenuItem extends MenuItemBase { |
| |
| constructor(rid, id) { |
| super(rid, id, 'Icon'); |
| } |
| |
| static async new(opts) { |
| return newMenu('Icon', opts).then(([rid, id]) => new IconMenuItem(rid, id)); |
| } |
| |
| async text() { |
| return invoke('plugin:menu|text', { rid: this.rid, kind: this.kind }); |
| } |
| |
| async setText(text) { |
| return invoke('plugin:menu|set_text', { |
| rid: this.rid, |
| kind: this.kind, |
| text |
| }); |
| } |
| |
| async isEnabled() { |
| return invoke('plugin:menu|is_enabled', { rid: this.rid, kind: this.kind }); |
| } |
| |
| async setEnabled(enabled) { |
| return invoke('plugin:menu|set_enabled', { |
| rid: this.rid, |
| kind: this.kind, |
| enabled |
| }); |
| } |
| |
| async setAccelerator(accelerator) { |
| return invoke('plugin:menu|set_accelerator', { |
| rid: this.rid, |
| kind: this.kind, |
| accelerator |
| }); |
| } |
| |
| async setIcon(icon) { |
| return invoke('plugin:menu|set_icon', { |
| rid: this.rid, |
| kind: this.kind, |
| icon: transformImage(icon) |
| }); |
| } |
| } |
|
|
| export { IconMenuItem, NativeIcon }; |
|
|