本文整理汇总了C#中Gtk.MenuItem类的典型用法代码示例。如果您正苦于以下问题:C# Gtk.MenuItem类的具体用法?C# Gtk.MenuItem怎么用?C# Gtk.MenuItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Gtk.MenuItem类属于命名空间,在下文中一共展示了Gtk.MenuItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildMenu
private void BuildMenu()
{
var menuBar = new Gtk.MenuBar();
var miFile = new Gtk.MenuItem( "File" );
var mFile = new Gtk.Menu();
var miHelp = new Gtk.MenuItem( "Help" );
var mHelp = new Gtk.Menu();
var miView = new Gtk.MenuItem( "View" );
var mView = new Gtk.Menu();
miFile.Submenu = mFile;
mFile.Append( this.actQuit.CreateMenuItem() );
miHelp.Submenu = mHelp;
mHelp.Append( this.actAbout.CreateMenuItem() );
miView.Submenu = mView;
mView.Append( this.actViewBoxes.CreateMenuItem() );
mView.Append( this.actViewFrames.CreateMenuItem() );
mView.Append( this.actViewNotebook.CreateMenuItem() );
mView.Append( this.actViewDrawing.CreateMenuItem() );
menuBar.Append( miFile );
menuBar.Append( miView );
menuBar.Append( miHelp );
this.vbMain.PackStart( menuBar, false, false, 5 );
}
示例2: UpdateMenu
void UpdateMenu ()
{
//
// Clear out the old list
//
foreach (Gtk.MenuItem old_item in menu.Children) {
menu.Remove (old_item);
}
//
// Build a new list
//
foreach (BacklinkMenuItem item in GetBacklinkMenuItems ()) {
item.ShowAll ();
menu.Append (item);
}
// If nothing was found, add in a "dummy" item
if (menu.Children.Length == 0) {
// This is a disabled placeholder item for an empty menu
Gtk.MenuItem blank_item = new Gtk.MenuItem (Catalog.GetString ("(none)"));
blank_item.Sensitive = false;
blank_item.ShowAll ();
menu.Append (blank_item);
}
submenu_built = true;
}
示例3: 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);
}
示例4: GameDBPlugin
public GameDBPlugin()
: base("gamedb",
Catalog.
GetString
("Games Database Plugin"),
Catalog.
GetString
("Game database"))
{
saveItem = new MenuItem (Catalog.
GetString
("Add Games to _Database"));
saveItem.Activated += on_add_to_db_activate;
saveItem.Show ();
/*
openDbItem = new MenuItem (Catalog.
GetString
("Games _Database"));
openDbItem.Activated +=
on_open_games_db_activate;
openDbItem.Show ();
*/
}
示例5: AddMenuItem
/// <summary>
/// Adds Gtk.MenuItem to Gtk.Menu.
/// </summary>
/// <param name="menu">Gtk.Menu object.</param>
/// <param name="label">Menu item label.</param>
/// <param name="atEnd">Whether item will be added to begining or end of menu.</param>
/// <param name="handler">Activated event handler.</param>
/// <param name="sensitive">Whether item is sensitive.</param>
public static Gtk.MenuItem AddMenuItem(this Gtk.Menu menu, string label, bool atEnd = true, System.EventHandler handler = null, bool sensitive = true)
{
Gtk.MenuItem menuitem = new Gtk.MenuItem(label);
menu.AddWidget(menuitem, atEnd, handler);
menuitem.Sensitive = sensitive;
return menuitem;
}
示例6: GetMenuItem
public override Gtk.MenuItem GetMenuItem ()
{
if (item == null) {
item = new Gtk.MenuItem (_label != null ? Catalog.GetString (_label) : Id);
item.Activated += OnActivated;
}
return item;
}
示例7: GetMenuItem
public override Gtk.MenuItem GetMenuItem ()
{
Gtk.MenuItem it = new Gtk.MenuItem (label);
Gtk.Menu submenu = new Gtk.Menu ();
foreach (MenuNode node in ChildNodes)
submenu.Insert (node.GetMenuItem (), -1);
it.Submenu = submenu;
return it;
}
示例8: Hook_Initialise
public override void Hook_Initialise(Forms.Main main)
{
menu = new Gtk.MenuItem("Display ignored text");
collector = new Graphics.Window();
collector.CreateChat(null, false, false, false);
menu.Activated += new EventHandler(Display);
collector.WindowName = "Ignored";
main.ToolsMenu.Append(menu);
menu.Show();
}
示例9: GetMenuItem
public override Gtk.MenuItem GetMenuItem ()
{
Gtk.MenuItem item;
if (icon != null)
item = new Gtk.ImageMenuItem (icon, accelGroup);
else
item = new Gtk.MenuItem (label);
item.Activated += OnClicked;
return item;
}
示例10: OnNoteOpened
public override void OnNoteOpened()
{
// Add the menu item when the window is created.
menu_item = new Gtk.MenuItem (
Catalog.GetString ("Note Statistics"));
menu_item.Activated += OnMenuItemActivated;
menu_item.Show ();
AddPluginMenuItem (menu_item);
}
示例11: Hook_Initialise
public override void Hook_Initialise(Forms.Main main)
{
_m = main;
item = new Gtk.MenuItem("#pidgeon");
item.Activated += new EventHandler(pidgeonToolStripMenuItem_Click);
separator = new Gtk.SeparatorMenuItem();
main.HelpMenu.Append(separator);
main.HelpMenu.Append(item);
separator.Show();
item.Show();
Core.DebugLog("Registered #pidgeon in menu");
}
示例12: OnNoteOpened
public override void OnNoteOpened()
{
if (this.Note.Title.StartsWith("GTD")) {
item = new Gtk.MenuItem("Update Tasks");
item.Activated += OnMenuItemActivated;
item.AddAccelerator ("activate", Window.AccelGroup,
(uint) Gdk.Key.d, Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
item.Show ();
AddPluginMenuItem (item);
}
}
示例13: Create
public static void Create(Tag [] tags, Gtk.Menu menu)
{
var findWithString = Catalog.GetPluralString ("Find _With", "Find _With", tags.Length);
var item = new Gtk.MenuItem (String.Format (findWithString, tags.Length));
Gtk.Menu submenu = GetSubmenu (tags);
if (submenu == null)
item.Sensitive = false;
else
item.Submenu = submenu;
menu.Append (item);
item.Show ();
}
示例14: Hook_BeforeTextMenu
public override void Hook_BeforeTextMenu(Extension.ScrollbackArgs Args)
{
text = Args.scrollback.SelectedText;
Gtk.SeparatorMenuItem xx = new Gtk.SeparatorMenuItem();
xx.Show();
Args.menu.Add(xx);
Gtk.MenuItem wiki = new Gtk.MenuItem("Search using wiki");
wiki.Activated += new EventHandler(SearchWiki);
wiki.Show();
Args.menu.Add(wiki);
Gtk.MenuItem goog = new Gtk.MenuItem("Search using google");
goog.Show();
goog.Activated += new EventHandler(SearchGoogle);
Args.menu.Add(goog);
}
示例15: OnNoteOpened
public override void OnNoteOpened ()
{
// Add the menu item when the window is created
item = new Gtk.MenuItem (
Catalog.GetString ("Insert Timestamp"));
item.Activated += OnMenuItemActivated;
item.AddAccelerator ("activate", Window.AccelGroup,
(uint) Gdk.Key.d, Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
item.Show ();
AddPluginMenuItem (item);
// Get the format from GConf and subscribe to changes
date_format = (string) Preferences.Get (
Preferences.INSERT_TIMESTAMP_FORMAT);
Preferences.SettingChanged += OnFormatSettingChanged;
}