本文整理汇总了C#中Gtk.MenuItem类的典型用法代码示例。如果您正苦于以下问题:C# MenuItem类的具体用法?C# MenuItem怎么用?C# MenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuItem类属于Gtk命名空间,在下文中一共展示了MenuItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ();
}
示例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;
}
示例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 ();
}
示例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;
}
示例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);
}
示例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 ();
}
示例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();
}
}
示例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;
}
}
}
示例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);
}
}
示例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();
}
示例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 ();
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}