本文整理汇总了C#中Gtk.MenuItem类的典型用法代码示例。如果您正苦于以下问题:C# Gtk.MenuItem类的具体用法?C# Gtk.MenuItem怎么用?C# Gtk.MenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gtk.MenuItem类属于命名空间,在下文中一共展示了Gtk.MenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
}
开发者ID:Baltasarq,项目名称:GTKSharpDemo,代码行数:25,代码来源:MainWindowView.cs
示例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;
}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:28,代码来源:BacklinksNoteAddin.cs
示例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);
}
开发者ID:cgt,项目名称:Notes,代码行数:33,代码来源:MainWindow.cs
示例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 ();
*/
}
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:25,代码来源:GameDbPlugin.cs
示例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;
}
开发者ID:quequotion,项目名称:glippy,代码行数:16,代码来源:Extensions.cs
示例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;
}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:8,代码来源:MenuNode.cs
示例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;
}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:9,代码来源:SubmenuNode.cs
示例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();
}
开发者ID:JGunning,项目名称:OpenAIM,代码行数:10,代码来源:Class.cs
示例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;
}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:10,代码来源:MenuItemNode.cs
示例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);
}
开发者ID:eeejay,项目名称:tomboy-notestats,代码行数:11,代码来源:NoteStatisticsAddin.cs
示例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");
}
开发者ID:JGunning,项目名称:OpenAIM,代码行数:12,代码来源:Channel.cs
示例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);
}
}
开发者ID:aleneum,项目名称:tomboy-addin-task,代码行数:12,代码来源:TomboyTaskNoteAddin.cs
示例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 ();
}
开发者ID:Yetangitu,项目名称:f-spot,代码行数:14,代码来源:TermMenuItem.cs
示例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);
}
开发者ID:JGunning,项目名称:OpenAIM,代码行数:15,代码来源:Search.cs
示例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;
}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:17,代码来源:InsertTimestampNoteAddin.cs
示例16: Run
protected override void Run (RefactoringOptions options)
{
Gtk.Menu menu = new Gtk.Menu ();
bool resolveDirect;
List<string> namespaces = GetResolveableNamespaces (options, out resolveDirect);
foreach (string ns in namespaces) {
// remove used namespaces for conflict resolving.
if (options.Document.CompilationUnit.IsNamespaceUsedAt (ns, options.ResolveResult.ResolvedExpression.Region.Start))
continue;
Gtk.MenuItem menuItem = new Gtk.MenuItem (string.Format (GettextCatalog.GetString ("Add using '{0}'"), ns));
CurrentRefactoryOperationsHandler.ResolveNameOperation resolveNameOperation = new CurrentRefactoryOperationsHandler.ResolveNameOperation (options.Dom, options.Document, options.ResolveResult, ns);
menuItem.Activated += delegate {
resolveNameOperation.AddImport ();
};
menu.Add (menuItem);
}
if (resolveDirect) {
foreach (string ns in namespaces) {
Gtk.MenuItem menuItem = new Gtk.MenuItem (string.Format (GettextCatalog.GetString ("Add '{0}'"), ns));
CurrentRefactoryOperationsHandler.ResolveNameOperation resolveNameOperation = new CurrentRefactoryOperationsHandler.ResolveNameOperation (options.Dom, options.Document, options.ResolveResult, ns);
menuItem.Activated += delegate {
resolveNameOperation.ResolveName ();
};
menu.Add (menuItem);
}
}
if (menu.Children != null && menu.Children.Length > 0) {
menu.ShowAll ();
ICompletionWidget widget = options.Document.GetContent<ICompletionWidget> ();
CodeCompletionContext codeCompletionContext = widget.CreateCodeCompletionContext (options.GetTextEditorData ().Caret.Offset);
menu.Popup (null, null, delegate (Gtk.Menu menu2, out int x, out int y, out bool pushIn) {
x = codeCompletionContext.TriggerXCoord;
y = codeCompletionContext.TriggerYCoord;
pushIn = false;
}, 0, Gtk.Global.CurrentEventTime);
menu.SelectFirst (true);
}
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:43,代码来源:QuickFixHandler.cs
示例17: PopupQuickFixMenu
public void PopupQuickFixMenu ()
{
Gtk.Menu menu = new Gtk.Menu ();
Dictionary<Gtk.MenuItem, ContextAction> fixTable = new Dictionary<Gtk.MenuItem, ContextAction> ();
int mnemonic = 1;
foreach (ContextAction fix in fixes) {
var escapedLabel = fix.GetMenuText (document, loc).Replace ("_", "__");
var label = (mnemonic <= 10)
? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel
: " " + escapedLabel;
Gtk.MenuItem menuItem = new Gtk.MenuItem (label);
fixTable [menuItem] = fix;
menuItem.Activated += delegate(object sender, EventArgs e) {
// ensure that the Ast is recent.
document.UpdateParseDocument ();
var runFix = fixTable [(Gtk.MenuItem)sender];
runFix.Run (document, loc);
document.Editor.Document.CommitUpdateAll ();
menu.Destroy ();
};
menu.Add (menuItem);
}
menu.ShowAll ();
int dx, dy;
this.ParentWindow.GetOrigin (out dx, out dy);
dx += ((TextEditorContainer.EditorContainerChild)(this.document.Editor.Parent.Parent as TextEditorContainer) [this]).X;
dy += ((TextEditorContainer.EditorContainerChild)(this.document.Editor.Parent.Parent as TextEditorContainer) [this]).Y - (int)document.Editor.VAdjustment.Value;
menu.Popup (null, null, delegate (Gtk.Menu menu2, out int x, out int y, out bool pushIn) {
x = dx;
y = dy + Allocation.Height;
pushIn = false;
menuPushed = true;
QueueDraw ();
}, 0, Gtk.Global.CurrentEventTime);
menu.SelectFirst (true);
menu.Destroyed += delegate {
menuPushed = false;
QueueDraw ();
};
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:43,代码来源:ContextActionWidget.cs
示例18: MakeMenuItem
public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled)
{
Gtk.MenuItem i;
Gtk.StockItem item = Gtk.StockItem.Zero;
if (Gtk.StockManager.Lookup (l, ref item)) {
i = new Gtk.ImageMenuItem (l, new Gtk.AccelGroup ());
} else {
i = new Gtk.MenuItem (l);
}
if (e != null)
i.Activated += e;
i.Sensitive = enabled;
menu.Append (i);
i.Show ();
return i;
}
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:21,代码来源:GtkUtil.cs
示例19: Step1_SetWidget
public void Step1_SetWidget(Gtk.Widget widget)
{
// Add right-click context menu to control.
var menu = new Gtk.Menu();
var resetMenuItem = new Gtk.MenuItem("Reset Camera Offset");
resetMenuItem.Activated += delegate(object sender, EventArgs e) {
SetCameraOffset(0, 0);
};
menu.Add(resetMenuItem);
// Handle mouse move events.
widget.MotionNotifyEvent += delegate(object o, Gtk.MotionNotifyEventArgs args) {
if (!m_enabled) return;
if (!m_mouseDown) return;
double x = args.Event.X;
double y = args.Event.Y;
double dx = x - m_mouseDownX;
double dy = y - m_mouseDownY;
SetCameraOffset(m_offsetDownX + dx, m_offsetDownY + dy);
};
widget.ButtonPressEvent += delegate(object o, Gtk.ButtonPressEventArgs args) {
if (m_enablePopupMenu && (args.Event.Button & 2) == 2) {
menu.ShowAll();
menu.Popup();
return;
}
m_mouseDown = true;
m_mouseDownX = args.Event.X;
m_mouseDownY = args.Event.Y;
m_offsetDownX = m_offsetX;
m_offsetDownY = m_offsetY;
};
widget.ButtonReleaseEvent += delegate(object o, Gtk.ButtonReleaseEventArgs args) {
m_mouseDown = false;
};
}
开发者ID:bvssvni,项目名称:csharp-utils,代码行数:39,代码来源:CameraOffsetHelper.cs
示例20: IconSelectorMenu
public IconSelectorMenu (IProject project)
{
this.project = project;
// Stock icon selector
IconSelectorMenuItem selStock = new IconSelectorMenuItem (new StockIconSelectorItem ());
selStock.IconSelected += OnStockSelected;
Insert (selStock, -1);
// Project icon selector
if (project != null && project.IconFactory.Icons.Count > 0) {
IconSelectorMenuItem selProject = new IconSelectorMenuItem (new ProjectIconSelectorItem (project));
selProject.IconSelected += OnStockSelected;
Insert (selProject, -1);
}
Insert (new Gtk.SeparatorMenuItem (), -1);
Gtk.MenuItem it = new Gtk.MenuItem (Catalog.GetString ("More..."));
it.Activated += OnSetStockActionType;
Insert (it, -1);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:22,代码来源:IconSelectorMenu.cs
注:本文中的Gtk.MenuItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论