本文整理汇总了TypeScript中nw.gui.default.Menu.append方法的典型用法代码示例。如果您正苦于以下问题:TypeScript gui.default.Menu.append方法的具体用法?TypeScript gui.default.Menu.append怎么用?TypeScript gui.default.Menu.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nw.gui.default.Menu
的用法示例。
在下文中一共展示了gui.default.Menu.append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: showGenericContextMenu
showGenericContextMenu(ev) {
var menu1 = new gui.Menu();
menu1.append(new gui.MenuItem({ label: 'New Document', click: () => {
this.newFile();
}}));
menu1.append(new gui.MenuItem({ label: 'New Folder', click: () => {
this.addFolder();
}}));
menu1.append(new gui.MenuItem({ type: "separator" }));
menu1.append(new gui.MenuItem({ label: 'Reveal in ' + this.getExplorerName(), click: () => {
gui.Shell.openExternal(this.folder.path);
}}));
menu1.popup(ev.x, ev.y);
}
示例2: showFolderContextMenu
showFolderContextMenu(folder:Models.IFolder, ev) {
var menu1 = new gui.Menu();
menu1.append(new gui.MenuItem({ label: 'Reveal in ' + this.getExplorerName(), click: () => {
gui.Shell.openExternal(folder.path);
}}));
menu1.append(new gui.MenuItem({ type: "separator" }));
menu1.append(new gui.MenuItem({ label: 'Rename', click: () => {
this.renameFolder(folder);
}}));
menu1.append(new gui.MenuItem({ label: 'Delete', click: () => {
}}));
menu1.popup(ev.x, ev.y);
ev.stopImmediatePropagation();
}
示例3: showFileContextMenu
showFileContextMenu(document:Models.IDocument, ev) {
var menu1 = new gui.Menu();
menu1.append(new gui.MenuItem({ label: 'Reveal in ' + this.getExplorerName(), click: () => {
gui.Shell.showItemInFolder(document.path);
}}));
menu1.append(new gui.MenuItem({ label: 'Copy path to clipboard', click: () => {
var clipboard = gui.Clipboard.get();
clipboard.set(document.path, 'text');
}}));
menu1.append(new gui.MenuItem({ type: "separator" }));
menu1.append(new gui.MenuItem({ label: 'Rename', click: () => {
this.renameFile(document);
}}));
menu1.append(new gui.MenuItem({ label: 'Delete', click: () => {
}}));
menu1.popup(ev.x, ev.y);
ev.stopImmediatePropagation();
}
示例4: require
/// <reference path="../typings/tsd.d.ts" />
var gui = require('nw.gui'),
win = gui.Window.get(),
menu = new gui.Menu();
menu.append(
new gui.MenuItem({
label: "menuItem01",
click: () => {
console.log("click menuItem!!");
}
}));
menu.popup(20,20);
示例5: require
var gui = require("nw.gui");
var mainWindow = gui.Window.get();
var menu = new gui.Menu({type: 'menubar'});
var menu_file = new gui.Menu();
var menu_help = new gui.Menu();
menu.append(new gui.MenuItem({ label: "File", submenu: menu_file}));
menu.append(new gui.MenuItem({ label: "Help", submenu: menu_help}));
menu_file.append(new gui.MenuItem({ label: "Exit", click: () => {
mainWindow.close();
}}));
menu_help.append(new gui.MenuItem({ label: "Reload Dev", click: () => {
mainWindow.reloadDev();
}}));
menu_help.append(new gui.MenuItem({ label: "Show Dev Tools", click: () => {
mainWindow.showDevTools();
}}));
menu_help.append(new gui.MenuItem({ type: "separator" }));
menu_help.append(new gui.MenuItem({ label: "About"}));
mainWindow.menu = menu;
/**
* Disable DragDrop in the window
*/
window.ondragover = function(e) { e.preventDefault(); return false };
window.ondrop = function(e) { e.preventDefault(); return false };