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


C# ToolButton.AddAccelerator方法代码示例

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


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

示例1: MakeToolbar

		//
		// Toolbar
		//
		// Add Link button, Font menu, Delete button to the window's
		// toolbar.
		//

		Gtk.Toolbar MakeToolbar ()
		{
			Gtk.Toolbar tb = new Gtk.Toolbar ();
			tb.Tooltips = true;

			toolbar_tips = new Gtk.Tooltips ();

			Gtk.ToolButton search = new Gtk.ToolButton (
				new Gtk.Image (Gtk.Stock.Find, tb.IconSize),
				Catalog.GetString ("Search"));
			search.IsImportant = true;
			search.Clicked += SearchActivate;
			// TODO: If we ever add a way to customize internal keybindings, this will need to change
			toolbar_tips.SetTip (search, Catalog.GetString ("Search your notes") + " (Ctrl-Shift-F)", null);
			search.AddAccelerator ("clicked",
			                       accel_group,
			                       (uint) Gdk.Key.f,
			                       (Gdk.ModifierType.ControlMask |
			                        Gdk.ModifierType.ShiftMask),
			                       Gtk.AccelFlags.Visible);
			search.ShowAll ();
			tb.Insert (search, -1);

			link_button = new Gtk.ToolButton (
				new Gtk.Image (Gtk.Stock.JumpTo, tb.IconSize),
				Catalog.GetString ("Link"));
			link_button.IsImportant = true;
			link_button.Sensitive = (note.Buffer.Selection != null);
			link_button.Clicked += LinkToNoteActivate;
			// TODO: If we ever add a way to customize internal keybindings, this will need to change
			toolbar_tips.SetTip (
				link_button,
				Catalog.GetString ("Link selected text to a new note") + " (Ctrl-L)",
				null);
			link_button.AddAccelerator ("clicked",
			                            accel_group,
			                            (uint) Gdk.Key.l,
			                            Gdk.ModifierType.ControlMask,
			                            Gtk.AccelFlags.Visible);
			link_button.ShowAll ();
			tb.Insert (link_button, -1);

			ToolMenuButton text_button =
			        new ToolMenuButton (tb,
			                            Gtk.Stock.SelectFont,
			                            Catalog.GetString ("_Text"),
			                            text_menu);
			text_button.IsImportant = true;
			text_button.ShowAll ();
			tb.Insert (text_button, -1);
			toolbar_tips.SetTip (text_button, Catalog.GetString ("Set properties of text"), null);

			ToolMenuButton plugin_button =
			        new ToolMenuButton (tb,
			                            Gtk.Stock.Execute,
			                            Catalog.GetString ("T_ools"),
			                            plugin_menu);
			plugin_button.ShowAll ();
			tb.Insert (plugin_button, -1);
			toolbar_tips.SetTip (plugin_button, Catalog.GetString ("Use tools on this note"), null);

			tb.Insert (new Gtk.SeparatorToolItem (), -1);

			delete = new Gtk.ToolButton (Gtk.Stock.Delete);
			delete.Clicked += OnDeleteButtonClicked;
			delete.ShowAll ();
			tb.Insert (delete, -1);
			toolbar_tips.SetTip (delete, Catalog.GetString ("Delete this note"), null);

			// Don't allow deleting the "Start Here" note...
			if (note.IsSpecial)
				delete.Sensitive = false;

			tb.Insert (new Gtk.SeparatorToolItem (), -1);

			sync_menu_item = new Gtk.ImageMenuItem (Catalog.GetString ("Synchronize Notes"));
			sync_menu_item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu);
			sync_menu_item.Activated += SyncItemSelected;
			sync_menu_item.Show ();
			PluginMenu.Add (sync_menu_item);

			// We might want to know when various settings are altered.
			Preferences.SettingChanged += Preferences_SettingChanged;

			// Update items based on configuration.
			UpdateMenuItems ();

			tb.ShowAll ();
			return tb;
		}
开发者ID:oluc,项目名称:tomboy,代码行数:97,代码来源:NoteWindow.cs


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