當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript nw.gui.default.Menu類代碼示例

本文整理匯總了TypeScript中nw.gui.default.Menu的典型用法代碼示例。如果您正苦於以下問題:TypeScript gui.default.Menu類的具體用法?TypeScript gui.default.Menu怎麽用?TypeScript gui.default.Menu使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了gui.default.Menu類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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();
		}
開發者ID:bihai,項目名稱:Notedown,代碼行數:21,代碼來源:ViewFolderController.ts

示例2: 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);
		}
開發者ID:bihai,項目名稱:Notedown,代碼行數:19,代碼來源:ViewFolderController.ts

示例3: 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();
		}
開發者ID:bihai,項目名稱:Notedown,代碼行數:19,代碼來源:ViewFolderController.ts

示例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);

開發者ID:n-kats,項目名稱:nditor,代碼行數:14,代碼來源:gui.ts

示例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 };
開發者ID:bihai,項目名稱:Notedown,代碼行數:30,代碼來源:app.ts


注:本文中的nw.gui.default.Menu類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。