protected void OnTreeviewImagesButtonReleaseEvent(object o, ButtonReleaseEventArgs args) { if ((int)args.Event.Button == 3) { Gtk.Menu jBox = new Gtk.Menu(); Gtk.MenuItem MenuItem1; if (treeviewImages.Selection.CountSelectedRows() == 1) { foreach (object[] row in (ListStore)comboType.Model) { MenuItem1 = new MenuItem((string)row[0]); MenuItem1.Activated += OnImageListPopupDocType; jBox.Add(MenuItem1); } MenuItem1 = new SeparatorMenuItem(); jBox.Add(MenuItem1); TreeIter iter, parentIter; if (treeviewImages.Selection.GetSelected(out iter) && (ImageList.IterParent(out parentIter, iter)) && (ImageList.IterNChildren(parentIter) > 1)) { MenuItem1 = new MenuItem("Добавить в новый док."); MenuItem1.Activated += OnImageListPopupNewDoc; jBox.Add(MenuItem1); } MenuItem1 = new MenuItem("Удалить"); MenuItem1.Activated += OnImageListPopupDelete; jBox.Add(MenuItem1); } MenuItem1 = new MenuItem("Выбрать для всех"); Gtk.Menu jBox2 = new Gtk.Menu(); Gtk.MenuItem MenuItem2; MenuItem1.Submenu = jBox2; foreach (object[] row in (ListStore)comboType.Model) { MenuItem2 = new MenuItem((string)row[0]); MenuItem2.ButtonPressEvent += OnImageListPopupDocTypeAll; jBox2.Append(MenuItem2); } jBox.Append(MenuItem1); MenuItem1 = new MenuItem("Повернуть все"); jBox2 = new Gtk.Menu(); MenuItem1.Submenu = jBox2; MenuItem2 = new MenuItem("на 90°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate90All; jBox2.Append(MenuItem2); MenuItem2 = new MenuItem("на 180°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate180All; jBox2.Append(MenuItem2); MenuItem2 = new MenuItem("на 270°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate270All; jBox2.Append(MenuItem2); jBox.Append(MenuItem1); jBox.ShowAll(); jBox.Popup(); } }
// [GLib.ConnectBeforeAttribute] private void SDcontextmenu2(object o, ButtonPressEventArgs args) { if (args.Event.Button == 3) { /* right click */ Gtk.Menu popup_menu = new Gtk.Menu(); MenuItem Event1 = new MenuItem("Select ALL channels"); Event1.ButtonReleaseEvent += SelectAllChannels2; MenuItem Event2 = new MenuItem("Select NONE channels"); Event2.ButtonReleaseEvent += SelectNoneChannels2; MenuItem Event3 = new MenuItem("Sync selected channels"); Event3.ButtonReleaseEvent += SyncChannels2; popup_menu.Add(Event1); popup_menu.Add(Event2); popup_menu.Add(Event3); popup_menu.Add(new Gtk.SeparatorMenuItem()); MenuItem[] EventROI = new MenuItem[nirsdata[combobox_device1.Active].probe.ROIs.Count]; for (int i = 0; i < nirsdata[combobox_device2.Active].probe.ROIs.Count; i++) { EventROI[i] = new MenuItem(nirsdata[combobox_device2.Active].probe.ROIs[i].name); EventROI[i].ButtonReleaseEvent += SelectROI2; EventROI[i].Name = nirsdata[combobox_device2.Active].probe.ROIs[i].name; popup_menu.Add(EventROI[i]); } popup_menu.ShowAll(); popup_menu.Popup(); } }
public NodeVisualization(object _node) { Node = _node; Visited = false; visitCount = 0; popup = new Gtk.Menu(); Gtk.MenuItem connect = new MenuItem("Connect To"); connect.Activated += new EventHandler(OnConnect); popup.Add(connect); Gtk.MenuItem disconnect = new MenuItem("Remove Connection To"); disconnect.Activated += new EventHandler(OnDisconnect); popup.Add(disconnect); popup.Add(new Gtk.MenuItem()); Gtk.MenuItem rm = new MenuItem("Remove"); rm.Activated += new EventHandler(OnRemove); popup.Add(rm); caption = _node.ToString(); Name = _node.ToString(); Width = caption.Length * 8 + 50; Height = 40; SetSizeRequest(Width, Height); }
void CreateTreeViewContextMenu() { TreeViewContextMenu = new Gtk.Menu(); //Add Prev Gtk.MenuItem item = new MenuItem("Add Prev"); item.Name = "MenuItem_AddPrev"; item.Activated += MenuItem_Activated; TreeViewContextMenu.Add(item); //Add Next item = new MenuItem("Add Next"); item.Name = "MenuItem_AddNext"; item.Activated += MenuItem_Activated; TreeViewContextMenu.Add(item); //Add Sub item = new MenuItem("Add Sub"); item.Name = "MenuItem_AddSub"; item.Activated += MenuItem_Activated; TreeViewContextMenu.Add(item); //Delete item = new MenuItem("Delete This Item"); item.Name = "MenuItem_Delete"; item.Activated += MenuItem_Activated; TreeViewContextMenu.Add(item); }
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; }
// 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 (); }
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; }
private void PopupContextMenu(MouseEvent ev) { m_contextMenu = new Gtk.Menu(); Gtk.MenuItem copy = new Gtk.MenuItem("Copy"); Gtk.MenuItem cut = new Gtk.MenuItem("Cut"); Gtk.MenuItem paste = new Gtk.MenuItem("Paste"); copy.Activated += delegate(object sender, EventArgs e) { OnCopy(); }; cut.Activated += delegate(object sender, EventArgs e) { OnCut(); }; paste.Activated += delegate(object sender, EventArgs e) { OnPaste(ev); }; m_contextMenu.Add(copy); m_contextMenu.Add(cut); m_contextMenu.Add(paste); m_contextMenu.ShowAll(); m_contextMenu.Popup(); }
private void CreateContextMenu() { var m = TheContextMenu = new Gtk.Menu(); var i = new Gtk.MenuItem("Jump to source"); i.Activated += (s, e) => { JumpToSourceDoIt(PopupSource); }; m.Add(i); i = new Gtk.MenuItem("Edit this scope"); i.Activated += (s, e) => { }; m.Add(i); var mm = new Gtk.MenuItem("Assign style"); i = new Gtk.MenuItem("Assign new style..."); i.Activated += (s, e) => TheOverlayModel.AssignStyle(PdfOverlayModel.AssignStyleType.AssignNewStyle); var mmm = new Gtk.Menu(); mm.Submenu = mmm; mmm.Add(i); i = new Gtk.MenuItem("Assign current node style"); i.Activated += (s, e) => TheOverlayModel.AssignStyle(PdfOverlayModel.AssignStyleType.AssignCurrentNodeStyle); mmm.Add(i); i = new Gtk.MenuItem("Change style to new style..."); i.Activated += (s, e) => TheOverlayModel.AssignStyle(PdfOverlayModel.AssignStyleType.ChangeToNewStyle); mmm.Add(i); i = new Gtk.MenuItem("Change style to current node style"); i.Activated += (s, e) => TheOverlayModel.AssignStyle(PdfOverlayModel.AssignStyleType.ChangeToCurrentNodeStyle); mmm.Add(i); m.Add(mm); mm = new Gtk.MenuItem("Selection"); mmm = new Gtk.Menu(); mm.Submenu = mmm; i = new Gtk.MenuItem("Copy"); i.Activated += (s, e) => TheOverlayModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.Copy); mmm.Add(i); i = new Gtk.MenuItem("Copy enscoped"); i.Activated += (s, e) => TheOverlayModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.CopyEnscoped); mmm.Add(i); i = new Gtk.MenuItem("Cut"); i.Activated += (s, e) => TheOverlayModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.Cut); mmm.Add(i); i = new Gtk.MenuItem("Cut enscoped"); i.Activated += (s, e) => TheOverlayModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.CutEnscoped); mmm.Add(i); i = new Gtk.MenuItem("Delete"); i.Activated += (s, e) => TheOverlayModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.Delete); mmm.Add(i); i = new Gtk.MenuItem("Collect"); i.Activated += (s, e) => TheOverlayModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.Collect); mmm.Add(i); i = new Gtk.MenuItem("Collect and enscope"); i.Activated += (s, e) => TheOverlayModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.CollectEnscoped); mmm.Add(i); m.Add(mm); m.PopupMenu += (s, e) => { PopupSource = ObjectAtCursor; }; }
protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt) { if (QSMain.User.Permissions["worker"]) { return(false); } if (evnt.Button == 3) { Gtk.Menu jBox = new Gtk.Menu(); MenuItem MenuItem1; MenuItemId <OrderTypeClass> MenuItem2; if (ParentCalendar == null) { return(false); } if (ParentCalendar.OrdersTypes == null || ParentCalendar.OrdersTypes.Count == 0) { throw new InvalidOperationException("Типы заказов для календаря не установлены."); } else if (ParentCalendar.OrdersTypes.Count == 1 && TypeItemButton == TypeItemOrButton.Order) { MenuItem2 = new MenuItemId <OrderTypeClass>("Новый заказ"); MenuItem2.ID = ParentCalendar.OrdersTypes.First(); MenuItem2.ButtonPressEvent += OnButtonPopupAddWithType; jBox.Add(MenuItem2); } else if (TypeItemButton == TypeItemOrButton.Order) { MenuItem1 = new MenuItem("Новый заказ"); MenuItem1.Submenu = GetNewOrderTypesMenu(); jBox.Add(MenuItem1); } if (TypeItemButton == TypeItemOrButton.Order) { MenuItem1 = new MenuItem("Перенести"); MenuItem1.Sensitive = calendarItem != null; MenuItem1.Submenu = GetOrderWeekMoveMenu(); jBox.Add(MenuItem1); } MenuItem1 = new MenuItem("Удалить"); MenuItem1.Sensitive = calendarItem != null; MenuItem1.Activated += OnButtonPopupDelete; jBox.Add(MenuItem1); jBox.ShowAll(); jBox.Popup(); } return(base.OnButtonReleaseEvent(evnt)); }
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); }
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(); }
protected void OnButtonPrintClicked(object sender, EventArgs e) { Gtk.Menu jBox = new Gtk.Menu(); MenuItem MenuItem1; MenuItem1 = new MenuItem("Заказ"); MenuItem1.Activated += OnPopupPrintOrder; jBox.Add(MenuItem1); jBox.Add(new SeparatorMenuItem()); MenuItem1 = new MenuItem("Товарный чек"); MenuItem1.Activated += OnPopupPrintReceipt; jBox.Add(MenuItem1); jBox.ShowAll(); jBox.Popup(); }
private void AddMenuItem(string condition) { Gtk.MenuItem mi = new Gtk.MenuItem(condition.Replace("_", "__")); mi.Name = condition; mi.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.MenuItem)) { int start = 0; int end = 0; if (text.GetSelectionBounds(out start, out end)) { text.DeleteText(start, end); text.InsertText(condition, ref start); text.Position = text.Position + condition.Length; } else { int curPos = text.CursorPosition; text.InsertText(condition, ref curPos); text.Position = text.Position + condition.Length; } //entrName.Text = entrName.Text = String.Format("{0}$({1})", entrName.Text, (sender as Gtk.MenuItem).Name); } }; popupCondition.Add(mi); }
//[GLib.ConnectBeforeAttribute] protected void StimNode_Clicked(object o, ButtonPressEventArgs args) { if (args.Event.Button == 3) { /* right click */ Gtk.Menu popup_menu = new Gtk.Menu(); MenuItem removeEvent = new MenuItem("Remove Event"); MenuItem addEvent = new MenuItem("Add New Event"); removeEvent.ButtonReleaseEvent += RemoveEvent_ButtonReleaseEvent; addEvent.ButtonReleaseEvent += AddEvent_ButtonReleaseEvent; popup_menu.Add(removeEvent); popup_menu.Add(addEvent); popup_menu.ShowAll(); popup_menu.Popup(); } }
private void BuildContextMenu() { contextMenu = new Menu(); createItem = new ImageMenuItem(_("Create")); createItem.Image = new Image(Stock.Add, IconSize.Menu); createItem.Activated += Event.Wrap((EventHandler) delegate(object o, EventArgs e) { Controller.Add(new TorrentLabel(_("New Label"))); }); contextMenu.Append(createItem); removeItem = new ImageMenuItem(_("Remove")); removeItem.Image = new Image(Stock.Remove, IconSize.Menu); contextMenu.Add(removeItem); removeItem.Activated += Event.Wrap((EventHandler) delegate(object o, EventArgs e) { TreeIter iter; if (!Selection.GetSelected(out iter)) { return; } TorrentLabel label = (TorrentLabel)Model.GetValue(iter, 0); if (label.Immutable) { return; } Controller.Remove(label); }); }
public static ImageMenuItem AddImageMenuButton(string title, string imgName, Gtk.Menu parent, Func <string, int> onMenuClickAction, string menuClickValue) { var sep = System.IO.Path.DirectorySeparatorChar; var menuItem = new ImageMenuItem(title); if (imgName != null) { var picFileName = SupportMethods.AppPath + sep + "Icons" + sep + imgName; if (System.IO.File.Exists(picFileName)) { menuItem.Image = new Gtk.Image(picFileName); } } if (onMenuClickAction != null) { menuItem.Activated += delegate { onMenuClickAction(menuClickValue); }; } if (parent != null) { parent.Add(menuItem); } return(menuItem); }
public static ImageMenuItem AddImageMenuButton(string title, string imgName, Gtk.Menu parent, EventHandler OnMenuClicked) { var sep = System.IO.Path.DirectorySeparatorChar; var menuItem = new ImageMenuItem(title); if (imgName != null) { var picFileName = SupportMethods.AppPath + sep + "Icons" + sep + imgName; if (System.IO.File.Exists(picFileName)) { menuItem.Image = new Gtk.Image(picFileName); } } if (OnMenuClicked != null) { menuItem.Activated += OnMenuClicked; } if (parent != null) { parent.Add(menuItem); } return(menuItem); }
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; }
public PlayerMenu() { playerMenu = new Menu (); addToPlaylistMenu = new MenuItem (""); playerMenu.Add (addToPlaylistMenu); exportToVideoFile = new MenuItem (""); exportToVideoFile.Add (exportToVideoFile); }
/// <summary> /// Обновляет данные виджета /// </summary> private void ResetLayout() { if (Menu != null) { Menu.Destroy(); Menu = null; } MenuItems = new Dictionary <ImageMenuItem, object>(); if (ItemsEnum == null) { return; } if (ItemsEnum.IsEnum == false) { throw new NotSupportedException(string.Format("ItemsEnum only supports enum types, specified was {0}", ItemsEnum)); } Menu = new Gtk.Menu(); string hint; //Gdk.Pixbuf p; ImageMenuItem item; foreach (FieldInfo info in ItemsEnum.GetFields()) { if (info.Name.Equals("value__")) { continue; } item = new ImageMenuItem(info.GetEnumTitle()); hint = info.GetFieldDescription(); //p = (Gdk.Pixbuf) info.GetEnumIcon(); //if (p != null) // item.Image = new Gtk.Image (p); if (!String.IsNullOrWhiteSpace(hint)) { item.TooltipText = hint; } item.Activated += OnMenuItemActivated; if (sensitiveFalseItems.Contains(info.GetValue(null))) { item.Sensitive = false; } if (invisibleItems.Contains(info.GetValue(null))) { item.Visible = false; } MenuItems.Add(item, info.GetValue(null)); Menu.Add(item); } Menu.ShowAll(); }
protected void MapClick(object o, ButtonPressEventArgs args) { Update(); lat = args.Event.X; lon = args.Event.Y; Gtk.Menu m = new Gtk.Menu(); Gtk.MenuItem createNode = new Gtk.MenuItem("Create a Node"); Gtk.MenuItem createEdge = new Gtk.MenuItem("Create an Edge"); Gtk.MenuItem calculateDjkstra = new Gtk.MenuItem("Calculate cost"); createNode.ButtonPressEvent += new ButtonPressEventHandler(CreateNodePressed); createEdge.ButtonPressEvent += new ButtonPressEventHandler(CreateEdgePressed); calculateDjkstra.ButtonPressEvent += new ButtonPressEventHandler(CalculateDjkstraPressed); m.Add(createNode); m.Add(createEdge); m.Add(calculateDjkstra); m.ShowAll(); m.Popup(); }
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); }
// 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(); }
private void UpdateItems(IList <ToolbarItem> toolBarItems) { foreach (var child in _toolbarSection.Children) { child.Destroy(); _toolbarSection.Remove(child); } foreach (var toolBarItem in toolBarItems.Where(t => t.Order != ToolbarItemOrder.Secondary)) { ToolButton newToolButton = ToolButtonHelper.CreateToolButton(toolBarItem); _toolbarSection.PackStart(newToolButton, false, false, GtkToolbarConstants.ToolbarItemSpacing); newToolButton.Clicked += (sender, args) => { ((IMenuItemController)toolBarItem).Activate(); }; toolBarItem.PropertyChanged -= OnToolbarItemPropertyChanged; toolBarItem.PropertyChanged += OnToolbarItemPropertyChanged; } var secondaryToolBarItems = toolBarItems.Where(t => t.Order == ToolbarItemOrder.Secondary); if (secondaryToolBarItems.Any()) { ToolButton secondaryButton = ToolButtonHelper.CreateToolButton(Stock.Add); _toolbarSection.PackStart(secondaryButton, false, false, 0); Gtk.Menu menu = new Gtk.Menu(); foreach (var secondaryToolBarItem in secondaryToolBarItems) { Gtk.MenuItem menuItem = new Gtk.MenuItem(secondaryToolBarItem.Text) { Sensitive = secondaryToolBarItem.IsEnabled }; menu.Add(menuItem); menuItem.ButtonPressEvent += (sender, args) => { ((IMenuItemController)secondaryToolBarItem).Activate(); }; secondaryToolBarItem.PropertyChanged -= OnToolbarItemPropertyChanged; secondaryToolBarItem.PropertyChanged += OnToolbarItemPropertyChanged; } secondaryButton.Clicked += (sender, args) => { menu.ShowAll(); menu.Popup(); }; } _toolbarSection.ShowAll(); }
public MemMapWidget(string pName, string cap) { popup = new Gtk.Menu(); Gtk.MenuItem text1 = new MenuItem("Test1"); text1.Activated += new EventHandler(Menu1Clicked); Gtk.MenuItem text2 = new MenuItem("Test2"); text2.Activated += new EventHandler(Menu2Clicked); popup.Add(text1); popup.Add(text2); parentName = pName; caption = cap; width = caption.Length * 8 + 10; this.Name = parentName + "MVObject"; this.SetSizeRequest(width, 100); //titleLayout = GetLayout(caption); }
// Create the popup menu, on right click. void OnTrayIconPopup(object o, EventArgs args) { popupMenu = new Gtk.Menu(); menuItemQuit = new ImageMenuItem("Quit"); appimg = new Gtk.Image(Stock.Quit, IconSize.Menu); menuItemQuit.Image = appimg; popupMenu.Add(menuItemQuit); // Quit the application when quit has been clicked. menuItemQuit.Activated += OnActivated; popupMenu.ShowAll(); popupMenu.Popup(); }
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; }
void Imageslist_ImageButtonPressEvent(object sender, ImageButtonPressEventArgs e) { if ((int)e.eventArgs.Event.Button == 3) { popupMenuOn = (NomenclatureImage)e.Tag; Gtk.Menu jBox = new Gtk.Menu(); Gtk.MenuItem MenuItem1 = new MenuItem("Удалить"); MenuItem1.Activated += DeleteImage_Activated;; jBox.Add(MenuItem1); jBox.ShowAll(); jBox.Popup(); } }
private Gtk.Menu GetNewOrderTypesMenu() { Gtk.Menu jBox2 = new Gtk.Menu(); MenuItemId <OrderTypeClass> MenuItem2; foreach (var type in ParentCalendar.OrdersTypes) { MenuItem2 = new MenuItemId <OrderTypeClass>(type.Name); MenuItem2.ID = type; MenuItem2.ButtonPressEvent += OnButtonPopupAddWithType; jBox2.Add(MenuItem2); } return(jBox2); }
void OnTrayIconPopup(object o, EventArgs args) { Gtk.Menu popupMenu = new Gtk.Menu(); foreach (var menuEntry in _TrayMenu.MenuEntries) { MenuItem menuItem = new MenuItem(menuEntry.Title); menuItem.Activated += (s, a) => menuEntry.Clicked?.Invoke(menuEntry); popupMenu.Add(menuItem); } popupMenu.ShowAll(); popupMenu.Popup(); }
// 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); } }
private void CreateMenu() { Gtk.MenuItem miRed = new Gtk.MenuItem("Red"); miRed.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.MenuItem)) { cbBackground.Color = new Gdk.Color(224, 41, 47); } }; popupColor.Add(miRed); Gtk.MenuItem miBlue = new Gtk.MenuItem("Blue"); miBlue.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.MenuItem)) { cbBackground.Color = new Gdk.Color(164, 192, 222); } }; popupColor.Add(miBlue); Gtk.MenuItem miUbuntu = new Gtk.MenuItem("Ubuntu"); miUbuntu.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.MenuItem)) { cbBackground.Color = new Gdk.Color(240, 119, 70); } }; popupColor.Add(miUbuntu); Gtk.MenuItem miOsx = new Gtk.MenuItem("Mac"); miOsx.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.MenuItem)) { cbBackground.Color = new Gdk.Color(218, 218, 218); } }; popupColor.Add(miOsx); }
private Gtk.Menu GetOrderWeekMoveMenu() { Gtk.Menu jBox2 = new Gtk.Menu(); MenuItemId <int> MenuItem2; for (int weeks = 5; weeks >= -5; weeks--) { if (weeks == 0) { jBox2.Add(new SeparatorMenuItem()); } else { string text = RusNumber.FormatCase(Math.Abs(weeks), "на {0} неделю", "на {0} недели", "на {0} недель") + (weeks > 0 ? " вперед" : " назад"); MenuItem2 = new MenuItemId <int>(text); MenuItem2.ID = weeks; MenuItem2.ButtonPressEvent += OnButtonPopupMoveWeeks; jBox2.Add(MenuItem2); } } return(jBox2); }
private void AddMenuItem(string condition) { Gtk.MenuItem mi = new Gtk.MenuItem(condition); mi.Name = condition; mi.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.MenuItem)) { if (!CheckMessage()) { return; } entrName.Text = entrName.Text = String.Format("{0}$({1})", entrName.Text, (sender as Gtk.MenuItem).Name); } }; popupCondition.Add(mi); }
protected void OnImagesButtonPressEvent(object o, ButtonPressEventArgs args) { if ((int)args.Event.Button == 3) { foreach (DocumentImage img in Images) { if (o == img.Widget) { PopupImageId = img.id; } } Gtk.Menu jBox = new Gtk.Menu(); Gtk.MenuItem MenuItem1 = new MenuItem("Сохранить"); MenuItem1.Activated += OnImagePopupSave; jBox.Add(MenuItem1); jBox.ShowAll(); jBox.Popup(); } }
private void AddMenuItem(string lib) { Gtk.MenuItem mi = new Gtk.MenuItem(lib); mi.Name = lib; mi.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.MenuItem)) { string txt = (sender as Gtk.MenuItem).Name; int indx = entUses.Text.IndexOf(txt); if (indx < 0) { entUses.Text = String.Format("{0} {1}", entUses.Text, txt); } } }; popupLibs.Add(mi); }
// 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); }
// 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"; }
private void SetupMenuItems(Gtk.Menu menu) { foreach (MenuItem item in Cell.ContextActions) { var menuItem = new ImageMenuItem(item.Text); string icon = item.Icon; if (!string.IsNullOrEmpty(icon)) { menuItem.Image = new Gtk.Image(icon); } menuItem.ButtonPressEvent += (sender, args) => { item.Activate(); }; menu.Add(menuItem); } }
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(); }
private void SetupMenuItems(Gtk.Menu menu) { foreach (MenuItem item in Cell.ContextActions) { var menuItem = new ImageMenuItem(item.Text); _ = item.ApplyNativeImageAsync(MenuItem.IconImageSourceProperty, icon => { if (icon != null) { menuItem.Image = new Gtk.Image(icon); } }); menuItem.ButtonPressEvent += (sender, args) => { ((IMenuItemController)item).Activate(); }; menu.Add(menuItem); } }
private void popupMenu() { Gtk.Menu popupMenu = new Gtk.Menu(); foreach (Sector sector in level.Sectors) { Gtk.MenuItem item = new Gtk.MenuItem(sector.Name); item.Name = sector.Name; item.Activated += OnSectorItemActivated; popupMenu.Add(item); } popupMenu.Add(new Gtk.SeparatorMenuItem()); Gtk.MenuItem propertiesItem = new Gtk.ImageMenuItem(Gtk.Stock.Properties, null); propertiesItem.Activated += OnPropertiesActivated; popupMenu.Add(propertiesItem); Gtk.ImageMenuItem camPropsItem = new Gtk.ImageMenuItem("Camera Properties"); camPropsItem.Activated += OnCameraPropertiesActivated; //camPropsItem.Image = Image(EditorStock.CameraMenuImage); //TODO: find out how to set custom image popupMenu.Add(camPropsItem); Gtk.MenuItem resizeItem = new Gtk.MenuItem("Resize"); resizeItem.Activated += OnResizeActivated; popupMenu.Add(resizeItem); Gtk.MenuItem createNewItem = new Gtk.ImageMenuItem(Gtk.Stock.New, null); createNewItem.Activated += OnCreateNew; popupMenu.Add(createNewItem); Gtk.MenuItem deleteItem = new Gtk.ImageMenuItem(Gtk.Stock.Delete, null); deleteItem.Activated += OnDeleteActivated; popupMenu.Add(deleteItem); Gtk.MenuItem CheckIDsItem = new Gtk.MenuItem("Check all tilemaps for bad tile IDs"); CheckIDsItem.Activated += OnCheckIDs; popupMenu.Append(CheckIDsItem); popupMenu.ShowAll(); popupMenu.Popup(); }
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(); }
protected void OnButtonPrintClicked(object sender, EventArgs e) { Gtk.Menu jBox = new Gtk.Menu(); MenuItem MenuItem1; MenuItem1 = new MenuItem("Заказ наряд"); MenuItem1.Activated += OnPopupPrintOrder; jBox.Add(MenuItem1); MenuItem1 = new MenuItem("Товарный чек"); MenuItem1.Activated += OnPopupPrintReceipt; jBox.Add(MenuItem1); jBox.ShowAll(); jBox.Popup(); }
/// <summary> /// Render a tray menu which is displayed when user click on pidgeon icon in tray only /// </summary> /// <param name="o"></param> /// <param name="args"></param> private void TrayMenu(object o, EventArgs args) { Menu menu = new Menu(); ImageMenuItem menuItemQuit = new ImageMenuItem(messages.Localize("[[common-quit]]")); Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu); CheckMenuItem notifications = new CheckMenuItem(messages.Localize("[[tray-en]]")); menu.Add(notifications); notifications.Active = Configuration.Kernel.Notice; notifications.Activated += new EventHandler(itemNotification); if (!this.Visible) { MenuItem show = new MenuItem("Show"); menu.Add(show); show.Activated += new EventHandler(itemShow); } else { MenuItem hide = new MenuItem("Hide"); hide.Activated += new EventHandler(itemHide); menu.Add(hide); } menu.Add(new Gtk.SeparatorMenuItem()); menuItemQuit.Image = appimg; menu.Add(menuItemQuit); // Quit the application when quit has been clicked. menuItemQuit.Activated += new EventHandler(shutDownToolStripMenuItem_Click); menu.ShowAll(); menu.Popup(); }
public void PopulateFixes (Gtk.Menu menu, ref int items) { int mnemonic = 1; bool gotImportantFix = false, addedSeparator = false; var fixesAdded = new List<string> (); foreach (var fix_ in Fixes.OrderByDescending (i => Tuple.Create (IsAnalysisOrErrorFix(i), (int)i.Severity, GetUsage (i.IdString)))) { // filter out code actions that are already resolutions of a code issue if (fixesAdded.Any (f => fix_.IdString.IndexOf (f, StringComparison.Ordinal) >= 0)) continue; fixesAdded.Add (fix_.IdString); if (IsAnalysisOrErrorFix (fix_)) gotImportantFix = true; if (!addedSeparator && gotImportantFix && !IsAnalysisOrErrorFix(fix_)) { menu.Add (new Gtk.SeparatorMenuItem ()); addedSeparator = true; } var fix = fix_; var escapedLabel = fix.Title.Replace ("_", "__"); var label = (mnemonic <= 10) ? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel : " " + escapedLabel; var thisInstanceMenuItem = new MenuItem (label); thisInstanceMenuItem.Activated += new ContextActionRunner (fix, document, currentSmartTagBegin).Run; thisInstanceMenuItem.Activated += delegate { ConfirmUsage (fix.IdString); menu.Destroy (); }; menu.Add (thisInstanceMenuItem); items++; } bool first = true; var settingsMenuFixes = Fixes .OfType<AnalysisContextActionProvider.AnalysisCodeAction> () .Where (f => f.Result is InspectorResults) .GroupBy (f => ((InspectorResults)f.Result).Inspector); foreach (var analysisFixGroup_ in settingsMenuFixes) { var analysisFixGroup = analysisFixGroup_; var arbitraryFixInGroup = analysisFixGroup.First (); var ir = (InspectorResults)arbitraryFixInGroup.Result; if (first) { menu.Add (new Gtk.SeparatorMenuItem ()); first = false; } var subMenu = new Gtk.Menu (); foreach (var analysisFix_ in analysisFixGroup) { var analysisFix = analysisFix_; if (analysisFix.SupportsBatchRunning) { var batchRunMenuItem = new Gtk.MenuItem (string.Format (GettextCatalog.GetString ("Apply in file: {0}"), analysisFix.Title)); batchRunMenuItem.Activated += delegate { ConfirmUsage (analysisFix.IdString); menu.Destroy (); }; batchRunMenuItem.Activated += new ContextActionRunner (analysisFix, document, this.currentSmartTagBegin).BatchRun; subMenu.Add (batchRunMenuItem); subMenu.Add (new Gtk.SeparatorMenuItem ()); } } var inspector = ir.Inspector; if (inspector.CanSuppressWithAttribute) { var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with attribute")); menuItem.Activated += delegate { inspector.SuppressWithAttribute (document, arbitraryFixInGroup.DocumentRegion); }; subMenu.Add (menuItem); } if (inspector.CanDisableWithPragma) { var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with #pragma")); menuItem.Activated += delegate { inspector.DisableWithPragma (document, arbitraryFixInGroup.DocumentRegion); }; subMenu.Add (menuItem); } if (inspector.CanDisableOnce) { var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Disable Once")); menuItem.Activated += delegate { inspector.DisableOnce (document, arbitraryFixInGroup.DocumentRegion); }; subMenu.Add (menuItem); } if (inspector.CanDisableAndRestore) { var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Disable _and Restore")); menuItem.Activated += delegate { inspector.DisableAndRestore (document, arbitraryFixInGroup.DocumentRegion); }; subMenu.Add (menuItem); } var label = GettextCatalog.GetString ("_Options for \"{0}\"", InspectorResults.GetTitle (ir.Inspector)); var subMenuItem = new Gtk.MenuItem (label); var optionsMenuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Configure Rule")); optionsMenuItem.Activated += arbitraryFixInGroup.ShowOptions; optionsMenuItem.Activated += delegate { menu.Destroy (); }; subMenu.Add (optionsMenuItem); subMenuItem.Submenu = subMenu; menu.Add (subMenuItem); items++; } }
public Widget CreatePathWidget (int index) { if (ownerProjects.Count > 1 && index == 0) { var window = new DropDownBoxListWindow (new DataProvider (this)); window.FixedRowHeight = 22; window.MaxVisibleRows = 14; window.SelectItem (currentPath [index].Tag); return window; } else { if (ownerProjects.Count > 1) index--; var menu = new Menu (); var mi = new MenuItem (GettextCatalog.GetString ("Select")); mi.Activated += delegate { SelectPath (index); }; menu.Add (mi); mi = new MenuItem (GettextCatalog.GetString ("Select contents")); mi.Activated += delegate { SelectPathContents (index); }; menu.Add (mi); menu.ShowAll (); return menu; } }
public void CreateMenu() { this.menu = new Menu (); this.state_item = new MenuItem (Controller.StateText) { Sensitive = false }; this.menu.Add (this.state_item); this.menu.Add (new SeparatorMenuItem ()); ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare"){ Image = new Image (SparkleUIHelpers.GetIcon ("folder-sparkleshare", 16)) }; folder_item.Activated += delegate { Controller.SparkleShareClicked (); }; this.menu.Add (folder_item); if (Program.Controller.Folders.Count > 0) { foreach (string folder_name in Controller.Folders) { Gdk.Pixbuf folder_icon; if (Program.Controller.UnsyncedFolders.Contains (folder_name)) { folder_icon = IconTheme.Default.LoadIcon ("dialog-error", 16, IconLookupFlags.GenericFallback); } else { folder_icon = IconTheme.Default.LoadIcon ("folder", 16, IconLookupFlags.GenericFallback); } ImageMenuItem subfolder_item = new SparkleMenuItem (folder_name) { Image = new Image (folder_icon) }; subfolder_item.Activated += OpenFolderDelegate (folder_name); this.menu.Add (subfolder_item); } Menu submenu = new Menu (); foreach (string folder_name in Controller.OverflowFolders) { Gdk.Pixbuf folder_icon; if (Program.Controller.UnsyncedFolders.Contains (folder_name)) { folder_icon = IconTheme.Default.LoadIcon ("dialog-error", 16, IconLookupFlags.GenericFallback); } else { folder_icon = IconTheme.Default.LoadIcon ("folder", 16, IconLookupFlags.GenericFallback); } ImageMenuItem subfolder_item = new SparkleMenuItem (folder_name) { Image = new Image (folder_icon) }; subfolder_item.Activated += OpenFolderDelegate (folder_name); submenu.Add (subfolder_item); } if (submenu.Children.Length > 0) { SparkleMenuItem more_item = new SparkleMenuItem ("More Projects") { Submenu = submenu }; this.menu.Add (new SeparatorMenuItem ()); this.menu.Add (more_item); } } this.menu.Add (new SeparatorMenuItem ()); MenuItem sync_item = new MenuItem (_("Add Hosted Project…")); sync_item.Activated += delegate { Controller.AddHostedProjectClicked (); }; this.menu.Add (sync_item); this.recent_events_item = new MenuItem (_("Recent Changes…")); this.recent_events_item.Sensitive = Controller.OpenRecentEventsItemEnabled; this.recent_events_item.Activated += delegate { Controller.OpenRecentEventsClicked (); }; this.menu.Add (this.recent_events_item); this.menu.Add (new SeparatorMenuItem ()); MenuItem notify_item; if (Program.Controller.NotificationsEnabled) notify_item = new MenuItem (_("Turn Notifications Off")); else notify_item = new MenuItem (_("Turn Notifications On")); notify_item.Activated += delegate { Application.Invoke (delegate { Program.Controller.ToggleNotifications (); if (Program.Controller.NotificationsEnabled) (notify_item.Child as Label).Text = _("Turn Notifications Off"); else (notify_item.Child as Label).Text = _("Turn Notifications On"); }); }; this.menu.Add (notify_item); this.menu.Add (new SeparatorMenuItem ()); MenuItem about_item = new MenuItem (_("About SparkleShare")); about_item.Activated += delegate { Controller.AboutClicked (); }; this.menu.Add (about_item); this.menu.Add (new SeparatorMenuItem ()); this.quit_item = new MenuItem (_("Quit")) { Sensitive = Controller.QuitItemEnabled }; this.quit_item.Activated += delegate { Controller.QuitClicked (); }; this.menu.Add (this.quit_item); this.menu.ShowAll (); #if HAVE_APP_INDICATOR this.indicator.Menu = this.menu; #endif }
private Gtk.Menu GetNewOrderTypesMenu() { Gtk.Menu jBox2 = new Gtk.Menu(); MenuItemId<int> MenuItem2; foreach(KeyValuePair<int, string> pair in ParentCalendar.OrdersTypes) { MenuItem2 = new MenuItemId<int>(pair.Value); MenuItem2.ID = pair.Key; MenuItem2.ButtonPressEvent += OnButtonPopupAddWithType; jBox2.Add(MenuItem2); } return jBox2; }
protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt) { if(evnt.Button == 3) { Gtk.Menu jBox = new Gtk.Menu(); MenuItem MenuItem1; MenuItemId<int> MenuItem2; if(ParentCalendar.OrdersTypes == null || ParentCalendar.OrdersTypes.Count == 0) { MenuItem1 = new MenuItem("Новый заказ"); MenuItem1.Activated += OnButtonPopupAdd; jBox.Add(MenuItem1); } else if(ParentCalendar.OrdersTypes.Count == 1) { MenuItem2 = new MenuItemId<int>("Новый заказ"); MenuItem2.ID = ParentCalendar.OrdersTypes.GetEnumerator().Current.Key; MenuItem2.ButtonPressEvent += OnButtonPopupAddWithType; jBox.Add(MenuItem2); } else { MenuItem1 = new MenuItem("Новый заказ"); MenuItem1.Submenu = GetNewOrderTypesMenu(); jBox.Add(MenuItem1); } MenuItem1 = new MenuItem("Удалить"); MenuItem1.Sensitive = item != null; MenuItem1.Activated += OnButtonPopupDelete; jBox.Add(MenuItem1); jBox.ShowAll(); jBox.Popup(); } return base.OnButtonReleaseEvent(evnt); }
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); } }
private void item_click(ButtonPressEventArgs args, UserLabel label, RightClickLabelButton b) { if (args.Event.Button == 1) { category.update_restriction_and_update_screen(label.metalabel); b.Active = !b.Active; } else if (args.Event.Button == 3) { Menu popupMenu = new Menu(); MenuItem rename_item = new MenuItem(Mono.Unix.Catalog.GetString("Rename label")); rename_item.Activated += delegate { rename_label(label); }; popupMenu.Add(rename_item); MenuItem delete_item = new MenuItem(Mono.Unix.Catalog.GetString("Delete label")); delete_item.Activated += delegate { remove_label(label.metalabel); }; popupMenu.Add(delete_item); popupMenu.Add(new Gtk.SeparatorMenuItem()); MenuItem create_label = new MenuItem(Mono.Unix.Catalog.GetString("Create a new label")); create_label.Activated += delegate { add_new_label(); }; popupMenu.Add(create_label); popupMenu.ShowAll(); popupMenu.Popup(null, null, null, args.Event.Button, args.Event.Time); } }
public Gtk.Widget CreatePathWidget (int index) { Menu menu = new Menu (); MenuItem mi = new MenuItem (GettextCatalog.GetString ("Select")); mi.Activated += delegate { SelectPath (index); }; menu.Add (mi); mi = new MenuItem (GettextCatalog.GetString ("Select contents")); mi.Activated += delegate { SelectPathContents (index); }; menu.Add (mi); menu.ShowAll (); return menu; }
private void Run() { System.Net.ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => { return true; }; Gtk.Application.Init (); redFilePath = CreateTempFileFromResource ("circlecinotification.resources.red.svg"); greenFilePath = CreateTempFileFromResource ("circlecinotification.resources.green.svg"); indicator = new ApplicationIndicator ("CircleCi Indicator", redFilePath, Category.ApplicationStatus); Preferences prefs = Preferences.load (); menu = new Gtk.Menu (); Gtk.MenuItem loadingProjects = new Gtk.ImageMenuItem ("Loading projects...", null); projectMenuItems.Clear (); projectMenuItems.Add (loadingProjects); Gtk.MenuItem aboutMenuItem = new Gtk.ImageMenuItem (Gtk.Stock.About, null); aboutMenuItem.Activated += HandleAbout; Gtk.MenuItem setTokenMenuItem = new Gtk.ImageMenuItem ("Set CircleCi Token", null); setTokenMenuItem.Activated += HandleResetToken; Gtk.MenuItem exitMenuItem = new Gtk.ImageMenuItem (Gtk.Stock.Quit, null); exitMenuItem.Activated += HandleQuit; menu.Add (loadingProjects); menu.Add (new Gtk.SeparatorMenuItem ()); menu.Add (setTokenMenuItem); menu.Add (aboutMenuItem); menu.Add (new Gtk.SeparatorMenuItem ()); menu.Add (exitMenuItem); menu.ShowAll (); indicator.Menu = menu; indicator.Status = Status.Active; if (prefs.token == null) { ResetToken (); } else { RefreshStatus (); } Gtk.Application.Run (); }
protected void OnTreeviewPlacesPopupMenu(object o, Gtk.PopupMenuArgs args) { bool ItemSelected = treeviewPlaces.Selection.CountSelectedRows() == 1; TreeIter iter; bool setLessee = false; if(ItemSelected) { treeviewPlaces.Selection.GetSelected(out iter); setLessee = Convert.ToInt32(PlaceSort.GetValue(iter, (int)PlaceCol.lessee_id)) > 0; } Gtk.Menu popupBox = new Gtk.Menu(); Gtk.MenuItem MenuItemOpenPlace = new MenuItem("Открыть торговое место"); MenuItemOpenPlace.Activated += new EventHandler(OnPlaceOpenPlace); MenuItemOpenPlace.Sensitive = ItemSelected; popupBox.Add(MenuItemOpenPlace); Gtk.MenuItem MenuItemOpenLessee = new MenuItem("Открыть арендатора"); MenuItemOpenLessee.Activated += new EventHandler(OnPlaceOpenLessee); MenuItemOpenLessee.Sensitive = ItemSelected && setLessee; popupBox.Add(MenuItemOpenLessee); popupBox.ShowAll(); popupBox.Popup(); }
void PopupQuickFixMenu (Gdk.EventButton evt, Action<Gtk.Menu> menuAction) { var menu = new Gtk.Menu (); menu.Events |= Gdk.EventMask.AllEventsMask; Gtk.Menu fixMenu = menu; ResolveResult resolveResult; ICSharpCode.NRefactory.CSharp.AstNode node; int items = 0; if (ResolveCommandHandler.ResolveAt (document, out resolveResult, out node)) { var possibleNamespaces = MonoDevelop.Refactoring.ResolveCommandHandler.GetPossibleNamespaces ( document, node, ref resolveResult ); foreach (var t in possibleNamespaces.Where (tp => tp.OnlyAddReference)) { var menuItem = new Gtk.MenuItem (t.GetImportText ()); menuItem.Activated += delegate { new ResolveCommandHandler.AddImport (document, resolveResult, null, t.Reference, true, node).Run (); menu.Destroy (); }; menu.Add (menuItem); items++; } bool addUsing = !(resolveResult is AmbiguousTypeResolveResult); if (addUsing) { foreach (var t in possibleNamespaces.Where (tp => tp.IsAccessibleWithGlobalUsing)) { string ns = t.Namespace; var reference = t.Reference; var menuItem = new Gtk.MenuItem (t.GetImportText ()); menuItem.Activated += delegate { new ResolveCommandHandler.AddImport (document, resolveResult, ns, reference, true, node).Run (); menu.Destroy (); }; menu.Add (menuItem); items++; } } bool resolveDirect = !(resolveResult is UnknownMemberResolveResult); if (resolveDirect) { foreach (var t in possibleNamespaces) { string ns = t.Namespace; var reference = t.Reference; var menuItem = new Gtk.MenuItem (t.GetInsertNamespaceText (document.Editor.GetTextBetween (node.StartLocation, node.EndLocation))); menuItem.Activated += delegate { new ResolveCommandHandler.AddImport (document, resolveResult, ns, reference, false, node).Run (); menu.Destroy (); }; menu.Add (menuItem); items++; } } if (menu.Children.Any () && Fixes.Any ()) { fixMenu = new Gtk.Menu (); var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Quick Fixes")); menuItem.Submenu = fixMenu; menu.Add (menuItem); items++; } } PopulateFixes (fixMenu, ref items); if (items == 0) { menu.Destroy (); return; } document.Editor.SuppressTooltips = true; document.Editor.Parent.HideTooltip (); if (menuAction != null) menuAction (menu); menu.ShowAll (); menu.SelectFirst (true); menu.Hidden += delegate { document.Editor.SuppressTooltips = false; }; var container = document.Editor.Parent; var p = container.LocationToPoint (currentSmartTagBegin); var rect = new Gdk.Rectangle ( p.X + container.Allocation.X , p.Y + (int)document.Editor.LineHeight + container.Allocation.Y, 0, 0); GtkWorkarounds.ShowContextMenu (menu, document.Editor.Parent, null, rect); }
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; popupMenu.Add (menuItemQuit); // Quit the application when quit has been clicked. menuItemQuit.Activated += delegate { File.Delete(ep+"/Error.txt"); trayIcon.Dispose(); Application.Quit (); }; MenuItem menuItemlog = new ImageMenuItem ("Log"); popupMenu.Add (menuItemlog); // Quit the application when quit has been clicked. if (File.Exists(ep+"/Error.txt")) { menuItemlog.Activated += delegate { System.Diagnostics.Process.Start(ep+"/Error.txt"); }; menuItemlog.Sensitive = true; } else menuItemlog.Sensitive = false; popupMenu.ShowAll (); popupMenu.Popup (); }
// Creates the menu that is popped up when the // user clicks the status icon public void CreateMenu() { Menu = new Menu (); // The menu item showing the status and size of the SparkleShare folder MenuItem status_menu_item = new MenuItem (StateText) { Sensitive = false }; Menu.Add (status_menu_item); Menu.Add (new SeparatorMenuItem ()); ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare"){ Image = new Image (SparkleUIHelpers.GetIcon ("folder-sparkleshare", 16)) }; folder_item.Activated += delegate { SparkleShare.Controller.OpenSparkleShareFolder (); }; Menu.Add (folder_item); if (SparkleShare.Controller.Folders.Count > 0) { // Creates a menu item for each repository with a link to their logs foreach (string folder_name in SparkleShare.Controller.Folders) { Gdk.Pixbuf folder_icon; if (SparkleShare.Controller.UnsyncedFolders.Contains (folder_name)) { folder_icon = IconTheme.Default.LoadIcon ("dialog-error", 16, IconLookupFlags.GenericFallback); } else { folder_icon = IconTheme.Default.LoadIcon ("folder", 16, IconLookupFlags.GenericFallback); } ImageMenuItem subfolder_item = new SparkleMenuItem (folder_name) { Image = new Image (folder_icon) }; subfolder_item.Activated += OpenFolderDelegate (folder_name); Menu.Add (subfolder_item); } } else { MenuItem no_folders_item = new MenuItem (_("No Remote Folders Yet")) { Sensitive = false }; Menu.Add (no_folders_item); } // Opens the wizard to add a new remote folder MenuItem sync_item = new MenuItem (_("Add Remote Folder…")); if (SparkleShare.Controller.FirstRun) sync_item.Sensitive = false; sync_item.Activated += delegate { Application.Invoke (delegate { if (SparkleUI.Intro == null) { SparkleUI.Intro = new SparkleIntro (); SparkleUI.Intro.ShowServerForm (true); } if (!SparkleUI.Intro.Visible) SparkleUI.Intro.ShowServerForm (true); SparkleUI.Intro.ShowAll (); SparkleUI.Intro.Present (); }); }; Menu.Add (sync_item); Menu.Add (new SeparatorMenuItem ()); MenuItem recent_events_item = new MenuItem (_("Show Recent Events")); if (SparkleShare.Controller.Folders.Count < 1) recent_events_item.Sensitive = false; recent_events_item.Activated += delegate { Application.Invoke (delegate { if (SparkleUI.EventLog == null) SparkleUI.EventLog = new SparkleEventLog (); SparkleUI.EventLog.ShowAll (); SparkleUI.EventLog.Present (); }); }; Menu.Add (recent_events_item); MenuItem notify_item; if (SparkleShare.Controller.NotificationsEnabled) notify_item = new MenuItem (_("Turn Notifications Off")); else notify_item = new MenuItem (_("Turn Notifications On")); notify_item.Activated += delegate { SparkleShare.Controller.ToggleNotifications (); CreateMenu (); }; Menu.Add (notify_item); Menu.Add (new SeparatorMenuItem ()); // A menu item that takes the user to http://www.sparkleshare.org/ MenuItem about_item = new MenuItem (_("About SparkleShare")); about_item.Activated += delegate { SparkleAbout about = new SparkleAbout (); about.ShowAll (); }; Menu.Add (about_item); Menu.Add (new SeparatorMenuItem ()); // A menu item that quits the application MenuItem quit_item = new MenuItem (_("Quit")); quit_item.Activated += delegate { SparkleShare.Controller.Quit (); }; Menu.Add (quit_item); Menu.ShowAll (); }
private void popupMenuHandler(object o, Gtk.PopupMenuArgs args) { Menu popupMenu = new Menu(); // add show ImageMenuItem menuPopup1; if (hidden) menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Show window")); else menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Hide window")); menuPopup1.Image = new Image(Stock.Refresh, IconSize.Menu); popupMenu.Add(menuPopup1); menuPopup1.Activated += delegate { if (hidden) { main_window.ShowAll(); restore_position(); hidden = false; main_window.Unref(); // restore correct reference count } else { hide_window(); } }; ImageMenuItem menuPopup0 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Indexing status")); popupMenu.Add(menuPopup0); menuPopup0.Activated += delegate { Singleton<Indexing>.Instance.Show(); }; ImageMenuItem menuPopup2 = new ImageMenuItem(Mono.Unix.Catalog.GetString("About")); menuPopup2.Image = new Image(Stock.About, IconSize.Menu); popupMenu.Add(menuPopup2); menuPopup2.Activated += delegate { Gtk.AboutDialog about = new AboutDialog(); about.Name = "Nemo"; about.Authors = new string[] { "Anders Rune Jensen", "Lau Bech Lauritzen", "Ole Laursen" }; about.Artists = new string[] { "Linda Nhu", "Sune Theodorsen" }; about.Comments = Mono.Unix.Catalog.GetString("Nemo is a file manager for those who would rather have their files manage themselves."); about.Logo = new Gdk.Pixbuf(null, "blue_guy_med.png"); about.Response += delegate { about.Destroy(); }; about.Show(); }; // add quit ImageMenuItem menuPopup3 = new ImageMenuItem (Mono.Unix.Catalog.GetString("Quit")); menuPopup3.Image = new Image(Stock.Quit, IconSize.Menu); popupMenu.Add(menuPopup3); menuPopup3.Activated += new EventHandler(this.OnPopupClick); popupMenu.ShowAll(); popupMenu.Popup(null, null, null, (uint)args.Args[0], (uint)args.Args[1]); }