本文整理汇总了C#中Gtk.Menu.Popdown方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.Popdown方法的具体用法?C# Menu.Popdown怎么用?C# Menu.Popdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Menu
的用法示例。
在下文中一共展示了Menu.Popdown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initalize
public void Initalize(MainWindow window, MenuItem treerebuild, PropertiesView propertiesView)
{
this.window = window;
this.propertiesView = propertiesView;
menu = new Menu ();
addmenu = new Menu();
treeadd = new MenuItem("Add");
treeadd.Submenu = addmenu;
treeaddseperator = new SeparatorMenuItem ();
treenewitem = new MenuItem ("New Item...");
treenewitem.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args)
{ menu.Popdown(); window.OnNewItemActionActivated(o, args); };
treenewfolder = new MenuItem ("New Folder...");
treenewfolder.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args)
{ menu.Popdown(); window.OnNewFolderActionActivated(o, args); };
treeadditem = new MenuItem ("Existing Item...");
treeadditem.ButtonPressEvent += window.OnAddItemActionActivated;
treeaddfolder = new MenuItem ("Existing Folder...");
treeaddfolder.ButtonPressEvent += window.OnAddFolderActionActivated;
treerename = new MenuItem ("Rename");
treerename.Activated += window.OnRenameActionActivated;
treerenameseparator = new SeparatorMenuItem();
treedelete = new MenuItem ("Delete");
treedelete.Activated += window.OnDeleteActionActivated;
treeopenfile = new MenuItem ("Open");
treeopenfile.Activated += delegate {
List<TreeIter> iters;
List<string> ids;
GetSelectedTreePath(out iters, out ids);
if (ids.Count != 1)
return;
string start = openedProject;
if(ids[0] != ID_BASE)
start = window._controller.GetFullPath(GetPathFromIter(iters[0]));
#if LINUX
Process.Start("mimeopen", "-n " + start);
#else
Process.Start(start);
#endif
};
treeopenfilelocation = new MenuItem ("Open Item Directory");
treeopenfilelocation.Activated += delegate {
List<TreeIter> iters;
List<string> ids;
GetSelectedTreePath(out iters, out ids);
if(ids[0] != ID_BASE)
Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath(GetPathFromIter(iters[0]))));
else
Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath("")));
};
addmenu.Add (treenewitem);
addmenu.Add (treenewfolder);
addmenu.Add (new SeparatorMenuItem ());
addmenu.Add (treeadditem);
addmenu.Add (treeaddfolder);
menu.Add (treeopenfile);
menu.Add (treeadd);
menu.Add (treeaddseperator);
menu.Add (treeopenfilelocation);
menu.Add (treerebuild);
menu.Add (new SeparatorMenuItem ());
menu.Add (treerename);
menu.Add (treerenameseparator);
menu.Add (treedelete);
}
示例2: treeviewContextMenu
private void treeviewContextMenu()
{
menuCtx = new Menu ();
Gtk.MenuItem myItem;
if(genericWinContextMenu == Constants.ContextMenu.EDITDELETE) {
myItem = new MenuItem ( Catalog.GetString("Edit selected") );
myItem.Activated += on_edit_selected_clicked;
menuCtx.Attach( myItem, 0, 1, 0, 1 );
myItem = new MenuItem ( Catalog.GetString("Delete selected") );
myItem.Activated += on_delete_selected_clicked;
menuCtx.Attach( myItem, 0, 1, 1, 2 );
}
else if(genericWinContextMenu == Constants.ContextMenu.DELETE) {
myItem = new MenuItem ( Catalog.GetString("Delete selected") );
myItem.Activated += on_delete_selected_clicked;
menuCtx.Attach( myItem, 0, 1, 0, 1 );
} else {
//don't show nothing if there are no options
menuCtx.Popdown();
return;
}
menuCtx.Popup();
menuCtx.ShowAll();
}