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


C# ImageMenuItem.AddAccelerator方法代码示例

本文整理汇总了C#中Gtk.ImageMenuItem.AddAccelerator方法的典型用法代码示例。如果您正苦于以下问题:C# ImageMenuItem.AddAccelerator方法的具体用法?C# ImageMenuItem.AddAccelerator怎么用?C# ImageMenuItem.AddAccelerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.ImageMenuItem的用法示例。


在下文中一共展示了ImageMenuItem.AddAccelerator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnNoteOpened

 public override void OnNoteOpened()
 {
     item = new Gtk.ImageMenuItem (Catalog.GetString("Email"));
     item.Activated += OnImageMenuItemActivated;
     item.AddAccelerator ("activate", Window.AccelGroup,
         (uint) Gdk.Key.e, Gdk.ModifierType.ControlMask,
         Gtk.AccelFlags.Visible);
     item.Show ();
     AddPluginMenuItem (item);
 }
开发者ID:decriptor,项目名称:EmailNotes,代码行数:10,代码来源:EmailNotesNoteAddin.cs

示例2: OnNoteOpened

		public override void OnNoteOpened ()
		{
			// Adding menu item when note is opened and window created
			item = new Gtk.ImageMenuItem (Catalog.GetString ("Remove broken links"));
			item.Image = new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu);
			item.AddAccelerator ("activate", Window.AccelGroup,
				(uint) Gdk.Key.r, Gdk.ModifierType.ControlMask,
				Gtk.AccelFlags.Visible);
			item.Activated += OnMenuItemActivated;
			item.Show ();
			AddPluginMenuItem (item);
		}
开发者ID:oluc,项目名称:tomboy,代码行数:12,代码来源:RemoveBrokenLinksAddin.cs

示例3: setUp

        //Checks prefs and sets up system
        private void setUp()
        {
            bool auto;
            try {
                auto = (bool) Preferences.Get(CalculatorAddin.CALCULATOR_AUTOMATIC_MODE);
            } catch (Exception e) {
                Logger.Debug(e.Message);
                auto = false;				//Defaults to manual if no preference is set.
            }

            if (!auto) {
                //Clean up automatic listeners in case a switch has been made with the note open
                if (buffer != null) buffer.InsertText -= OnInsertText;

                //Sets up a menu item and listener
                item = new Gtk.ImageMenuItem (Catalog.GetString ("Calculate Answer"));
                item.Activated += OnMenuItemActivated;
                item.AddAccelerator ("activate", Window.AccelGroup,
                    (uint) Gdk.Key.e, Gdk.ModifierType.ControlMask,
                    Gtk.AccelFlags.Visible);
                item.Image = new Gtk.Image (Gtk.Stock.Execute, Gtk.IconSize.Menu);
                item.Show ();
                AddPluginMenuItem (item);
            } else {
                //Clean up manual listeners in case a switch has been made with the note open
                if (item != null){
                    item.Activated -= OnMenuItemActivated;
                    item.Hide();
                }
                //Add listener to check for braces being typed in
                buffer.InsertText += OnInsertText;
                Logger.Debug("CalcAddin: Listening for equation brackets");
                equation_ends = new List<TextMark>();
                equation_starts = new List<TextMark>();

                //TODO: Set up a watcher that notes when braces are deleted and removes the marks.

                //TODO: Set up a method to search through for existing brackets at startup

            }
        }
开发者ID:robpvn,项目名称:Tomboy-Calculator-Addin,代码行数:42,代码来源:CalculatorAddin.cs

示例4: AddContextActionWithAccel

 /// <summary>
 /// Add an action (on context menu) on the series grid.
 /// </summary>
 /// <param name="menuItemText">The text of the menu item</param>
 /// <param name="onClick">The event handler to call when menu is selected</param>
 public void AddContextActionWithAccel(string menuItemText, System.EventHandler onClick, string shortcut)
 {
     ImageMenuItem item = new ImageMenuItem(menuItemText);
     if (!String.IsNullOrEmpty(shortcut))
     {
         string keyName = String.Empty;
         Gdk.ModifierType modifier = Gdk.ModifierType.None;
         string[] keyNames = shortcut.Split(new Char[] { '+' });
         foreach (string name in keyNames)
         {
             if (name == "Ctrl")
                 modifier |= Gdk.ModifierType.ControlMask;
             else if (name == "Shift")
                 modifier |= Gdk.ModifierType.ShiftMask;
             else if (name == "Alt")
                 modifier |= Gdk.ModifierType.Mod1Mask;
             else if (name == "Del")
                 keyName = "Delete";
             else
                 keyName = name;
         }
         try
         {
             Gdk.Key accelKey = (Gdk.Key)Enum.Parse(typeof(Gdk.Key), keyName, false);
             item.AddAccelerator("activate", accel, (uint)accelKey, modifier, AccelFlags.Visible);
         }
         catch
         {
         }
     }
     item.Activated += onClick;
     Popup.Append(item);
     Popup.ShowAll();
 }
开发者ID:hol353,项目名称:ApsimX,代码行数:39,代码来源:GridView.cs

示例5: PopulateContextMenu

        /// <summary>Populate the context menu from the descriptions passed in.</summary>
        /// <param name="menuDescriptions">Menu descriptions for each menu item.</param>
        public void PopulateContextMenu(List<MenuDescriptionArgs> menuDescriptions)
        {
            ClearPopup();
            foreach (MenuDescriptionArgs Description in menuDescriptions)
            {
                ImageMenuItem item = new ImageMenuItem(Description.Name);
                if (!String.IsNullOrEmpty(Description.ResourceNameForImage) && hasResource(Description.ResourceNameForImage) )
                    item.Image = new Image(null, Description.ResourceNameForImage);
                if (!String.IsNullOrEmpty(Description.ShortcutKey))
                {
                    string keyName = String.Empty;
                    Gdk.ModifierType modifier = Gdk.ModifierType.None;
                    string[] keyNames = Description.ShortcutKey.Split(new Char[] { '+' });
                    foreach (string name in keyNames)
                    {
                        if (name == "Ctrl")
                            modifier |= Gdk.ModifierType.ControlMask;
                        else if (name == "Shift")
                            modifier |= Gdk.ModifierType.ShiftMask;
                        else if (name == "Alt")
                            modifier |= Gdk.ModifierType.Mod1Mask;
                        else if (name == "Del")
                            keyName = "Delete";
                        else
                            keyName = name;
                    }
                    try
                    {
                        Gdk.Key accelKey = (Gdk.Key)Enum.Parse(typeof(Gdk.Key), keyName, false);
                        item.AddAccelerator("activate", accel, (uint)accelKey, modifier, AccelFlags.Visible);
                    }
                    catch
                    {
                    }
                }
                item.Activated += Description.OnClick;
                Popup.Append(item);

            }
            if (Popup.AttachWidget == null)
                Popup.AttachToWidget(treeview1, null);
            Popup.ShowAll();
        }
开发者ID:hol353,项目名称:ApsimX,代码行数:45,代码来源:ExplorerView.cs

示例6: CreateNormalMenu

 private MenuBar CreateNormalMenu()
 {
     MenuBar menubar = new MenuBar ();
        AccelGroup agrp = new AccelGroup();
        this.AddAccelGroup(agrp);
        Menu iFolderMenu = new Menu();
        NewMenuItem = new ImageMenuItem (Util.GS("_Upload a Folder..."));
        NewMenuItem.Image = new Image(
      new Gdk.Pixbuf(Util.ImagesPath("ifolder-upload16.png")));
        iFolderMenu.Append(NewMenuItem);
        NewMenuItem.AddAccelerator("activate", agrp,
     new AccelKey(Gdk.Key.N, Gdk.ModifierType.ControlMask,
     AccelFlags.Visible));
        NewMenuItem.Activated += new EventHandler(AddiFolderHandler);
        DownloadMenuItem =
     new ImageMenuItem (Util.GS("_Download..."));
        DownloadMenuItem.Image = new Image(
     new Gdk.Pixbuf(Util.ImagesPath("ifolder-download16.png")));
        MergeMenuItem = new ImageMenuItem( Util.GS("Merge to Folder"));
        MergeMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder-download16.png")));
        iFolderMenu.Append(DownloadMenuItem);
        iFolderMenu.Append(MergeMenuItem);
        DownloadMenuItem.Activated += new EventHandler(DownloadAvailableiFolderHandler);
        MergeMenuItem.Activated += new EventHandler(MergeAvailableiFolderHandler);
        DeleteMenuItem =
     new ImageMenuItem (Util.GS("Dele_te From Server"));
        DeleteMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu);
        iFolderMenu.Append(DeleteMenuItem);
        DeleteMenuItem.Activated += new EventHandler(DeleteFromServerHandler);
        RemoveMenuItem =
     new ImageMenuItem (Util.GS("Re_move my membership"));
        RemoveMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu);
        iFolderMenu.Append(RemoveMenuItem);
        RemoveMenuItem.Activated += new EventHandler(RemoveMembershipHandler);
        iFolderMenu.Append(new SeparatorMenuItem());
        OpenMenuItem = new ImageMenuItem ( Stock.Open, agrp );
        iFolderMenu.Append(OpenMenuItem);
        OpenMenuItem.Activated += new EventHandler(OnOpenSynchronizedFolder);
        ShareMenuItem = new MenuItem (Util.GS("Share _with..."));
        iFolderMenu.Append(ShareMenuItem);
        ShareMenuItem.Activated += new EventHandler(OnShareSynchronizedFolder);
        ConflictMenuItem = new MenuItem (Util.GS("Resolve conflic_ts"));
        iFolderMenu.Append(ConflictMenuItem);
        ConflictMenuItem.Activated +=
      new EventHandler(OnResolveConflicts);
        SyncNowMenuItem = new MenuItem(Util.GS("S_ynchronize now"));
        iFolderMenu.Append(SyncNowMenuItem);
        SyncNowMenuItem.Activated += new EventHandler(OnSynchronizeNow);
        RevertMenuItem =
     new ImageMenuItem (Util.GS("_Revert to a Normal Folder"));
        RevertMenuItem.Image = new Image(Stock.Undo, Gtk.IconSize.Menu);
        iFolderMenu.Append(RevertMenuItem);
        RevertMenuItem.Activated += new EventHandler(RemoveiFolderHandler);
        PropMenuItem = new ImageMenuItem (Stock.Properties, agrp);
        iFolderMenu.Append(PropMenuItem);
        PropMenuItem.Activated += new EventHandler(OnShowFolderProperties);
        iFolderMenu.Append(new SeparatorMenuItem());
        MigrateMenuItem = new MenuItem(Util.GS("_Migrate iFolder"));
        Menu MigrateMenu = new Menu();
        MigrateMenuSubItem = new MenuItem(Util.GS("Migrate from 2.x"));
        MigrateMenu.Append(MigrateMenuSubItem);
        MigrateMenuItem.Submenu = MigrateMenu;
        iFolderMenu.Append( MigrateMenuItem);
        MigrateMenuSubItem.Activated += new EventHandler(Migrate2xClickedHandler);
        iFolderMenu.Append(new SeparatorMenuItem());
        CloseMenuItem = new ImageMenuItem (Stock.Close, agrp);
        iFolderMenu.Append(CloseMenuItem);
        CloseMenuItem.Activated += new EventHandler(CloseEventHandler);
        QuitMenuItem = new ImageMenuItem(Stock.Quit, agrp);
        iFolderMenu.Append(QuitMenuItem);
        QuitMenuItem.Activated += new EventHandler(QuitEventHandler);
        MenuItem iFolderMenuItem = new MenuItem(Util.GS("i_Folder"));
        iFolderMenuItem.Submenu = iFolderMenu;
        menubar.Append (iFolderMenuItem);
        Menu EditMenu = new Menu();
        AccountsMenuItem =
     new MenuItem (Util.GS("_Account Settings..."));
        EditMenu.Append(AccountsMenuItem);
        AccountsMenuItem.Activated += new EventHandler(AccountsMenuItemHandler);
        PreferencesMenuItem = new ImageMenuItem(Util.GS("_Preferences"));
        PreferencesMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu);
        EditMenu.Append(PreferencesMenuItem);
        PreferencesMenuItem.Activated += new EventHandler(ShowPreferencesHandler);
        MenuItem EditMenuItem = new MenuItem(Util.GS("_Edit"));
        EditMenuItem.Submenu = EditMenu;
        menubar.Append(EditMenuItem);
        Menu ViewMenu = new Menu();
        RefreshMenuItem =
     new ImageMenuItem(Stock.Refresh, agrp);
        ViewMenu.Append(RefreshMenuItem);
        RefreshMenuItem.Activated +=
      new EventHandler(RefreshiFoldersHandler);
        ViewMenu.Append(new SeparatorMenuItem());
        SyncLogMenuItem =
     new MenuItem (Util.GS("Synchronization _Log"));
        ViewMenu.Append(SyncLogMenuItem);
        SyncLogMenuItem.Activated += new EventHandler(SyncLogMenuItemHandler);
        ViewMenu.Append(new SeparatorMenuItem());
        ViewServeriFoldersMenuItem =
     new CheckMenuItem(Util.GS("View _available iFolders"));
//.........这里部分代码省略.........
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:101,代码来源:iFolderWindow.cs

示例7: MakeEditMenu

    private MenuItem MakeEditMenu()
    {
        Menu menu = new Menu();
        AccelGroup group = new AccelGroup();
        window.AddAccelGroup(group);

        ImageMenuItem copy = new ImageMenuItem(Stock.Copy, group);
        copy.AddAccelerator("activate", group, new AccelKey(Gdk.Key.c, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
        //copy.Activated += new EventHandler(OnEditCopy);
        menu.Append(copy);

        ImageMenuItem selectAll = new ImageMenuItem(Stock.SelectAll, group);
        selectAll.AddAccelerator("activate", group, new AccelKey(Gdk.Key.a, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
        //selectAll.Activated += new EventHandler(OnEditSelectAll);
        menu.Append(selectAll);

        MenuItem label = new MenuItem("_Edit");
        label.Submenu = menu;
        return label;
    }
开发者ID:novendraap,项目名称:enh,代码行数:20,代码来源:GMan.cs

示例8: MakeFileMenu

    private MenuItem MakeFileMenu()
    {
        Menu menu = new Menu();
        AccelGroup group = new AccelGroup();
        window.AddAccelGroup(group);

        ImageMenuItem quit = new ImageMenuItem(Stock.Quit, group);
        quit.AddAccelerator("activate", group, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
        quit.Activated += new EventHandler(OnFileQuit);
        menu.Append(quit);

        MenuItem label = new MenuItem("_File");
        label.Submenu = menu;
        return label;
    }
开发者ID:novendraap,项目名称:enh,代码行数:15,代码来源:GMan.cs

示例9: NoteTextMenu

		// FIXME: Tags applied to a word should hold over the space
		// between the next word, as thats where you'll start typeing.
		// Tags are only active -after- a character with that tag.  This
		// is different from the way gtk-textbuffer applies tags.

		//
		// Text menu
		//
		// Menu for font style and size, and set the active radio
		// menuitem depending on the cursor poition.
		//

		public NoteTextMenu (Gtk.AccelGroup accel_group,
		                     NoteBuffer     buffer,
		                     UndoManager    undo_manager)
			: base ()
		{
			this.buffer = buffer;
			this.undo_manager = undo_manager;

			if (undo_manager != null) {
				undo = new Gtk.ImageMenuItem (Gtk.Stock.Undo, accel_group);
				undo.Activated += UndoClicked;
				undo.AddAccelerator ("activate",
				                     accel_group,
				                     (uint) Gdk.Key.z,
				                     Gdk.ModifierType.ControlMask,
				                     Gtk.AccelFlags.Visible);
				undo.Show ();
				Append (undo);

				redo = new Gtk.ImageMenuItem (Gtk.Stock.Redo, accel_group);
				redo.Activated += RedoClicked;
				redo.AddAccelerator ("activate",
				                     accel_group,
				                     (uint) Gdk.Key.z,
				                     (Gdk.ModifierType.ControlMask |
				                      Gdk.ModifierType.ShiftMask),
				                     Gtk.AccelFlags.Visible);
				redo.Show ();
				Append (redo);

				Gtk.SeparatorMenuItem undo_spacer = new Gtk.SeparatorMenuItem ();
				Append (undo_spacer);

				// Listen to events so we can sensitize and
				// enable keybinding
				undo_manager.UndoChanged += UndoChanged;
			}

			bold = new Gtk.CheckMenuItem ("<b>" +
			                              Catalog.GetString ("_Bold") +
			                              "</b>");
			MarkupLabel (bold);
			bold.Data ["Tag"] = "bold";
			bold.Activated += FontStyleClicked;
			bold.AddAccelerator ("activate",
			                     accel_group,
			                     (uint) Gdk.Key.b,
			                     Gdk.ModifierType.ControlMask,
			                     Gtk.AccelFlags.Visible);

			italic = new Gtk.CheckMenuItem ("<i>" +
			                                Catalog.GetString ("_Italic") +
			                                "</i>");
			MarkupLabel (italic);
			italic.Data ["Tag"] = "italic";
			italic.Activated += FontStyleClicked;
			italic.AddAccelerator ("activate",
			                       accel_group,
			                       (uint) Gdk.Key.i,
			                       Gdk.ModifierType.ControlMask,
			                       Gtk.AccelFlags.Visible);

			strikeout = new Gtk.CheckMenuItem ("<s>" +
			                                   Catalog.GetString ("_Strikeout") +
			                                   "</s>");
			MarkupLabel (strikeout);
			strikeout.Data ["Tag"] = "strikethrough";
			strikeout.Activated += FontStyleClicked;
			strikeout.AddAccelerator ("activate",
			                          accel_group,
			                          (uint) Gdk.Key.s,
			                          Gdk.ModifierType.ControlMask,
			                          Gtk.AccelFlags.Visible);

			highlight = new Gtk.CheckMenuItem ("<span background='yellow'>" +
			                                   Catalog.GetString ("_Highlight") +
			                                   "</span>");
			MarkupLabel (highlight);
			highlight.Data ["Tag"] = "highlight";
			highlight.Activated += FontStyleClicked;
			highlight.AddAccelerator ("activate",
			                          accel_group,
			                          (uint) Gdk.Key.h,
			                          Gdk.ModifierType.ControlMask,
			                          Gtk.AccelFlags.Visible);

			Gtk.SeparatorMenuItem spacer1 = new Gtk.SeparatorMenuItem ();

//.........这里部分代码省略.........
开发者ID:oluc,项目名称:tomboy,代码行数:101,代码来源:NoteWindow.cs

示例10: OnNoteOpened

        public override void OnNoteOpened()
        {
            insertLocalImageMenuItem = new Gtk.ImageMenuItem (
                Catalog.GetString ("Insert Local Image"));
            insertLocalImageMenuItem.Image = new Gtk.Image (Gtk.Stock.Harddisk, Gtk.IconSize.Menu);
            insertLocalImageMenuItem.Activated += OnInsertLocalImage;
            insertLocalImageMenuItem.AddAccelerator ("activate", Window.AccelGroup,
                (uint)Gdk.Key.l, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask,
                Gtk.AccelFlags.Visible);
            insertLocalImageMenuItem.Show ();
            AddPluginMenuItem (insertLocalImageMenuItem);

            insertWebImageMenuItem = new Gtk.ImageMenuItem (
                Catalog.GetString ("Insert Web Image"));
            insertWebImageMenuItem.Image = new Gtk.Image (Gtk.Stock.Network, Gtk.IconSize.Menu);
            insertWebImageMenuItem.Activated += OnInsertWebImage;
            insertWebImageMenuItem.AddAccelerator ("activate", Window.AccelGroup,
                (uint)Gdk.Key.w, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask,
                Gtk.AccelFlags.Visible);
            insertWebImageMenuItem.Show ();
            AddPluginMenuItem (insertWebImageMenuItem);

            LoadImageBoxes ();

            Note.Saved += OnNoteSaved;
            Buffer.DeleteRange += new DeleteRangeHandler (Buffer_DeleteRange);
        }
开发者ID:binarytemple,项目名称:tomboy-image,代码行数:27,代码来源:InsertImageNoteAddin.cs

示例11: _createMenuBar

        // }}}
        // MainWindow::_createMenuBar() {{{
        /// <summary>Build main window's menu bar.</summary>  
        /// <returns>void</returns> 
        private void _createMenuBar()
        {
            MenuBar mBar = new MenuBar();
            AccelGroup group = new AccelGroup();
            this.AddAccelGroup(group);

            // file
            Menu mFile = new Menu();
            MenuItem miFile = new MenuItem("_File");
            miFile.Submenu = mFile;
            mBar.Append(miFile);
            // file->open
            ImageMenuItem miOpen = new ImageMenuItem(Stock.Open, group);
            miOpen.AddAccelerator("activate", group,
                    new AccelKey(Gdk.Key.o, Gdk.ModifierType.ControlMask,
                        AccelFlags.Visible));
            miOpen.Activated += new EventHandler(onMenuItemOpenActivate);
            mFile.Append(miOpen);
            // file->quit
            ImageMenuItem miExit  = new ImageMenuItem(Stock.Quit, group);
            miExit.AddAccelerator("activate", group,
                    new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask,
                        AccelFlags.Visible));
            miExit.Activated += new EventHandler(onMenuItemExitActivate);
            mFile.Append(miExit);
            // edit
            Menu mEdit = new Menu();
            MenuItem miEdit = new MenuItem("_Edit");
            miEdit.Submenu = mEdit;
            mBar.Append(miEdit);
            // edit->preferences
            ImageMenuItem miPref = new ImageMenuItem(Stock.Preferences, group);
            miPref.AddAccelerator("activate", group,
                    new AccelKey(Gdk.Key.o, Gdk.ModifierType.ControlMask,
                        AccelFlags.Visible));
            miPref.Activated += new EventHandler(onMenuItemPrefActivate);
            mEdit.Append(miPref);
            // Help
            Menu mQuestion = new Menu();
            MenuItem miQuestion = new MenuItem("_Help");
            miQuestion.Submenu = mQuestion;
            mBar.Append(miQuestion);
            // Help / About
            MenuItem miAbout = new MenuItem("_About");
            miAbout.Activated += new EventHandler(onMenuItemAboutActivate);
            mQuestion.Append(miAbout);

            this._vBox.PackStart(mBar, false, true, 0);
        }
开发者ID:geelweb,项目名称:iplviewer,代码行数:53,代码来源:MainWindow.cs

示例12: CreateWelcomeMenuBar

 private MenuBar CreateWelcomeMenuBar()
 {
     MenuBar menubar = new MenuBar ();
        AccelGroup agrp = new AccelGroup();
        this.AddAccelGroup(agrp);
        Menu menu = new Menu();
        ImageMenuItem imageMenuItem = new ImageMenuItem (Util.GS("Connect to a _server"));
        Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(Util.ImagesPath("add-account.png"));
        pixbuf = pixbuf.ScaleSimple(24, 24, Gdk.InterpType.Bilinear);
        imageMenuItem.Image = new Image(pixbuf);
        menu.Append(imageMenuItem);
        imageMenuItem.AddAccelerator("activate", agrp,
     new AccelKey(Gdk.Key.S, Gdk.ModifierType.ControlMask,
     AccelFlags.Visible));
        imageMenuItem.Activated += new EventHandler(OnAddNewAccount);
        menu.Append(new SeparatorMenuItem());
        imageMenuItem = new ImageMenuItem (Stock.Close, agrp);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(CloseEventHandler);
        imageMenuItem = new ImageMenuItem(Stock.Quit, agrp);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(QuitEventHandler);
        MenuItem menuItem = new MenuItem(Util.GS("i_Folder"));
        menuItem.Submenu = menu;
        menubar.Append (menuItem);
        menu = new Menu();
        imageMenuItem = new ImageMenuItem(Util.GS("_Preferences"));
        imageMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(ShowPreferencesHandler);
        menuItem = new MenuItem(Util.GS("_Edit"));
        menuItem.Submenu = menu;
        menubar.Append(menuItem);
        menu = new Menu();
        imageMenuItem = new ImageMenuItem(Stock.Help, agrp);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(OnHelpMenuItem);
        imageMenuItem = new ImageMenuItem(Util.GS("A_bout"));
        imageMenuItem.Image = new Image(Gnome.Stock.About,
        Gtk.IconSize.Menu);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(OnAbout);
        menuItem = new MenuItem(Util.GS("_Help"));
        menuItem.Submenu = menu;
        menubar.Append(menuItem);
        return menubar;
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:47,代码来源:iFolderWindow.cs

示例13: CreateViewMenu

        // Create "View" menu
        MenuItem CreateViewMenu(AccelGroup agr)
        {
            MenuItem view = new MenuItem("_View");
            Menu viewMenu = new Menu();
            view.Submenu = viewMenu;

            powerVisible = new CheckMenuItem("Show power _graph");
            powerVisible.Active = settings.PowerGraphVisible;
            powerVisible.Activated += OnShowPowerGraph;
            powerVisible.AddAccelerator("activate", agr,
            new AccelKey(Gdk.Key.F3, Gdk.ModifierType.None,
            AccelFlags.Visible));
            viewMenu.Append(powerVisible);

            viewMenu.Append(new SeparatorMenuItem());

            MenuItem zoomIn = new ImageMenuItem(Stock.ZoomIn, agr);
            zoomIn.Activated += (obj, evt) =>
            debugPane.PowerView.ZoomIn();
            zoomIn.AddAccelerator("activate", agr,
            new AccelKey(Gdk.Key.plus, Gdk.ModifierType.ControlMask,
            AccelFlags.Visible));
            viewMenu.Append(zoomIn);

            MenuItem zoomOut = new ImageMenuItem(Stock.ZoomOut, agr);
            zoomOut.Activated += (obj, evt) =>
            debugPane.PowerView.ZoomOut();
            zoomOut.AddAccelerator("activate", agr,
            new AccelKey(Gdk.Key.minus, Gdk.ModifierType.ControlMask,
            AccelFlags.Visible));
            viewMenu.Append(zoomOut);

            MenuItem zoomFit = new ImageMenuItem(Stock.ZoomFit, agr);
            zoomFit.Activated += (obj, evt) =>
            debugPane.PowerView.ZoomFit();
            zoomFit.AddAccelerator("activate", agr,
            new AccelKey(Gdk.Key.Key_0, Gdk.ModifierType.ControlMask,
            AccelFlags.Visible));
            viewMenu.Append(zoomFit);

            MenuItem zoomFull = new ImageMenuItem(Stock.Zoom100, agr);
            zoomFull.Activated += (obj, evt) =>
            debugPane.PowerView.ZoomFull();
            zoomFull.AddAccelerator("activate", agr,
            new AccelKey(Gdk.Key.Key_1, Gdk.ModifierType.ControlMask,
            AccelFlags.Visible));
            viewMenu.Append(zoomFull);

            return view;
        }
开发者ID:dlbeer,项目名称:olishell,代码行数:51,代码来源:AppMenu.cs

示例14: BuildMenu

		public static void BuildMenu (MenuItem bookmark_menu) {
			Menu aux = (Menu) bookmark_menu.Submenu;
			
			foreach (Widget w in aux.Children) {
				aux.Remove (w);
			}
			
			menu_to_id.Clear ();
			
			//adding Default Items:
			AccelGroup bk_grp = new AccelGroup ();
			_Browser.window1.AddAccelGroup (bk_grp);
			
			ImageMenuItem item;
			item  = new ImageMenuItem (ADD_BANNER);
			//item.Image = new Gtk.Image (Stock.Add,IconSize.Menu);
			item.AddAccelerator ("activate",bk_grp,new AccelKey (Gdk.Key.D,Gdk.ModifierType.ControlMask,AccelFlags.Visible));
			item.Activated += on_add_bookmark_activated;
			aux.Append (item);

			//edit
			item = new ImageMenuItem (EDIT_BANNER);
			item.AddAccelerator ("activate",bk_grp,new AccelKey (Gdk.Key.M,Gdk.ModifierType.ControlMask,AccelFlags.Visible));
			item.Activated += on_edit_bookmark_activated;
			//item.Image = new Gtk.Image (Stock.Edit,Iconsize,Menu);
			aux.Append (item);
			
			// and finally the separtor
			aux.Append (new SeparatorMenuItem ());
			
			BuildMenuHelper (aux,root_group);
			aux.ShowAll ();
		}
开发者ID:FreeBSD-DotNet,项目名称:mono-tools,代码行数:33,代码来源:BookmarkManager.cs

示例15: MakeFindMenu

		//
		// Find context menu
		//
		// Find, Find Next, Find Previous menu items.  Next nd previous
		// are only sensitized when there are search results for this
		// buffer to iterate.
		//

		Gtk.Menu MakeFindMenu ()
		{
			Gtk.Menu menu = new Gtk.Menu ();
			menu.AccelGroup = accel_group;

			Gtk.ImageMenuItem find =
			        new Gtk.ImageMenuItem (Catalog.GetString ("_Find..."));
			find.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu);
			find.Activated += FindActivate;
			find.AddAccelerator ("activate",
			                     accel_group,
			                     (uint) Gdk.Key.f,
			                     Gdk.ModifierType.ControlMask,
			                     Gtk.AccelFlags.Visible);
			find.Show ();

			Gtk.ImageMenuItem find_next =
			        new Gtk.ImageMenuItem (Catalog.GetString ("Find _Next"));
			find_next.Image = new Gtk.Image (Gtk.Stock.GoForward, Gtk.IconSize.Menu);
			find_next.Sensitive = Find.FindNextButton.Sensitive;

			find_next.Activated += FindNextActivate;
			find_next.AddAccelerator ("activate",
			                          accel_group,
			                          (uint) Gdk.Key.g,
			                          Gdk.ModifierType.ControlMask,
			                          Gtk.AccelFlags.Visible);
			find_next.Show ();

			Gtk.ImageMenuItem find_previous =
			        new Gtk.ImageMenuItem (Catalog.GetString ("Find _Previous"));
			find_previous.Image = new Gtk.Image (Gtk.Stock.GoBack, Gtk.IconSize.Menu);
			find_previous.Sensitive = Find.FindPreviousButton.Sensitive;

			find_previous.Activated += FindPreviousActivate;
			find_previous.AddAccelerator ("activate",
			                              accel_group,
			                              (uint) Gdk.Key.g,
			                              (Gdk.ModifierType.ControlMask |
			                               Gdk.ModifierType.ShiftMask),
			                              Gtk.AccelFlags.Visible);
			find_previous.Show ();

			menu.Append (find);
			menu.Append (find_next);
			menu.Append (find_previous);

			return menu;
		}
开发者ID:oluc,项目名称:tomboy,代码行数:57,代码来源:NoteWindow.cs


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