當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。