本文整理汇总了C#中Gtk.MenuItem类的典型用法代码示例。如果您正苦于以下问题:C# MenuItem类的具体用法?C# MenuItem怎么用?C# MenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuItem类属于Gtk命名空间,在下文中一共展示了MenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SparkleStatusIcon
public SparkleStatusIcon()
: base()
{
FolderSize = GetFolderSize (new DirectoryInfo (SparklePaths.SparklePath));
FrameNumber = 0;
AnimationFrames = CreateAnimationFrames ();
Animation = CreateAnimation ();
SyncingReposCount = 0;
StateText = "";
StatusMenuItem = new MenuItem ();
CreateMenu ();
// Primary mouse button click
Activate += ShowMenu;
// Secondary mouse button click
PopupMenu += ShowMenu;
SetIdleState ();
ShowState ();
}
开发者ID:Sascha833,项目名称:TestProjekt,代码行数:25,代码来源:SparkleStatusIcon.cs
示例2: MenuBarController
public MenuBarController()
{
MenuBar mb = new MenuBar();
Menu filemenu = new Menu();
MenuItem file = new MenuItem("File");
file.Submenu = filemenu;
ImageMenuItem importDirectoryMenuItem = new ImageMenuItem("Import Directory");
importDirectoryMenuItem.Activated += ImportDirectoryMenuItemOnActivated;
filemenu.Append(importDirectoryMenuItem);
ImageMenuItem open = new ImageMenuItem(Stock.Open);
filemenu.Append(open);
SeparatorMenuItem sep = new SeparatorMenuItem();
filemenu.Append(sep);
ImageMenuItem exit = new ImageMenuItem(Stock.Quit);
exit.Activated += (sender, args) => Application.Quit();
filemenu.Append(exit);
mb.Append(file);
View = mb;
}
开发者ID:gclark916,项目名称:Howler,代码行数:26,代码来源:MenuBarController.cs
示例3: VideoContextMenu
// create the context menu
public VideoContextMenu()
: base()
{
MenuItem aspect_ratio = new MenuItem ("Aspect Ratio");
ImageMenuItem fullscreen = new ImageMenuItem (Stock.Fullscreen, null);
Menu aspect_menu = new Menu ();
aspect_auto = new RadioMenuItem ("Auto");
aspect_4x3 = new RadioMenuItem (aspect_auto, "4:3");
aspect_16x9 = new RadioMenuItem (aspect_auto, "16:9");
aspect_16x10 = new RadioMenuItem (aspect_auto, "16:10");
aspect_menu.Add (aspect_auto);
aspect_menu.Add (aspect_4x3);
aspect_menu.Add (aspect_16x9);
aspect_menu.Add (aspect_16x10);
aspect_ratio.Submenu = aspect_menu;
this.Add (aspect_ratio);
showVisualisations ();
this.Add (new SeparatorMenuItem ());
this.Add (fullscreen);
fullscreen.Activated += fullscreen_activated;
aspect_auto.ButtonReleaseEvent += aspect_auto_toggled;
aspect_4x3.ButtonReleaseEvent += aspect_4x3_toggled;
aspect_16x9.ButtonReleaseEvent += aspect_16x9_toggled;
aspect_16x10.ButtonReleaseEvent += aspect_16x10_toggled;
toggle_aspect_value ();
}
开发者ID:gsterjov,项目名称:fusemc,代码行数:36,代码来源:VideoContextMenu.cs
示例4: EquipmentReceptionView
public EquipmentReceptionView()
{
this.Build();
ytreeEquipment.ColumnsConfig = Gamma.GtkWidgets.ColumnsConfigFactory.Create<ReceptionEquipmentItemNode> ()
.AddColumn ("Номенклатура").AddTextRenderer (node => node.Name)
.AddColumn ("Серийный номер").AddTextRenderer (node => node.Serial)
.AddColumn ("Кол-во")
.AddToggleRenderer (node => node.Returned, false)
.AddNumericRenderer (node => node.Amount, false)
.AddColumn("Номер заявки на сервис")
.AddTextRenderer(
node => node.ServiceClaim != null
? node.ServiceClaim.Id.ToString()
: "")
.AddColumn("")
.Finish ();
ytreeEquipment.Selection.Changed += YtreeEquipment_Selection_Changed;
ytreeEquipment.ItemsDataSource = ReceptionEquipmentList;
//Создаем меню в кнопке выбора СН
var menu = new Menu();
menuitemRegisterSerial = new MenuItem("Зарегистрировать новый СН");
menuitemRegisterSerial.Activated += MenuitemRegisterSerial_Activated;
menu.Add(menuitemRegisterSerial);
menuitemSelectFromClient = new MenuItem("Выбрать по клиенту");
menuitemSelectFromClient.Activated += MenuitemSelectFromClient_Activated;
menu.Add(menuitemSelectFromClient);
var menuitemSelectFromUnused = new MenuItem("Незадействованные СН");
menuitemSelectFromUnused.Activated += MenuitemSelectFromUnused_Activated;
menu.Add(menuitemSelectFromUnused);
menu.ShowAll();
buttonSelectSerial.Menu = menu;
}
开发者ID:QualitySolution,项目名称:Vodovoz,代码行数:35,代码来源:EquipmentReceptionView.cs
示例5: PlayListTreeView
public PlayListTreeView()
{
this.HeadersVisible = false;
ls = new ListStore(typeof(PlayListPlay));
this.Model = ls;
menu = new Menu();
MenuItem title = new MenuItem(Catalog.GetString("Edit Title"));
title.Activated += new EventHandler(OnTitle);
title.Show();
MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
delete.Activated += new EventHandler(OnDelete);
delete.Show();
setRate = new MenuItem(Catalog.GetString("Apply current play rate"));
setRate.Activated += new EventHandler(OnApplyRate);
setRate.Show();
menu.Append(title);
menu.Append(setRate);
menu.Append(delete);
Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
nameColumn.Title = Catalog.GetString("Name");
Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
nameColumn.PackStart(nameCell, true);
nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
this.AppendColumn(nameColumn);
}
开发者ID:dineshkummarc,项目名称:longomatch,代码行数:28,代码来源:PlayListTreeView.cs
示例6: TIcon
public TIcon(CInterfaceGateway in_krnGateway, Gtk.Window mwindow)
{
krnGateway = in_krnGateway;
mainwindow = mwindow;
menu = new Gtk.Menu ();
EventBox eb = new EventBox ();
eb.ButtonPressEvent += new ButtonPressEventHandler (TIconClicked);
eb.Add (new Gtk.Image (new Gdk.Pixbuf (null, "lPhant.png")));
MenuItem it_show = new MenuItem ("Show");
it_show.Activated += new EventHandler (TIconShow);
MenuItem it_options = new MenuItem ("Options");
it_options.Activated += new EventHandler (TIconOptions);
ImageMenuItem it_quit = new ImageMenuItem("Quit");
it_quit.Activated += new EventHandler (TIconQuit);
menu.Append (it_show);
menu.Append (it_options);
menu.Append (it_quit);
t = new TrayIcon ("eLePhantGTK");
t.Add (eb);
t.ShowAll ();
}
开发者ID:sonicwang1989,项目名称:lphant,代码行数:27,代码来源:TIcon.cs
示例7: GenerationMenuWidget
public GenerationMenuWidget(Window parent, IElement referer, Bus bus, string busName)
{
if (referer.Data != null) {
MenuItem path = new MenuItem("Call " + referer.Name + "...");
ObjectPath p = new ObjectPath(referer.Parent.Parent.Path);
if (!referer.Data.IsProperty) {
path.Activated += delegate {
MethodInvokeDialog diag = new MethodInvokeDialog (parent, bus, busName, p, referer);
while (diag.Run () == (int)ResponseType.None);
diag.Destroy();
};
} else {
path.Activated += delegate {
PropertyInvokeDialog diag = new PropertyInvokeDialog (parent, bus, busName, p, referer);
while (diag.Run () == (int)ResponseType.None);
diag.Destroy();
};
}
this.Append(path);
path.ShowAll();
}
}
开发者ID:garuma,项目名称:dbus-explorer,代码行数:26,代码来源:GenerationMenuWidget.cs
示例8: MenuItemWrapper
public MenuItemWrapper(string text, MenuIcons icon, System.Action callback, IList<IMenuItem> subitems)
{
if (text == "-")
m_item = new SeparatorMenuItem();
else
{
m_item = new ImageMenuItem(text);
if (!Duplicati.Library.Utility.Utility.IsClientOSX)
if (icon != MenuIcons.None) {
((ImageMenuItem)m_item).Image = GetIcon(icon);
//TODO: Not sure we should do this, it overrides policy?
m_item.ExposeEvent += DrawImageMenuItemImage;
}
if (subitems != null && subitems.Count > 0)
{
Menu s = new Menu();
foreach(var sm in subitems)
s.Add(((MenuItemWrapper)sm).m_item);
m_item.Submenu = s;
}
if (callback != null)
{
m_item.Activated += ClickHandler;
m_callback = callback;
}
}
}
开发者ID:admz,项目名称:duplicati,代码行数:31,代码来源:GtkRunner.cs
示例9: BuildMenu
public static void BuildMenu(MenuShell menu, ActionModelNode node)
{
if (node.PathSegment != null)
{
MenuItem menuItem;
if (node.Action != null)
{
// this is a leaf node (terminal menu item)
menuItem = new ActiveMenuItem((IClickAction)node.Action);
}
else
{
// this menu item has a sub menu
string menuText = node.PathSegment.LocalizedText.Replace('&', '_');
menuItem = new MenuItem(menuText);
menuItem.Submenu = new Menu();
}
menu.Append(menuItem);
menu = (MenuShell)menuItem.Submenu;
}
foreach (ActionModelNode child in node.ChildNodes)
{
BuildMenu(menu, child);
}
}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:28,代码来源:GtkMenuBuilder.cs
示例10: VolatileReader
public VolatileReader()
: base("Volatile Reader")
{
this.Build ();
SetDefaultSize(250,200);
SetPosition(Gtk.WindowPosition.Center);
DeleteEvent += delegate(object o, DeleteEventArgs args) {
Application.Quit();
};
MenuBar bar = new MenuBar();
Menu fileMenu = new Menu();
MenuItem fileMenuItem = new MenuItem("File");
fileMenuItem.Submenu = fileMenu;
MenuItem exit = new MenuItem("Exit");
exit.Activated += delegate(object sender, EventArgs e) {
Application.Quit();
};
MenuItem openFile = new MenuItem("Open file...");
openFile.Activated += OpenFile;
fileMenu.Append(openFile);
fileMenu.Append(exit);
bar.Append(fileMenuItem);
_vbox = new VBox(false, 2);
_vbox.PackStart(bar, false, false, 0);
this.Add(_vbox);
this.ShowAll();
}
开发者ID:mubix,项目名称:volatile_reader,代码行数:35,代码来源:VolatileReader.cs
示例11: Main21
public static void Main21 (string[] args)
{
Application.Init();
Window win = new Window ("Menu Sample App");
win.DeleteEvent += new DeleteEventHandler (delete_cb);
win.DefaultWidth = 200;
win.DefaultHeight = 150;
VBox box = new VBox (false, 2);
MenuBar mb = new MenuBar ();
Menu file_menu = new Menu ();
MenuItem exit_item = new MenuItem("Exit");
exit_item.Activated += new EventHandler (exit_cb);
file_menu.Append (exit_item);
MenuItem file_item = new MenuItem("File");
file_item.Submenu = file_menu;
mb.Append (file_item);
box.PackStart(mb, false, false, 0);
Button btn = new Button ("Yep, that's a menu");
box.PackStart(btn, true, true, 0);
win.Add (box);
win.ShowAll ();
Application.Run ();
}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:28,代码来源:Menu.cs
示例12: Populate
/// <summary>
/// Populates the specified shell with sub-menus.
/// </summary>
/// <param name="manager">The manager.</param>
/// <param name="shell">The shell.</param>
public void Populate(
ActionManager manager,
MenuShell shell)
{
var separator = new MenuItem();
shell.Add(separator);
}
开发者ID:dmoonfire,项目名称:mfgames-gtkext-cil,代码行数:12,代码来源:LayoutSeparator.cs
示例13: filter_file_array_viewer
public filter_file_array_viewer ()
{
this.Build ();
this.nodeview1.AppendColumn("Condition Name",new CellRendererText(), delegate(TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) {
if(node == null)return;
((CellRendererText)cell).Text = ((filter_file_node)node).ff.Name;
});
this.nodeview1.AppendColumn("File",new CellRendererText(), delegate(TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) {
if(node == null)return;
((CellRendererText)cell).Text = ((filter_file_node)node).ff.target;
});
this.nodeview1.NodeStore = new Gtk.NodeStore (typeof(filter_file_node));
MenuItem new_menu = new MenuItem("New");
new_menu.ButtonPressEvent += handle_new;
_cm.Add(new_menu);
MenuItem delete_menu = new MenuItem("Delete");
delete_menu.ButtonPressEvent += handle_delete;
_cm.Add(delete_menu);
_cm.ShowAll ();
this.nodeview1.ButtonPressEvent += HandleButtonPressEvent;
this.desc_label.SetSizeRequest (315, 100);
this.desc_label.SetAlignment (0, 0);
this.desc_label.LineWrap = true;
this.desc_label.SingleLineMode = false;
this.desc_label.SetPadding (10, 2);
Pango.FontDescription pf2 = new Pango.FontDescription ();
//pf2.Style = Pango.Style.Italic;
pf2.Weight = Pango.Weight.Light;
this.desc_label.ModifyFont (pf2);
}
开发者ID:Meticulus,项目名称:tactical,代码行数:32,代码来源:filter_file_array_viewer.cs
示例14: proxy_transaction_nodeview
public proxy_transaction_nodeview ()
{
this.Build ();
this.nodeview1.AppendColumn("Status",new CellRendererText(), delegate(TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) {
if(node == null)return;
((CellRendererText)cell).Text = ((proxy_transaction_node)node).status;
});
this.nodeview1.AppendColumn("Content-Type",new CellRendererText(), delegate(TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) {
if(node == null)return;
((CellRendererText)cell).Text = ((proxy_transaction_node)node).content_type;
});
this.nodeview1.AppendColumn("%",new CellRendererProgress(), delegate(TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) {
if(node == null)return;
((CellRendererProgress)cell).Value = ((proxy_transaction_node)node).percent_complete;
((CellRendererProgress)cell).Text = ((proxy_transaction_node)node).percent_complete + " %";
});
this.nodeview1.AppendColumn("Url",new CellRendererText(), delegate(TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) {
if(node == null)return;
((CellRendererText)cell).Text = ((proxy_transaction_node)node).urlfull;
});
this.nodeview1.NodeStore = new Gtk.NodeStore (typeof(proxy_transaction_node));
this.nodeview1.Columns [0].MaxWidth = 50;
this.nodeview1.Columns [1].MaxWidth = 100;
this.nodeview1.Columns [2].MaxWidth = 100;
this.nodeview1.Columns [3].MaxWidth = 400;
this.nodeview1.NodeSelection.Changed += on_node_selection_changed;
MenuItem copy_url = new MenuItem ("Copy URL");
copy_url.ButtonPressEvent += handle_copy_url;
_cm.Add (copy_url);
MenuItem save_to_file = new MenuItem("Save to File");
save_to_file.ButtonPressEvent += handle_save_to_file;
_cm.Add(save_to_file);
_cm.ShowAll ();
this.nodeview1.ButtonPressEvent += HandleButtonPressEvent;
this.nodeview1.ShowAll ();
this.desc_label.SetAlignment (0, 0);
this.desc_label.SingleLineMode = false;
this.desc_label.SetPadding (10, 2);
Pango.FontDescription pf2 = new Pango.FontDescription ();
pf2.Weight = Pango.Weight.Light;
this.desc_label.ModifyFont (pf2);
_update_timer.Interval = 100;
_update_timer.Elapsed += delegate(object sender, System.Timers.ElapsedEventArgs e) {
Gtk.Application.Invoke(_update_timer,new EventArgs(), (obj,args) => {
_update_timer.Enabled = false;
this.nodeview1.QueueDraw();
if(_scroll_lock)
this.nodeview1.ScrollToPoint (0, int.MaxValue);
_update_timer.Enabled = true;
});
};
_update_timer.Enabled = true;
object_viewer1.set_type(typeof(proxy_transaction));
}
开发者ID:Meticulus,项目名称:tactical,代码行数:60,代码来源:proxy_transaction_nodeview.cs
示例15: TaskManagerGui
/// <summary>
/// Initialization, takes the Addin this gui is attached to.
/// </summary>
public TaskManagerGui(TaskManagerNoteAddin addin)
{
this.addin = addin;
utils = new TaskNoteUtilities (addin.Buffer);
var duedateImage = new Gtk.Image(null, "Tomboy.TaskManager.Icons.duedate-icon22.png");
add_duedate.Image = duedateImage;
var priorityImage = new Gtk.Image(null, "Tomboy.TaskManager.Icons.priority-icon22.png");
add_priority.Image = priorityImage;
task_menu.Add (add_duedate);
task_menu.Add (add_priority);
task_menu.Add (show_priority);
if (Tomboy.Debugging) {
Gtk.MenuItem print_structure = new Gtk.MenuItem (Catalog.GetString ("Print Structure"));
print_structure.Activated += OnPrintStructureActivated;
task_menu.Add (print_structure);
}
var todoImage = new Gtk.Image(null, "Tomboy.TaskManager.Icons.todo-icon24.png");
menu_tool_button = new Gtk.MenuToolButton (todoImage, null);
menu_tool_button.TooltipText = Catalog.GetString ("Add a new TaskList");
menu_tool_button.ArrowTooltipText = Catalog.GetString ("Set TaskList properties");
menu_tool_button.Menu = task_menu;
task_menu.ShowAll ();
menu_tool_button.Show ();
addin.AddToolItem (menu_tool_button, -1);
}
开发者ID:rggjan,项目名称:Tomboy-Todo-List,代码行数:36,代码来源:TaskManagerGui.cs
示例16: Initialize
public override void Initialize()
{
itemInsert = new Gtk.MenuItem(Catalog.GetString("Insert checkbox"));
itemInsert.Activated += OnMenuItemActivatedUnmarked;
itemInsert.Show();
AddPluginMenuItem(itemInsert);
itemMarked = new Gtk.MenuItem(Catalog.GetString("Insert marked checkbox"));
itemMarked.Activated += OnMenuItemActivatedMarked;
itemMarked.Show();
AddPluginMenuItem(itemMarked);
itemXMarked = new Gtk.MenuItem(Catalog.GetString("Insert X marked checkbox"));
itemXMarked.Activated += OnMenuItemActivatedXMarked;
itemXMarked.Show();
AddPluginMenuItem(itemXMarked);
itemTick = new Gtk.MenuItem(Catalog.GetString("Insert tick"));
itemTick.Activated += OnMenuItemActivatedTick;
itemTick.Show();
AddPluginMenuItem(itemTick);
itemBallot = new Gtk.MenuItem(Catalog.GetString("Insert X ballot"));
itemBallot.Activated += OnMenuItemActivatedBallotX;
itemBallot.Show();
AddPluginMenuItem(itemBallot);
itemToggle = new Gtk.MenuItem(Catalog.GetString("Toggle checkmark"));
itemToggle.Activated += OnMenuItemActivatedToggle;
AddPluginMenuItem(itemToggle);
Gtk.AccelGroup accel_group = new Gtk.AccelGroup();
Window.AddAccelGroup(accel_group);
itemToggle.AddAccelerator("activate", accel_group,
new AccelKey(Gdk.Key.m,
Gdk.ModifierType.ControlMask,
AccelFlags.Visible));
itemToggle.Show();
}
开发者ID:pacoqueen,项目名称:tomboy-checkmark,代码行数:33,代码来源:Checkmark.cs
示例17: CreateMenus
Gtk.MenuBar CreateMenus ()
{
AccelGroup group = new AccelGroup ();
MenuBar bar = new MenuBar ();
Menu file_menu = new Menu ();
MenuItem file_menu_item = new MenuItem ("_File");
file_menu_item.Submenu = file_menu;
ImageMenuItem file_exit = new ImageMenuItem (Gtk.Stock.Quit, group);
file_exit.Activated += new EventHandler (exit_cb);
file_menu.Append (file_exit);
bar.Append (file_menu_item);
Menu help_menu = new Menu ();
ImageMenuItem help_menu_item = new ImageMenuItem (Gtk.Stock.Help, group);
help_menu_item.Submenu = help_menu;
ImageMenuItem file_help = new ImageMenuItem (Gnome.Stock.About, group);
file_help.Activated += new EventHandler (about_cb);
help_menu.Append (file_help);
bar.Append (help_menu_item);
bar.ShowAll ();
return bar;
}
开发者ID:directhex,项目名称:xamarin-gnome-sharp2,代码行数:26,代码来源:GnomeHelloWorld.cs
示例18: CreateMenu
void CreateMenu()
{
additem = new MenuItem (Catalog.GetString ("Add period"));
additem.Activated += (sender, e) => {
string periodname = Config.GUIToolkit.QueryMessage (Catalog.GetString ("Period name"), null,
(project.Periods.Count + 1).ToString (),
this);
if (periodname != null) {
project.Dashboard.GamePeriods.Add (periodname);
Period p = new Period { Name = periodname };
p.Nodes.Add (new TimeNode {
Name = periodname,
Start = new Time { TotalSeconds = time.TotalSeconds - 10 },
Stop = new Time { TotalSeconds = time.TotalSeconds + 10 }
});
project.Periods.Add (p);
if (timertimeline != null) {
timertimeline.AddTimer (p);
}
}
};
Add (additem);
delitem = new MenuItem (Catalog.GetString ("Delete period"));
delitem.Activated += (sender, e) => {
project.Periods.Remove (timer as Period);
if (timertimeline != null) {
timertimeline.RemoveTimer (timer);
}
};
Add (delitem);
ShowAll ();
}
开发者ID:GNOME,项目名称:longomatch,代码行数:32,代码来源:PeriodsMenu.cs
示例19: Populate
/// <summary>
/// Populates the specified shell with sub-menus.
/// </summary>
/// <param name="manager"></param>
/// <param name="shell">The shell.</param>
public void Populate(
ActionManager manager,
MenuShell shell)
{
// Get the action associated with this.
Action action = manager.GetAction(ActionName);
MenuItem menuItem;
if (action == null)
{
// Create a placeholder menu item.
menuItem = new MenuItem("<Unknown Action: " + ActionName + ">");
menuItem.Sensitive = false;
// Add it to the errors.
manager.Messages.Add(
new SeverityMessage(
Severity.Error, "Could not find action " + ActionName + " to add to menu."));
}
else
{
// Create a menu item from this action.
menuItem = new ActionMenuItem(manager, action);
}
// Add the resulting menu item to the list.
shell.Add(menuItem);
}
开发者ID:dmoonfire,项目名称:mfgames-gtkext-cil,代码行数:33,代码来源:LayoutAction.cs
示例20: AppWindowInfo
public AppWindowInfo (Window appWindow, MenuItem app, MenuItem window, CheckMenuItem fullscreen, CheckMenuItem maximize)
{
this.app_window = appWindow;
this.app = app;
this.window = window;
this.fullscreen = fullscreen;
this.maximize = maximize;
}
开发者ID:emtees,项目名称:old-code,代码行数:8,代码来源:AppWindowManager.cs
注:本文中的Gtk.MenuItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论