当前位置: 首页>>代码示例>>C#>>正文


C# Menu.Popdown方法代码示例

本文整理汇总了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);
        }
开发者ID:KennethYap,项目名称:MonoGame,代码行数:84,代码来源:ProjectView.cs

示例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();
    }
开发者ID:GNOME,项目名称:chronojump,代码行数:27,代码来源:genericWindow.cs


注:本文中的Gtk.Menu.Popdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。