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


C# Gtk.Menu.Append方法代码示例

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


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

示例1: SetupUi

		protected void SetupUi()
		{
			var box = new Gtk.VBox();

			var menu = new Gtk.MenuBar();
			var fileMenu = new Gtk.Menu();
			var file = new Gtk.MenuItem("File");
			file.Submenu = fileMenu;
			menu.Append(file);

			var save = new Gtk.MenuItem("Save");
			save.Activated += OnSaveMenuActivated;
			var load = new Gtk.MenuItem("Load");
			load.Activated += OnLoadMenuActivated;

			var exit = new Gtk.MenuItem("Exit");
			exit.Activated += (sender, e) => Gtk.Application.Quit();

			fileMenu.Append(save);
			fileMenu.Append(load);
			fileMenu.Append(exit);


			box.PackStart(menu, false, false, 0);

			nb = new Gtk.Notebook();
			nb.ShowTabs = false;
			nb.AppendPage(SetupOverviewPage(), new Gtk.Label("Overview"));
			nb.AppendPage(SetupNewNotePage(), new Gtk.Label("New"));
			box.PackStart(nb, true, true, 2);

			Add(box);
		}
开发者ID:cgt,项目名称:Notes,代码行数:33,代码来源:MainWindow.cs

示例2: OnPopupMenu

        protected override bool OnPopupMenu()
        {
            Gtk.Menu mnu=new Gtk.Menu();

            Gtk.ImageMenuItem play=new Gtk.ImageMenuItem(Gtk.Stock.MediaPlay,null);
            play.Activated+=delegate(object sender,EventArgs a) {
                _view.PlayAlbum((CS_AlbumInfo) this.Model[Selection.FirstIndex]);
            };

            Gtk.ImageMenuItem edit=new Gtk.ImageMenuItem(Gtk.Stock.Edit,null);
            edit.Activated+=delegate(object sender,EventArgs a) {
                _view.EditSheet(((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ());
            };

            Gtk.ImageMenuItem show_file=new Gtk.ImageMenuItem("Show in filesystem");
            show_file.Image=new Gtk.Image(Gtk.Stock.Directory,Gtk.IconSize.Menu);
            show_file.Activated+=delegate(object sender, EventArgs a) {
                _view.OpenContainingFolder((CS_AlbumInfo) this.Model[Selection.FirstIndex]);
            };

            mnu.Append (play);
            mnu.Append (new Gtk.SeparatorMenuItem());
            mnu.Append (edit);
            mnu.Append (show_file);

            CueSheet s=((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ();
            if (Mp3Split.DllPresent()) {
                if (Mp3Split.IsSupported(s.musicFileName ())) {
                    Gtk.ImageMenuItem split=new Gtk.ImageMenuItem("Split & Write to location");
                    split.Image=new Gtk.Image(Gtk.Stock.Convert,Gtk.IconSize.Menu);
                    split.Activated+=delegate(object sender,EventArgs a) {
                        _view.MusicFileToDevice(((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ());
                    };
                    mnu.Append (split);
                }
            }

            mnu.ShowAll ();
            mnu.Popup();

            return false;
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:42,代码来源:CS_AlbumListView.cs

示例3: FromMenu

		static Gtk.Menu FromMenu (ContextMenu menu, Action closeHandler)
		{
			var result = new Gtk.Menu ();

			foreach (var menuItem in menu.Items) {
				var item = CreateMenuItem (menuItem);
				if (item != null)
					result.Append (item);
			}

			result.Hidden += delegate {
				if (closeHandler != null)
					closeHandler ();
				menu.FireClosedEvent ();
			};
			return result;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:17,代码来源:ContextMenuExtensionsGtk.cs

示例4: PopulateAlbums

        private void PopulateAlbums()
        {
            Gtk.Menu menu = new Gtk.Menu ();
            if (gallery.Version == GalleryVersion.Version1) {
                Gtk.MenuItem top_item = new Gtk.MenuItem (Catalog.GetString ("(TopLevel)"));
                menu.Append (top_item);
            }

            foreach (Album album in gallery.Albums) {
                System.Text.StringBuilder label_builder = new System.Text.StringBuilder ();

                for (int i=0; i < album.Parents.Count; i++) {
                    label_builder.Append ("  ");
                }

                label_builder.Append (album.Title);
                album_optionmenu.AppendText(label_builder.ToString());
            }

            album_optionmenu.Sensitive = true;
            menu.ShowAll ();
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:22,代码来源:GalleryAddAlbum.cs

示例5: PopulateAlbumOptionMenu

        private void PopulateAlbumOptionMenu(Gallery gallery)
        {
            System.Collections.ArrayList albums = null;
            if (gallery != null) {
                //gallery.FetchAlbumsPrune ();
                try {
                    gallery.FetchAlbums ();
                    albums = gallery.Albums;
                } catch (GalleryCommandException e) {
                    gallery.PopupException (e, export_dialog);
                    return;
                }
            }

            Gtk.Menu menu = new Gtk.Menu ();

            bool disconnected = gallery == null || !account.Connected || albums == null;

            if (disconnected || albums.Count == 0) {
                string msg = disconnected ? Catalog.GetString ("(Not Connected)")
                    : Catalog.GetString ("(No Albums)");

                Gtk.MenuItem item = new Gtk.MenuItem (msg);
                menu.Append (item);

                export_button.Sensitive = false;
                album_optionmenu.Sensitive = false;
                album_button.Sensitive = false;

                if (disconnected)
                    album_button.Sensitive = false;
            } else {
                foreach (Album album in albums) {
                    System.Text.StringBuilder label_builder = new System.Text.StringBuilder ();

                    for (int i=0; i < album.Parents.Count; i++) {
                        label_builder.Append ("  ");
                    }
                    label_builder.Append (album.Title);

                    Gtk.MenuItem item = new Gtk.MenuItem (label_builder.ToString ());
                    ((Gtk.Label)item.Child).UseUnderline = false;
                    menu.Append (item);

                        AlbumPermission add_permission = album.Perms & AlbumPermission.Add;

                    if (add_permission == 0)
                        item.Sensitive = false;
                }

                export_button.Sensitive = items.Length > 0;
                album_optionmenu.Sensitive = true;
                album_button.Sensitive = true;
            }

            menu.ShowAll ();
            album_optionmenu.Menu = menu;
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:58,代码来源:GalleryExport.cs

示例6: ShowPopup

        private void ShowPopup()
        {
            if ((presets == null) || (presets.Length == 0))
                return;

            EventHandler onActivated = delegate(object sender, EventArgs e) {
                Gtk.MenuItem item = (Gtk.MenuItem)sender;

                SetPlaceholderText(false);

                if (Text.Length > 0) {
                    if ((!Text.TrimEnd().EndsWith(" or")) && (!Text.TrimEnd().EndsWith(" OR")) &&
                        (!Text.TrimEnd().EndsWith(" and")) && (!Text.TrimEnd().EndsWith(" AND"))) {

                        if (!Text.EndsWith(" "))
                            Text += " ";

                        Text += "and ";
                    } else {
                        if (!Text.EndsWith(" "))
                            Text += " ";
                    }
                }

                var p = (SearchEntryPreset)item.Data["preset"];

                if (!string.IsNullOrEmpty(p.Value)) {
                    Text += p.Value;

                    if (!string.IsNullOrEmpty(p.Suggestion)) {
                        Text += " " + p.Suggestion;

                        GrabFocus();
                        SelectRegion(Text.Length - p.Suggestion.Length, Text.Length);
                    } else {
                        GrabFocus();
                        SelectRegion(Text.Length, Text.Length);
                    }
                }
            };

            if (presetsChanged) {

                if (popup != null)
                    popup.Dispose();

                popup = new Gtk.Menu();

                foreach (var p in presets) {
                    Gtk.MenuItem item = new Gtk.MenuItem(p.Caption);
                    item.Activated += onActivated;
                    item.Data["preset"] = p;

                    popup.Append(item);
                }

                popup.ShowAll();
                presetsChanged = false;
            }

            popup.Popup();
        }
开发者ID:pulb,项目名称:basenji,代码行数:62,代码来源:SearchEntry.cs

示例7: ChatView

        public ChatView(ChatModel chat)
        {
            Trace.Call(chat);

            _ChatModel = chat;

            IsAutoScrolling = true;
            MessageTextView tv = new MessageTextView();
            _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false);
            tv.ShowTimestamps = true;
            tv.ShowMarkerline = true;
            tv.Editable = false;
            tv.CursorVisible = true;
            tv.WrapMode = Gtk.WrapMode.Char;
            tv.MessageAdded += OnMessageTextViewMessageAdded;
            tv.MessageHighlighted += OnMessageTextViewMessageHighlighted;
            tv.PopulatePopup += OnMessageTextViewPopulatePopup;
            tv.SizeRequested += delegate {
                AutoScroll();
            };
            _OutputMessageTextView = tv;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            _OutputScrolledWindow = sw;
            //sw.HscrollbarPolicy = Gtk.PolicyType.Never;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Always;
            sw.ShadowType = Gtk.ShadowType.In;
            sw.Vadjustment.ValueChanged += delegate {
                CheckAutoScroll();
            };
            sw.Add(_OutputMessageTextView);

            // popup menu
            _TabMenu = new Gtk.Menu();

            Gtk.ImageMenuItem close_item = new Gtk.ImageMenuItem(Gtk.Stock.Close, null);
            close_item.Activated += new EventHandler(OnTabMenuCloseActivated);
            _TabMenu.Append(close_item);
            _TabMenu.ShowAll();

            //FocusChild = _OutputTextView;
            //CanFocus = false;

            _TabLabel = new Gtk.Label();

            TabImage = DefaultTabImage;
            _TabHBox = new Gtk.HBox();
            _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0);
            _TabHBox.PackEnd(_TabLabel, false, false, 0);
            _TabHBox.PackStart(TabImage, false, false, 2);
            _TabHBox.ShowAll();

            _TabEventBox = new Gtk.EventBox();
            _TabEventBox.VisibleWindow = false;
            _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress);
            _TabEventBox.Add(_TabHBox);
            _TabEventBox.ShowAll();

            _ThemeSettings = new ThemeSettings();

            // OPT-TODO: this should use a TaskStack instead of TaskQueue
            _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue("+ID+")");
            _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent;
            _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent;
        }
开发者ID:grendello,项目名称:smuxi,代码行数:66,代码来源:ChatView.cs

示例8: ContextMenu


//.........这里部分代码省略.........
				MenuItem mnuViewSource = new MenuItem("View Source");
				mnuViewSource.Enabled = !string.IsNullOrEmpty(viewSourceUrl);
				mnuViewSource.Click += delegate { ViewSource(viewSourceUrl); };

				MenuItem mnuOpenInSystemBrowser = new MenuItem("View In System Browser");//nice for debugging with firefox/firebug
				mnuOpenInSystemBrowser.Enabled = !string.IsNullOrEmpty(viewSourceUrl);
				mnuOpenInSystemBrowser.Click += delegate { ViewInSystemBrowser(viewSourceUrl); };


				string properties = (doc != null && doc.Uri == Document.Uri) ? "Page Properties" : "IFRAME Properties";
				
				MenuItem mnuProperties = new MenuItem(properties);
				mnuProperties.Enabled = doc != null;
				mnuProperties.Click += delegate { ShowPageProperties(doc); };
				
				menu.MenuItems.AddRange(optionals.ToArray());
				menu.MenuItems.Add(mnuSelectAll);
				menu.MenuItems.Add("-");
				menu.MenuItems.Add(mnuViewSource);
				menu.MenuItems.Add(mnuOpenInSystemBrowser);
				menu.MenuItems.Add(mnuProperties);
			}

			// get image urls
			Uri backgroundImageSrc = null, imageSrc = null;
			nsIURI src;
			try
			{
				src = info.GetBackgroundImageSrcAttribute();
				backgroundImageSrc = src.ToUri();
				Marshal.ReleaseComObject( src );
			}
			catch (COMException comException)
			{
				if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005)
					throw comException;
			}

			try
			{
				src = info.GetImageSrcAttribute();
				if ( src != null )
				{
					imageSrc = src.ToUri();
					Marshal.ReleaseComObject( src );
				}
			}
			catch (COMException comException)
			{
				if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005)
					throw comException;
			}
			
			// get associated link.  note that this needs to be done manually because GetAssociatedLink returns a non-zero
			// result when no associated link is available, so an exception would be thrown by nsString.Get()
			string associatedLink = null;
			try
			{
				using (nsAString str = new nsAString())
				{
					info.GetAssociatedLinkAttribute(str);
					associatedLink = str.ToString();
				}
			}
			catch (COMException comException) { }			
			
			GeckoContextMenuEventArgs e = new GeckoContextMenuEventArgs(
				PointToClient(MousePosition), menu, associatedLink, backgroundImageSrc, imageSrc,
				GeckoNode.Create(Xpcom.QueryInterface<nsIDOMNode>(info.GetTargetNodeAttribute()))
				);
			
			OnShowContextMenu(e);
			
			if (e.ContextMenu != null && e.ContextMenu.MenuItems.Count > 0)
			{
#if GTK
				// When using GTK we can't use SWF to display the context menu: SWF displays
				// the context menu and then tries to track the mouse so that it knows when to
				// close the context menu. However, GTK intercepts the mouse click before SWF gets
				// it, so the menu never closes. Instead we display a GTK menu and translate
				// the SWF menu items into Gtk.MenuItems.
				// TODO: currently this code only handles text menu items. Would be nice to also
				// translate images etc.
				var popupMenu = new Gtk.Menu();

				foreach (MenuItem swfMenuItem in e.ContextMenu.MenuItems)
				{
					var gtkMenuItem = new Gtk.MenuItem(swfMenuItem.Text);
					gtkMenuItem.Sensitive = swfMenuItem.Enabled;
					MenuItem origMenuItem = swfMenuItem;
					gtkMenuItem.Activated += (sender, ev) => origMenuItem.PerformClick();
					popupMenu.Append(gtkMenuItem);
				}
				popupMenu.ShowAll();
				popupMenu.Popup();
#else
				e.ContextMenu.Show(this, e.Location);
#endif
			}
		}
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:101,代码来源:GeckoWebBrowser.cs

示例9: GetRightClickMenu

		Gtk.Menu GetRightClickMenu ()
		{
			if (tray.TomboyTrayMenu != null)
				tray.TomboyTrayMenu.Hide ();

			if (context_menu != null) {
				context_menu.Hide ();
				return context_menu;
			}

			context_menu = new Gtk.Menu ();

			Gtk.AccelGroup accel_group = new Gtk.AccelGroup ();
			context_menu.AccelGroup = accel_group;

			Gtk.ImageMenuItem item;

			sync_menu_item = new Gtk.ImageMenuItem (Catalog.GetString ("S_ynchronize Notes"));
			sync_menu_item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu);
			UpdateMenuItems();
			Preferences.SettingChanged += Preferences_SettingChanged;
			sync_menu_item.Activated += SyncNotes;
			context_menu.Append (sync_menu_item);

			context_menu.Append (new Gtk.SeparatorMenuItem ());

			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Preferences"));
			item.Image = new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.Menu);
			item.Activated += ShowPreferences;
			context_menu.Append (item);

			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Help"));
			item.Image = new Gtk.Image (Gtk.Stock.Help, Gtk.IconSize.Menu);
			item.Activated += ShowHelpContents;
			context_menu.Append (item);

			item = new Gtk.ImageMenuItem (Catalog.GetString ("_About Tomboy"));
			item.Image = new Gtk.Image (Gtk.Stock.About, Gtk.IconSize.Menu);
			item.Activated += ShowAbout;
			context_menu.Append (item);

			context_menu.Append (new Gtk.SeparatorMenuItem ());

			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Quit"));
			item.Image = new Gtk.Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
			item.Activated += Quit;
			context_menu.Append (item);

			context_menu.ShowAll ();
			return context_menu;
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:51,代码来源:Tray.cs

示例10: FromMenu

		static Gtk.Menu FromMenu (ContextMenu menu, Action closeHandler)
		{
			var result = new Gtk.Menu ();

			foreach (var menuItem in menu.Items) {
				var item = CreateMenuItem (menuItem);
				if (item != null)
					result.Append (item);
			}

			if (closeHandler != null) {
				result.Hidden += (sender, e) => closeHandler ();
			}
			return result;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:15,代码来源:ContextMenuExtensionsGtk.cs

示例11: ChatView

        public ChatView(ChatModel chat)
        {
            Trace.Call(chat);

            _ChatModel = chat;
            _Name = _ChatModel.Name;
            Name = _Name;

            // TextTags
            Gtk.TextTagTable ttt = new Gtk.TextTagTable();
            _OutputTextTagTable = ttt;
            Gtk.TextTag tt;
            Pango.FontDescription fd;

            tt = new Gtk.TextTag("bold");
            fd = new Pango.FontDescription();
            fd.Weight = Pango.Weight.Bold;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("italic");
            fd = new Pango.FontDescription();
            fd.Style = Pango.Style.Italic;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("underline");
            tt.Underline = Pango.Underline.Single;
            ttt.Add(tt);

            tt = new Gtk.TextTag("url");
            tt.Underline = Pango.Underline.Single;
            tt.Foreground = "darkblue";
            tt.TextEvent += new Gtk.TextEventHandler(_OnTextTagUrlTextEvent);
            fd = new Pango.FontDescription();
            tt.FontDesc = fd;
            ttt.Add(tt);

            Gtk.TextView tv = new Gtk.TextView();
            tv.Buffer = new Gtk.TextBuffer(ttt);
            _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false);
            tv.Editable = false;
            //tv.CursorVisible = false;
            tv.CursorVisible = true;
            tv.WrapMode = Gtk.WrapMode.Char;
            tv.Buffer.Changed += new EventHandler(_OnTextBufferChanged);
            tv.MotionNotifyEvent += new Gtk.MotionNotifyEventHandler(_OnMotionNotifyEvent);
            _OutputTextView = tv;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            //sw.HscrollbarPolicy = Gtk.PolicyType.Never;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Always;
            sw.ShadowType = Gtk.ShadowType.In;
            sw.Add(_OutputTextView);
            _OutputScrolledWindow = sw;

            // popup menu
            _TabMenu = new Gtk.Menu();

            Gtk.ImageMenuItem close_item = new Gtk.ImageMenuItem(Gtk.Stock.Close, null);
            close_item.Activated += new EventHandler(OnTabMenuCloseActivated);
            _TabMenu.Append(close_item);

            //FocusChild = _OutputTextView;
            //CanFocus = false;

            _TabLabel = new Gtk.Label();
            _TabLabel.Text = _Name;

            _TabHBox = new Gtk.HBox();
            _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0);
            _TabHBox.PackEnd(_TabLabel, false, false, 0);
            _TabHBox.ShowAll();

            _TabEventBox = new Gtk.EventBox();
            _TabEventBox.VisibleWindow = false;
            _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress);
            _TabEventBox.Add(_TabHBox);
            _TabEventBox.ShowAll();
        }
开发者ID:RoninBG,项目名称:smuxi,代码行数:81,代码来源:ChatView.cs

示例12: BuildPopup

 private void BuildPopup()
 {
     popup = new Gtk.Menu();
     popup.Append( this.actAdd.CreateMenuItem() );
     popup.Append( this.actRemove.CreateMenuItem() );
     popup.Append( this.actModify.CreateMenuItem() );
     popup.Append( this.actSettings.CreateMenuItem() );
     popup.ShowAll();
 }
开发者ID:Baltasarq,项目名称:Tacto,代码行数:9,代码来源:MainWindowView.cs

示例13: BuildMenu

        private void BuildMenu()
        {
            var accelerators = new Gtk.AccelGroup();
            var mMain = new Gtk.MenuBar();
            var mFile = new Gtk.Menu();
            var mEdit = new Gtk.Menu();
            var mView = new Gtk.Menu();
            var mTools = new Gtk.Menu();
            var mHelp = new Gtk.Menu();
            var miFile = new Gtk.MenuItem( "_File" );
            var miEdit = new Gtk.MenuItem( "_Edit" );
            var miView = new Gtk.MenuItem( "_View" );
            var miTools = new Gtk.MenuItem( "_Tools" );
            var miHelp = new Gtk.MenuItem( "_Help" );

            // Menu items
            var opNew = this.actNew.CreateMenuItem();
            opNew.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.n, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opOpen = this.actOpen.CreateMenuItem();
            opOpen.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.o, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opSave = this.actSave.CreateMenuItem();
            opSave.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.s, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opQuit = this.actQuit.CreateMenuItem();
            opQuit.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opAdd = this.actAdd.CreateMenuItem();
            opAdd.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.plus, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opRemove = this.actRemove.CreateMenuItem();
            opRemove.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.Delete, Gdk.ModifierType.None, Gtk.AccelFlags.Visible ) );

            var opFind = this.actFind.CreateMenuItem();
            opFind.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.f, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opFindAgain = this.actFindAgain.CreateMenuItem();
            opFindAgain.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.F3, Gdk.ModifierType.None, Gtk.AccelFlags.Visible ) );

            var opSettings = this.actSettings.CreateMenuItem();
            opSettings.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.F2, Gdk.ModifierType.None, Gtk.AccelFlags.Visible ) );

            var opView = new Gtk.CheckMenuItem( this.actViewCard.Label );
            opView.Active = true;
            opView.Activated += (sender, e) => this.actViewCard.Activate();

            // Create menu structure
            mMain.Append( miFile );
            miFile.Submenu = mFile;
            mFile.Append( opNew );
            mFile.Append( opOpen );
            mFile.Append( this.actImport.CreateMenuItem() );
            mFile.Append( new Gtk.SeparatorMenuItem() );
            mFile.Append( opSave );
            mFile.Append( this.actExport.CreateMenuItem() );
            mFile.Append( new Gtk.SeparatorMenuItem() );
            mFile.Append( opQuit );

            mMain.Append( miEdit );
            miEdit.Submenu = mEdit;
            mEdit.Append( opAdd );
            mEdit.Append( opRemove );
            mEdit.Append( this.actModify.CreateMenuItem() );
            mEdit.Append( this.actConnect.CreateMenuItem() );
            mEdit.Append( new Gtk.SeparatorMenuItem() );
            mEdit.Append( opFind );
            mEdit.Append( opFindAgain );
            mEdit.Append( new Gtk.SeparatorMenuItem() );
            mEdit.Append( opSettings );

            mMain.Append( miView );
            miView.Submenu = mView;
            mView.Append( opView );

            mMain.Append( miTools );
            miTools.Submenu = mTools;
            mTools.Append( this.actSort.CreateMenuItem() );

            mMain.Append( miHelp );
            miHelp.Submenu = mHelp;
            mHelp.Append( this.actAbout.CreateMenuItem() );

            this.AddAccelGroup( accelerators );
            this.vbMain.PackStart( mMain, false, false, 0 );
        }
开发者ID:Baltasarq,项目名称:Tacto,代码行数:95,代码来源:MainWindowView.cs

示例14: MainWindow

        public MainWindow()
            : base("Smuxi")
        {
            // restore window size / position
            int width, heigth;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"] != null) {
                width  = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"];
            } else {
                width = 800;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"] != null) {
                heigth = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"];
            } else {
                heigth = 600;
            }
            if (width < -1 || heigth < -1) {
                width = -1;
                heigth = -1;
            }
            if (width == -1 && heigth == -1) {
                SetDefaultSize(800, 600);
                Maximize();
            } else if (width == 0 && heigth == 0) {
                // HACK: map 0/0 to default size as it crashes on Windows :/
                SetDefaultSize(800, 600);
            } else {
                SetDefaultSize(width, heigth);
            }

            int x, y;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"] != null) {
                x = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"];
            } else {
                x = 0;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"] != null) {
                y = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"];
            } else {
                y = 0;
            }
            if (x < 0 || y < 0) {
                x = 0;
                y = 0;
            }
            if (x == 0 && y == 0) {
                SetPosition(Gtk.WindowPosition.Center);
            } else {
                Move(x, y);
            }

            DeleteEvent += OnDeleteEvent;
            FocusInEvent += OnFocusInEvent;
            FocusOutEvent += OnFocusOutEvent;
            WindowStateEvent += OnWindowStateEvent;

            Gtk.AccelGroup agrp = new Gtk.AccelGroup();
            Gtk.AccelKey   akey;
            AddAccelGroup(agrp);

            // Menu
            MenuBar = new Gtk.MenuBar();
            Gtk.Menu menu;
            Gtk.MenuItem item;
            Gtk.ImageMenuItem image_item;

            // Menu - File
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_File"));
            item.Submenu = menu;
            MenuBar.Append(item);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, agrp);
            item.Activated += new EventHandler(_OnPreferencesButtonClicked);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            item = new Gtk.ImageMenuItem(Gtk.Stock.Quit, agrp);
            item.Activated += new EventHandler(_OnQuitButtonClicked);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            // Menu - Server
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Server"));
            item.Submenu = menu;
            MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(_("_Quick Connect"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Connect, Gtk.IconSize.Menu);
            image_item.Activated += OnServerQuickConnectButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Add, agrp);
            image_item.Activated += OnServerAddButtonClicked;
            menu.Append(image_item);

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

示例15: ArrowButton_Click

		private void ArrowButton_Click(object sender, EventArgs e)
		{
			Gtk.Menu menu = new Gtk.Menu();
			
			foreach (string childId in _dummyFam.Children)
			{
				GedcomIndividualRecord child = (GedcomIndividualRecord)_database[childId];
				
				string name = child.GetName().Name;
				
				Gtk.ImageMenuItem menuItem = new Gtk.ImageMenuItem(name);
				menuItem.Image = new Gtk.Image(Gtk.Stock.JumpTo, Gtk.IconSize.Menu);
				menuItem.ShowAll();
				
				menu.Append(menuItem);
								
				menuItem.Activated += ChildMenu_Activated;
			}
			
			menu.Popup();
		}
开发者ID:Bert6623,项目名称:Gedcom.Net,代码行数:21,代码来源:PedigreeView.cs


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