本文整理汇总了C#中Gtk.Menu.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.Add方法的具体用法?C# Menu.Add怎么用?C# Menu.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Menu
的用法示例。
在下文中一共展示了Menu.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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 ();
}
示例3: MainWindow
public MainWindow()
{
Build ();
popupMenu = new Menu ();
ImageMenuItem explore = new ImageMenuItem ("Explore");
explore.Image = new Image (Stock.Open, IconSize.Menu);
explore.Activated += Open;
popupMenu.Add (explore);
ImageMenuItem quit = new ImageMenuItem ("Exit");
quit.Image = new Image (Stock.Quit, IconSize.Menu);
quit.Activated += (object sender, EventArgs e) => {
Application.Quit ();
};
popupMenu.Add (quit);
statusIcon = new StatusIcon ();
statusIcon.Pixbuf = c.Icon.Bitmap.ToPixbuf ();
statusIcon.Activate += Open;
statusIcon.PopupMenu += (object o, PopupMenuArgs args) => {
popupMenu.ShowAll ();
popupMenu.Popup ();
};
statusIcon.Tooltip = c.Icon.Tooltip;
statusIcon.Visible = true;
}
示例4: Initalize
public void Initalize(MainWindow window, MenuItem treerebuild, PropertiesView propertiesView)
{
this.window = window;
this.propertiesView = propertiesView;
menu = new Menu ();
treenewitem = new MenuItem ("New Item...");
treenewitem.Activated += window.OnNewItemActionActivated;
menu.Add (treenewitem);
treeadditem = new MenuItem ("Add Item...");
treeadditem.Activated += window.OnAddItemActionActivated;
menu.Add (treeadditem);
treedelete = new MenuItem ("Delete");
treedelete.Activated += window.OnDeleteActionActivated;
menu.Add (treedelete);
seperator = new SeparatorMenuItem ();
menu.Add (seperator);
treeopenfile = new MenuItem ("Open File");
treeopenfile.Activated += delegate {
List<TreeIter> iters;
List<Gdk.Pixbuf> icons;
GetSelectedTreePath(out iters, out icons);
if(icons[0] != ICON_BASE)
Process.Start(window._controller.GetFullPath(GetPathFromIter(iters[0])));
else
Process.Start(openedProject);
};
menu.Add (treeopenfile);
treeopenfilelocation = new MenuItem ("Open File Location");
treeopenfilelocation.Activated += delegate {
List<TreeIter> iters;
List<Gdk.Pixbuf> icons;
GetSelectedTreePath(out iters, out icons);
if(icons[0] != ICON_BASE)
Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath(GetPathFromIter(iters[0]))));
else
Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath("")));
};
menu.Add (treeopenfilelocation);
seperator2 = new SeparatorMenuItem ();
menu.Add (seperator2);
menu.Add (treerebuild);
}
示例5: CreateDirectoryMenu
private void CreateDirectoryMenu(string directoryPath, string mediaType)
{
Menu cmMediaDirectory = new Menu();
cmMediaDirectory.WidthRequest = 150;
cmMediaDirectory.Add(_parent.oMenuItems.PlayDirectory(directoryPath, mediaType));
cmMediaDirectory.Add(_parent.oMenuItems.EnqueDirectory(directoryPath, mediaType));
cmMediaDirectory.Add(_parent.oMenuItems.Seperator());
cmMediaDirectory.Add(_parent.oMenuItems.CollapseAll());
cmMediaDirectory.ShowAll();
cmMediaDirectory.Popup();
}
示例6: PlayerMenu
public PlayerMenu()
{
playerMenu = new Menu ();
addToPlaylistMenu = new MenuItem ("");
playerMenu.Add (addToPlaylistMenu);
exportToVideoFile = new MenuItem ("");
exportToVideoFile.Add (exportToVideoFile);
}
示例7: GetPopupMenu
public static Gtk.Menu GetPopupMenu(Order[] selected)
{
Menu popupMenu = new Gtk.Menu();
MenuItemId<Order[]> menuItemYandex = new MenuItemId<Order[]>("Открыть на Yandex картах(координаты)");
menuItemYandex.Activated += MenuItemYandex_Activated;
menuItemYandex.ID = selected;
popupMenu.Add(menuItemYandex);
MenuItemId<Order[]> menuItemYandexAddress = new MenuItemId<Order[]>("Открыть на Yandex картах(адрес)");
menuItemYandexAddress.Activated += MenuItemYandexAddress_Activated;
menuItemYandexAddress.ID = selected;
popupMenu.Add(menuItemYandexAddress);
MenuItemId<Order[]> menuItemOSM = new MenuItemId<Order[]>("Открыть на карте OSM");
menuItemOSM.Activated += MenuItemOSM_Activated;
menuItemOSM.ID = selected;
popupMenu.Add(menuItemOSM);
return popupMenu;
}
示例8: OnTrayIconPopup
// Create the popup menu, on right click.
static void OnTrayIconPopup(object o, EventArgs args)
{
Menu popupMenu = new Menu();
ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");
Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
menuItemQuit.Image = appimg;
var machines = machineService.GetAllMachines ()
.GroupBy (x => x.GroupName);
foreach (var item in machines) {
if (item.Key == null)
continue;
MenuItem parentItem = new MenuItem (item.Key);
Menu subMenu = new Menu ();
foreach (Machine machine in item) {
// ImageMenuItem menuItem = new ImageMenuItem (machine.FileName);
// menuItem.Image = new Gtk.Image (Stock.Connect, IconSize.Menu);
MenuItem menuItem = new MenuItem (machine.RemoteType + " - " + machine.FileName);
menuItem.Activated += (object sender, EventArgs e) => {
if (machine.RemoteType == RemoteType.RDP) {
machineService.LaunchRDP(machine, settings);
} else if (machine.RemoteType == RemoteType.SSH) {
machineService.LaunchSSH(machine, settings);
} else if (machine.RemoteType == RemoteType.VNC) {
machineService.LaunchVNC(machine, settings);
}
};
subMenu.Add (menuItem);
}
parentItem.Submenu = subMenu;
popupMenu.Add (parentItem);
}
popupMenu.Add(menuItemQuit);
menuItemQuit.Activated += delegate { Application.Quit(); };
popupMenu.ShowAll();
popupMenu.Popup();
}
示例9: CreateMenu
Menu CreateMenu (bool importantOnly)
{
if (TagModel != null) {
Menu menu = new Menu ();
bool itemsAdded = false;
foreach (StringTagDescription[] tags in TagModel.GetTagsGrouped ()) {
if (itemsAdded) {
SeparatorMenuItem sep = new SeparatorMenuItem ();
menu.Add (sep);
}
foreach (StringTagDescription tag in tags) {
if (tag.Important != importantOnly)
continue;
MenuItem item = new MenuItem (tag.Description);
string tagString = tag.Name;
item.ButtonPressEvent += delegate {
InsertTag (tagString);
};
menu.Add (item);
itemsAdded = true;
}
}
if (importantOnly) {
Menu subMenu = CreateMenu (false);
if (subMenu.Children.Length > 0) {
SeparatorMenuItem sep = new SeparatorMenuItem ();
menu.Add (sep);
MenuItem item = new MenuItem (GettextCatalog.GetString ("More"));
item.Submenu = subMenu;
menu.Add (item);
}
}
menu.ShowAll ();
return menu;
}
return null;
}
示例10: OnImageClick
// handler for mouse click
private void OnImageClick(object o, ButtonPressEventArgs args)
{
if (args.Event.Button == 3) //right click
{
Menu popupMenu = new Menu (); // creates the menu
ImageMenuItem menuPopup1 = new ImageMenuItem ("Quit");
Image appimg = new Image (Stock.Quit, IconSize.Menu);
menuPopup1.Image = appimg; // sets the menu item's image
popupMenu.Add (menuPopup1); // adds the menu item to the menu
menuPopup1.Activated += new EventHandler (this.OnPopupClick); // event when the user clicks the icon
popupMenu.ShowAll (); // shows everything
// pops up the actual menu when the user right clicks
popupMenu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
}
else
{
Menu mainPopupMenu = new Menu ();
ImageMenuItem menuPopupReload = new ImageMenuItem ("Reload");
ImageMenuItem menuPopupAbout = new ImageMenuItem ("About");
Image reloadimg = new Image (Stock.Refresh, IconSize.Menu);
Image aboutimg = new Image (Stock.About, IconSize.Menu);
menuPopupReload.Image = reloadimg;
menuPopupAbout.Image = aboutimg;
mainPopupMenu.Add (menuPopupReload);
mainPopupMenu.Add (menuPopupAbout);
menuPopupReload.Activated += new EventHandler (this.OnPopupReloadClick);
menuPopupAbout.Activated += new EventHandler (this.OnPopupAboutClick);
mainPopupMenu.ShowAll ();
mainPopupMenu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
}
}
示例11: MediaContextMenu
// create the context menu
public MediaContextMenu(Media media)
: base()
{
this.media = media;
ImageMenuItem play = new ImageMenuItem (Stock.MediaPlay, null);
ImageMenuItem edit = new ImageMenuItem (Stock.Edit, null);
MenuItem lyrics = new MenuItem ("View Lyrics");
MenuItem info = new MenuItem ("View Artist Info");
MenuItem add_to_playlist = new MenuItem ("Add To Playlist");
play.Activated += play_activated;
edit.Activated += edit_activated;
lyrics.Activated += lyrics_activated;
info.Activated += info_activated;
// the "Add To Playlist" menu
Menu playlist_menu = new Menu ();
add_to_playlist.Submenu = playlist_menu;
foreach (object[] row in Global.Core.Library.PlaylistTree.PlaylistStore)
{
Playlist playlist = (Playlist) row[0];
MenuItem playlist_item = new MenuItem (playlist.Name);
playlist_menu.Add (playlist_item);
playlist_item.Activated += delegate (object o, EventArgs args) {
Global.Core.Library.MediaTree.MediaStore.AddMedia (media.Path, playlist);
};
}
if (Global.Core.Library.PlaylistTree.PlaylistStore.IterNChildren () == 0)
add_to_playlist.Sensitive = false;
this.Add (play);
this.Add (edit);
this.Add (lyrics);
this.Add (info);
this.Add (new SeparatorMenuItem ());
this.Add (add_to_playlist);
}
示例12: OnTrayIconPopup
// Create the popup menu, on right click.
static void OnTrayIconPopup(object o, EventArgs args)
{
Menu popupMenu = new Menu();
ImageMenuItem menuItemQuit = new Gtk.ImageMenuItem("Quit");
Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
menuItemQuit.Image = appimg;
popupMenu.Add(menuItemQuit);
// Quit the application when quit has been clicked.
menuItemQuit.Activated += delegate
{
Application.Quit();
};
popupMenu.ShowAll();
popupMenu.Popup();
popupMenu.TakeFocus = true;
popupMenu.Title = "Graal RC";
}
示例13: CreateFileMenu
private void CreateFileMenu(string filePath)
{
Menu cmMediaFile = new Menu();
cmMediaFile.WidthRequest = 150;
cmMediaFile.Add(_parent.oMenuItems.PlayFile(filePath));
cmMediaFile.Add(_parent.oMenuItems.EnqueFile(filePath));
cmMediaFile.Add(_parent.oMenuItems.Seperator());
cmMediaFile.Add(_parent.oMenuItems.ShowSongInfo("sharebrowser"));
//cmMediaFile.Add(_parent.oMenuItems.SaveSelectedFile());
cmMediaFile.Add(_parent.oMenuItems.Seperator());
cmMediaFile.Add(_parent.oMenuItems.CollapseAll());
cmMediaFile.ShowAll();
cmMediaFile.Popup();
}
示例14: CreateMediaMenu
private void CreateMediaMenu(string caller, string identifier)
{
Menu cmMedia = new Menu();
cmMedia.WidthRequest = 200;
cmMedia.Add(_parent.oMenuItems.Play(caller, identifier));
cmMedia.Add(_parent.oMenuItems.Enque(caller, identifier));
cmMedia.Add(_parent.oMenuItems.RefreshShares());
if (caller != "album")
{
cmMedia.Add(_parent.oMenuItems.Seperator());
cmMedia.Add(_parent.oMenuItems.CollapseAll());
}
if (caller == "file")
{
cmMedia.Add(_parent.oMenuItems.Seperator());
cmMedia.Add(_parent.oMenuItems.ShowSongInfo("sharebrowser"));
}
cmMedia.ShowAll();
cmMedia.Popup();
}
示例15: header_click
private void header_click(ButtonPressEventArgs args, Category cat)
{
if (args.Event.Button == 3) {
Menu popupMenu = new Menu();
MenuItem create_label = new MenuItem(Mono.Unix.Catalog.GetString("Create a new label"));
create_label.Activated += delegate { add_new_label(); };
popupMenu.Add(create_label);
MenuItem rename_item = new MenuItem(Mono.Unix.Catalog.GetString("Rename category"));
rename_item.Activated += delegate { rename_category(false); };
popupMenu.Add(rename_item);
if (!category.initial) {
MenuItem delete_item = new MenuItem(Mono.Unix.Catalog.GetString("Delete category"));
delete_item.Activated += delegate { remove_category_callback(cat.metalabel.db_id); };
popupMenu.Add(delete_item);
}
popupMenu.Add(new Gtk.SeparatorMenuItem());
MenuItem create_item = new MenuItem(Mono.Unix.Catalog.GetString("Create a new category"));
create_item.Activated += delegate { add_new_category_to_ui_callback(); };
popupMenu.Add(create_item);
popupMenu.ShowAll();
popupMenu.Popup(null, null, null, args.Event.Button, args.Event.Time);
}
}