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 (); }
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 (); }
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); }
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; } } }
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); } }
public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled) { Gtk.MenuItem i; Gtk.StockItem item = Gtk.StockItem.Zero; if (Gtk.StockManager.Lookup(l, ref item)) { i = new Gtk.ImageMenuItem(l, new Gtk.AccelGroup()); } else { i = new Gtk.MenuItem(l); } if (e != null) { i.Activated += e; } i.Sensitive = enabled; menu.Append(i); i.Show(); return(i); }
/// <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); }
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 (); }
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(); }
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)); }
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; }
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(); } }
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); }
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; }
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(); }
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 (); }
/// <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); }
// 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; }
/// <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); }
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; }
public PlayerMenu() { playerMenu = new Menu (); addToPlaylistMenu = new MenuItem (""); playerMenu.Add (addToPlaylistMenu); exportToVideoFile = new MenuItem (""); exportToVideoFile.Add (exportToVideoFile); }
public RepositoryMenuItem(Repository repo, StatusIconController controller) : base(repo.Name) { this.SetProperty("always-show-image", new GLib.Value(true)); this.repository = repo; this.controller = controller; this.Image = new Image(UIHelpers.GetIcon("dataspacesync-folder", 16)); this.repository.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => { if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.Status)) { this.Status = this.repository.Status; } if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.LastFinishedSync)) { this.changesFoundAt = this.repository.LastFinishedSync; this.UpdateStatusText(); } if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.NumberOfChanges)) { this.changesFound = this.repository.NumberOfChanges; this.UpdateStatusText(); } }; this.openLocalFolderItem = new CmisSyncMenuItem( CmisSync.Properties_Resources.OpenLocalFolder) { Image = new Image(UIHelpers.GetIcon("dataspacesync-folder", 16)) }; this.openLocalFolderItem.Activated += this.OpenFolderDelegate(); this.editItem = new CmisSyncMenuItem(CmisSync.Properties_Resources.Settings); this.editItem.Activated += this.EditFolderDelegate(); this.suspendItem = new CmisSyncMenuItem(Properties_Resources.PauseSync); this.Status = this.repository.Status; this.suspendItem.Activated += this.SuspendSyncFolderDelegate(); this.statusItem = new MenuItem(Properties_Resources.StatusSearchingForChanges) { Sensitive = false }; this.removeFolderFromSyncItem = new CmisSyncMenuItem( CmisSync.Properties_Resources.RemoveFolderFromSync) { Image = new Image(UIHelpers.GetIcon("dataspacesync-deleted", 12)) }; this.removeFolderFromSyncItem.Activated += this.RemoveFolderFromSyncDelegate(); this.separator1 = new SeparatorMenuItem(); this.separator2 = new SeparatorMenuItem(); var subMenu = new Menu(); subMenu.Add(this.statusItem); subMenu.Add(this.separator1); subMenu.Add(this.openLocalFolderItem); subMenu.Add(this.suspendItem); subMenu.Add(this.editItem); subMenu.Add(this.separator2); subMenu.Add(this.removeFolderFromSyncItem); this.Submenu = subMenu; }
public MainWindow() : base("Katahdin Debugger") { SetDefaultSize(500, 400); try { PathResolver pathResolver = new PathResolver(); SetIconFromFile(pathResolver.Resolve("katahdin.svg")); } catch { } Destroyed += delegate { if (runtimeThread != null) runtimeThread.Shutdown(); }; VBox vertical = new VBox(); Add(vertical); MenuBuilder menuBuilder = new MenuBuilder(); MenuBar menuBar = menuBuilder.StartMenuBar(); vertical.PackStart(menuBar, false, false, 0); menuBuilder.StartMenu("Debug"); debugRun = menuBuilder.Add("Run", OnDebugRun); menuBuilder.End(); menuBuilder.StartMenu("View"); viewGrammar = menuBuilder.AddCheck("Grammar", OnViewGrammarToggled); viewParseTrace = menuBuilder.AddCheck("Parse Trace", OnViewParseTraceToggled); viewParseTree = menuBuilder.AddCheck("Parse Tree", OnViewParseTreeToggled); menuBuilder.Separate(); menuBuilder.Add("View runtime object", OnViewRuntimeModule); menuBuilder.End(); menuBuilder.End(); console = new ConsoleWidget(); vertical.PackStart(console, true, true, 0); vertical.PackStart(new HSeparator(), false, false, 0); HBox statusBar = new HBox(); vertical.PackStart(statusBar, false, false, 1); progress = new ProgressBar(); statusBar.PackStart(progress, false, false, 1); statusLabel = new Label(); statusLabel.SetAlignment(0, (float) 0.5); statusLabel.LineWrap = true; statusBar.PackStart(statusLabel, true, true, 0); }
public static void MakeMenuItem (Gtk.Menu menu, string l, EventHandler e, bool enabled) { Gtk.MenuItem i = new Gtk.MenuItem (l); i.Activated += e; i.Sensitive = enabled; menu.Append (i); i.Show (); }
public static void Main(string[] args) { Application.Init (); //MainWindow win = new MainWindow (); //win.Show (); MoonlightRuntime.Init (); Window w = new Window ("mldsp"); w.DefaultHeight = 520; w.DefaultWidth = 760; w.DeleteEvent += delegate { Application.Quit (); }; var moon = new MoonlightHost (); var xappath = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (new Uri (typeof (MainClass).Assembly.CodeBase).LocalPath), "mldsp.clr.xap"); moon.LoadXap (xappath); if (args.Length > 0) { int device; if (int.TryParse (args [0], out device)) ((mldsp.App) moon.Application).OutputDeviceID = device; else { Console.WriteLine ("WARNING: wrong device ID speficication. Specify an index."); foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices) if (dev.IsOutput) Console.WriteLine ("{0} {1}", dev.ID, dev.Name); } } var vbox = new VBox (false, 0); w.Add (vbox); var mainmenu = new MenuBar (); vbox.PackStart (mainmenu, false, true, 0); var optmi = new MenuItem ("_Options"); mainmenu.Add (optmi); var devmi = new MenuItem ("Select Device"); var optmenu = new Menu (); optmi.Submenu = optmenu; optmenu.Append (devmi); var devlist = new SList (IntPtr.Zero); var devmenu = new Menu (); devmi.Submenu = devmenu; foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices) { if (dev.IsOutput) { var mi = new RadioMenuItem (devlist, dev.Name); mi.Data ["Device"] = dev.ID; devlist = mi.Group; int id = dev.ID; mi.Activated += delegate { ((mldsp.App) moon.Application).ResetDevice ((int) mi.Data ["Device"]); }; devmenu.Append (mi); } } vbox.PackEnd (moon); w.ShowAll (); Application.Run (); }
public DirectoryMenu(ExploreView exploreView) { this.exploreView = exploreView; getLatestItem = AddImageMenuItem("Get Latest", Images.Update); getLatestItem.Activated += GetLatestHandler; ShowAll(); }
public static void MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled) { Gtk.MenuItem i = new Gtk.MenuItem(l); i.Activated += e; i.Sensitive = enabled; menu.Append(i); i.Show(); }
public LiteralMenu (MenuItem item, Literal literal) { popup = new LiteralPopup (); this.literal = literal; item.Submenu = this; item.Activated += HandlePopulate; }
GLib.SList rbGroup; //= new GLib.SList(typeof(RadioMenuItem)); #endregion Fields #region Constructors public EntryMenu(List<string> menu1,string labelMenu1, List<string> menu2,string labelMenu2, string defValue) : base(false, 6) { if (!String.IsNullOrEmpty(defValue)){ LabelText = defValue; entryTxt.Text = defValue; } this.PackStart(entryTxt,true,true,0); Gdk.Pixbuf default_pixbuf = null; string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png"); if (System.IO.File.Exists(file)) { default_pixbuf = new Gdk.Pixbuf(file); Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf)); btnClose.TooltipText = MainClass.Languages.Translate("insert_condition_name"); btnClose.Relief = Gtk.ReliefStyle.None; btnClose.CanFocus = false; btnClose.WidthRequest = btnClose.HeightRequest = 22; popupCondition.AttachToWidget(btnClose,new Gtk.MenuDetachFunc(DetachWidget)); btnClose.Clicked += delegate { popupCondition.Popup(); //popupCondition.Popup(btnClose,null,new Gtk.MenuPositionFunc (GetPosition),3,Gtk.Global.CurrentEventTime); }; this.PackEnd(btnClose,false,false,0); } rbGroup = new GLib.SList (typeof(RadioMenuItem)); Gtk.MenuItem mi = new Gtk.MenuItem(labelMenu1); mi.Name = labelMenu1; mi.Sensitive = false; popupCondition.Add(mi); foreach(string m in menu1){ AddMenuItem(popupCondition,m); } Gtk.MenuItem mi2 = new Gtk.MenuItem(labelMenu2); mi2.Name = labelMenu2; mi2.Sensitive = false; popupCondition.Add(mi2); //Gtk.Menu subPopup2 = new Gtk.Menu(); foreach(string m in menu2){ AddMenuItem(popupCondition,m); } //popupCondition.State = StateType.Insensitive; //popupCondition. popupCondition.ShowAll(); this.ShowAll(); }
public void AppendToMenu (Gtk.Menu menu) { if (list == null || list.Count == 0) return; Gtk.MenuItem open_with = new Gtk.MenuItem (Mono.Unix.Catalog.GetString ("Open With")); open_with.Submenu = this; open_with.ShowAll (); menu.Append (open_with); }
public void Initialize () { MenuItem deleteItem = new MenuItem ("Remove"); deleteItem.Activated += new EventHandler (deleteItem_OnActivated); deleteItem.Show (); contextMenu.Add (deleteItem); MenuItem propertiesItem = new MenuItem ("Properties"); propertiesItem.Activated += new EventHandler (propertiesItem_OnActivated); propertiesItem.Show (); contextMenu.Add (propertiesItem); }
private void OnSectorItemActivated(object o, EventArgs args) { Gtk.MenuItem item = (Gtk.MenuItem)o; foreach (Sector sector in level.Sectors) { if (sector.Name == item.Name) { CurrentPage = (PageNum(widgets[sector])); //switch to selected page application.CurrentSector = sector; return; } } LogManager.Log(LogLevel.Error, "Sector '" + item.Name + "' not found?!?"); }
public void Build() { // file menu file = new MenuItem("File"); fileMenu = new Menu(); file.Submenu = fileMenu; openMenuItem = new MenuItem("Open Sqlite database"); openMenuItem.Activated += OnNewSqliteDbActivated; fileMenu.Append(openMenuItem); newSqlEditorMenuItem = new MenuItem("New Sql Editor Tab"); newSqlEditorMenuItem.Sensitive = false; newSqlEditorMenuItem.Activated += OnNewSqlEditorWindowActivated; fileMenu.Append(newSqlEditorMenuItem); exitMenuItem = new MenuItem("Exit"); exitMenuItem.Activated += OnExitActivated; fileMenu.Append(exitMenuItem); this.Append(file); // setup edit menu edit = new MenuItem("Edit"); editMenu = new Menu(); edit.Submenu = editMenu; this.Append(edit); // setup database menu database = new MenuItem("Database"); databaseMenu = new Menu(); database.Submenu = databaseMenu; newSqliteDbMenuItem = new MenuItem("New Sqlite DB"); newSqliteDbMenuItem.Activated += OnNewSqliteDbActivated; databaseMenu.Append(newSqliteDbMenuItem); openSqliteDbMenuItem = new MenuItem("Open Sqlite DB"); openSqliteDbMenuItem.Activated += OnOpenSqliteDbActivated; databaseMenu.Append(openSqliteDbMenuItem); this.Append(database); // initialize event handlers ApplicationState.Instance.CurrentConnectionChanged += (sender, e) => newSqlEditorMenuItem.Sensitive = e.DbServerConnection != null; }
public static void Create(Tag [] tags, Gtk.Menu menu) { Gtk.MenuItem item = new Gtk.MenuItem(String.Format(Catalog.GetPluralString("Find _With", "Find _With", tags.Length), tags.Length)); Gtk.Menu submenu = GetSubmenu(tags); if (submenu == null) { item.Sensitive = false; } else { item.Submenu = submenu; } menu.Append(item); item.Show(); }
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); }
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); }
protected void OnMainWindowButtonPressed(object o, ButtonPressEventArgs args) { if (args.Event.Button == 3) { _mouseRightClickPoint = GetCanvasMousePos(); Gtk.Menu rightButtonMenu = new Gtk.Menu(); Gtk.MenuItem menuItem = null; if (_uiSections.Count == 0) { menuItem = new Gtk.MenuItem("Add new section"); menuItem.ButtonReleaseEvent += OnMainWindowAddNewSectionPressed; rightButtonMenu.Append(menuItem); } else if (_uiSections.Count > 0) { menuItem = new Gtk.MenuItem("Add command"); menuItem.ButtonReleaseEvent += OnMainWindowAddCommandPressed; rightButtonMenu.Append(menuItem); menuItem = new Gtk.MenuItem("Add command sequence"); menuItem.ButtonReleaseEvent += OnMainWindowAddCommandSequencePressed; rightButtonMenu.Append(menuItem); menuItem = new Gtk.MenuItem("Add command exposed argument"); menuItem.ButtonReleaseEvent += OnMainWindowAddCommandExposedArgPressed; rightButtonMenu.Append(menuItem); menuItem = new Gtk.MenuItem("Add new section"); menuItem.ButtonReleaseEvent += OnMainWindowAddNewSectionPressed; rightButtonMenu.Append(menuItem); menuItem = new Gtk.MenuItem("Remove section"); menuItem.ButtonReleaseEvent += OnMainWindowRemoveSectionPressed; rightButtonMenu.Append(menuItem); } rightButtonMenu.ShowAll(); rightButtonMenu.Popup(); } }
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(); }
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(); }
protected override void ShowPopupMenu(Gdk.Event ev) { Gtk.Menu menu = new Gtk.Menu(); { Gtk.MenuItem item = new Gtk.MenuItem("Add standard warp"); menu.Append(item); item.Activated += (sender, args) => { SelectedIndex = WarpGroup.AddWarp(WarpSourceType.Standard); }; } { Gtk.MenuItem item = new Gtk.MenuItem("Add specific-position warp"); menu.Append(item); item.Activated += (sender, args) => { SelectedIndex = WarpGroup.AddWarp(WarpSourceType.Pointed); }; } if (HoveringIndex != -1) { menu.Append(new Gtk.SeparatorMenuItem()); Gtk.MenuItem deleteItem = new Gtk.MenuItem("Delete"); deleteItem.Activated += (sender, args) => { if (SelectedIndex != -1) { WarpGroup.RemoveWarp(SelectedIndex); } }; menu.Append(deleteItem); } menu.AttachToWidget(this, null); menu.ShowAll(); menu.PopupAtPointer(ev); }
public override void Initialize() { separator = new Gtk.SeparatorToolItem(); separator.Show(); record_button = new Gtk.ToolButton(Gtk.Stock.MediaRecord); record_button.Clicked += OnRecordButtonClicked; record_button.Show(); play_button = new Gtk.ToolButton(Gtk.Stock.MediaPlay); play_button.Clicked += OnPlayButtonClicked; play_button.Show(); stop_button = new Gtk.ToolButton(Gtk.Stock.MediaStop); stop_button.Clicked += OnStopButtonClicked; stop_button.Show(); delete_item = new Gtk.MenuItem("Delete Voice Note"); delete_item.Activated += OnDeleteItemActivated; delete_item.Show(); initialize(); }
public override IList <Gtk.MenuItem> GetRightClickMenuItems() { var list = new List <Gtk.MenuItem>(); { Gtk.MenuItem followButton = new Gtk.MenuItem("Follow"); followButton.Activated += (sender, args) => { parent.SetRoom(warp.DestRoom, parent.season, true); }; list.Add(followButton); } { Gtk.MenuItem setDestButton = new Gtk.MenuItem("Edit Destination"); setDestButton.Activated += (sender, args) => { parent.EditingWarpDestination = warp; parent.SetRoom(warp.DestRoom, parent.season, true); parent.WarpEditor.SetSelectedWarp(warp); }; list.Add(setDestButton); } return(list); }
void IPlugin.Init(object context) { morphose = context as IDataMorphose; Gtk.MenuBar mainMenuBar = morphose.GetMainMenu(); Gtk.MenuItem fileMenu = null; // Find the File menu if present foreach (Gtk.Widget w in mainMenuBar.Children) { if (w.Name == "FileAction") { fileMenu = w as Gtk.MenuItem; break; } } // If not present - create it if (fileMenu == null) { Gtk.Menu menu = new Gtk.Menu(); fileMenu = new Gtk.MenuItem("File"); fileMenu.Submenu = menu; mainMenuBar.Append(fileMenu); } // Setting up the Import and Export menu item in File menu Gtk.MenuItem import = new Gtk.MenuItem("Import"); import.Activated += OnImportActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(import); Gtk.MenuItem export = new Gtk.MenuItem("Export"); export.Activated += OnExportActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(export); }
//FIXME: this should be private and done on Draw() public void Populate(object sender, EventArgs args) { Widget [] dead_pool = Children; for (int i = 0; i < dead_pool.Length; i++) { dead_pool [i].Destroy(); } foreach (AppInfo app in ApplicationsFor(type_fetcher())) { AppMenuItem i = new AppMenuItem(app, show_icons); i.Activated += HandleItemActivated; Append(i); } if (Children.Length == 0) { MenuItem none = new Gtk.MenuItem(Catalog.GetString("No applications available")); none.Sensitive = false; Append(none); } ShowAll(); }
public static OpenWithMenu AppendMenuTo(Gtk.Menu menu, MimeFetcher mime_fetcher, bool with_icon) { Gtk.MenuItem open_with; if (with_icon) { Gtk.ImageMenuItem img_item = new Gtk.ImageMenuItem(menu_text); img_item.Image = new Gtk.Image("gtk-open", Gtk.IconSize.Menu); open_with = img_item; } else { open_with = new Gtk.MenuItem(menu_text); } OpenWithMenu app_menu = new OpenWithMenu(mime_fetcher); open_with.Submenu = app_menu; open_with.ShowAll(); open_with.Activated += app_menu.Populate; menu.Append(open_with); return(app_menu); }
private void PopulateSmugMugOptionMenu(SmugMugAccountManager manager, SmugMugAccount changed_account) { Gtk.Menu menu = new Gtk.Menu(); this.account = changed_account; int pos = -1; accounts = manager.GetAccounts(); if (accounts == null || accounts.Count == 0) { Gtk.MenuItem item = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("(No Gallery)")); menu.Append(item); gallery_optionmenu.Sensitive = false; edit_button.Sensitive = false; } else { int i = 0; foreach (SmugMugAccount account in accounts) { if (account == changed_account) { pos = i; } Gtk.MenuItem item = new Gtk.MenuItem(account.Username); menu.Append(item); i++; } gallery_optionmenu.Sensitive = true; edit_button.Sensitive = true; } menu.ShowAll(); gallery_optionmenu.Menu = menu; gallery_optionmenu.SetHistory((uint)pos); }
Gtk.Menu BuildTemplateItems(ExtensionNodeList nodes) { Gtk.Menu menu = new Gtk.Menu(); foreach (ExtensionNode tn in nodes) { Gtk.MenuItem item; if (tn is TemplateCategoryNode) { TemplateCategoryNode cat = (TemplateCategoryNode)tn; item = new Gtk.MenuItem(cat.Name); item.Submenu = BuildTemplateItems(cat.ChildNodes); } else { FileTemplateNode t = (FileTemplateNode)tn; item = new Gtk.MenuItem(t.Name); item.Activated += delegate { TextEditor.TextEditorApp.NewFile(t.GetContent()); }; } menu.Insert(item, -1); } return(menu); }
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); }
protected void OnTabButtonPressed(object o, ButtonPressEventArgs args) { if (args.Event.Button == 1) { DraggingController.GetInstance().ClearEvents(); DraggingController.GetInstance().OnDropEvent += OnDropUIElement; OnTabSelectedEvent?.Invoke(this); } else if (args.Event.Button == 3) { _mouseRightClickPoint = GetCanvasMousePos(); Gtk.Menu rightButtonMenu = new Gtk.Menu(); Gtk.MenuItem menuItem = null; menuItem = new Gtk.MenuItem("Delete tab page"); menuItem.ButtonReleaseEvent += OnDeleteTabPagePressed; rightButtonMenu.Append(menuItem); rightButtonMenu.ShowAll(); rightButtonMenu.Popup(); } }
void MiniScreenSettings() { Console.WriteLine("Right Click"); Gtk.Menu menu_settings = new Gtk.Menu(); Gtk.MenuItem menuitem1 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("MiniScreen Resolution")); menu_settings.Append(menuitem1); // Submenu 1 Gtk.Menu menu_dim = new Gtk.Menu(); Gtk.MenuItem menuitem1_0 = new Gtk.MenuItem("300 x 240 (5:4)"); menu_dim.Append(menuitem1_0); menuitem1_0.Show(); menuitem1.Submenu = menu_dim; Gtk.MenuItem menuitem1_1 = new Gtk.MenuItem("400 x 320 (5:4)"); menu_dim.Append(menuitem1_1); menuitem1_1.Show(); Gtk.MenuItem menuitem1_6 = new Gtk.MenuItem("400 x 235 (16:9)"); menu_dim.Append(menuitem1_6); menuitem1_6.Show(); Gtk.MenuItem menuitem1_7 = new Gtk.MenuItem("300 x 176 (16:9)"); menu_dim.Append(menuitem1_7); menuitem1_7.Show(); Gtk.MenuItem menuitem1_2 = new Gtk.MenuItem("300 x 225 (4:3)"); menu_dim.Append(menuitem1_2); menuitem1_2.Show(); Gtk.MenuItem menuitem1_3 = new Gtk.MenuItem("200 x 150 (4:3)"); menu_dim.Append(menuitem1_3); menuitem1_3.Show(); Gtk.MenuItem menuitem1_4 = new Gtk.MenuItem("300 x 166 (9:5)"); menu_dim.Append(menuitem1_4); menuitem1_4.Show(); Gtk.MenuItem menuitem1_5 = new Gtk.MenuItem("200 x 111 (9:5)"); menu_dim.Append(menuitem1_5); menuitem1_5.Show(); // Opcio refreshRate Gtk.MenuItem menuitemRefreshRate = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Set Refresh Rate")); menu_settings.Append(menuitemRefreshRate); Gtk.Menu menu_ref_rate = new Gtk.Menu(); Gtk.MenuItem menuitem_ref_500 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("500 ms (high refresh rate)")); menu_ref_rate.Append(menuitem_ref_500); menuitem_ref_500.Show(); menuitemRefreshRate.Submenu = menu_ref_rate; Gtk.MenuItem menuitem_ref_750 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("750 ms")); menu_ref_rate.Append(menuitem_ref_750); menuitem_ref_750.Show(); Gtk.MenuItem menuitem_ref_1000 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("1000 ms")); menu_ref_rate.Append(menuitem_ref_1000); menuitem_ref_1000.Show(); Gtk.MenuItem menuitem_ref_1500 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("1500 ms")); menu_ref_rate.Append(menuitem_ref_1500); menuitem_ref_1500.Show(); Gtk.MenuItem menuitem_ref_2000 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("2000 ms (low refresh rate)")); menu_ref_rate.Append(menuitem_ref_2000); menuitem_ref_2000.Show(); // Opció 2 Gtk.MenuItem menuitem2 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Set path color")); menu_settings.Append(menuitem2); // Opció 3 - Submenú posició Gtk.Menu menu_position = new Gtk.Menu(); Gtk.MenuItem menuitem3 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Window position")); menu_settings.Append(menuitem3); // Submenu 3 Gtk.MenuItem menuitem3_0 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Left")); menu_position.Append(menuitem3_0); menuitem3_0.Show(); menuitem3.Submenu = menu_position; Gtk.MenuItem menuitem3_1 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Right")); menu_position.Append(menuitem3_1); menuitem3_1.Show(); // Opció 4 - Eixir Gtk.ImageMenuItem menuitem4 = new Gtk.ImageMenuItem(Stock.Quit, grup); menuitem4.RenderIcon(Stock.Quit, IconSize.Menu, Mono.Unix.Catalog.GetString("Exit from MiniScreen")); menu_settings.Append(menuitem4); // Opció 5 - About //Gtk.MenuItem menuitem5=new Gtk.MenuItem(Mono.Unix.Catalog.GetString("About")); //Gtk.ImageMenuItem menuitem5=new Gtk.MenuItem((Mono.Unix.Catalog.GetString("About")); Gtk.ImageMenuItem menuitem5 = new Gtk.ImageMenuItem(Stock.About, grup); menuitem5.RenderIcon(Stock.About, IconSize.Menu, Mono.Unix.Catalog.GetString("About LliureX MiniScreen")); menu_settings.Append(menuitem5); menuitem1.Show(); menuitemRefreshRate.Show(); menuitem2.Show(); menuitem3.Show(); menuitem4.Show(); menuitem5.ShowAll(); menuitem5.Show(); menu_settings.Popup(); menuitem1_0.ButtonPressEvent += HandleMenuitem1ButtonPressEvent; menuitem1_1.ButtonPressEvent += HandleMenuitem1ButtonPressEvent; menuitem1_2.ButtonPressEvent += HandleMenuitem1ButtonPressEvent; menuitem1_3.ButtonPressEvent += HandleMenuitem1ButtonPressEvent; menuitem1_4.ButtonPressEvent += HandleMenuitem1ButtonPressEvent; menuitem1_5.ButtonPressEvent += HandleMenuitem1ButtonPressEvent; menuitem1_6.ButtonPressEvent += HandleMenuitem1ButtonPressEvent; menuitem1_7.ButtonPressEvent += HandleMenuitem1ButtonPressEvent; menuitem_ref_500.ButtonPressEvent += HandleMenuitem_ref_500ButtonPressEvent; menuitem_ref_750.ButtonPressEvent += HandleMenuitem_ref_750ButtonPressEvent; menuitem_ref_1000.ButtonPressEvent += HandleMenuitem_ref_1000ButtonPressEvent; menuitem_ref_1500.ButtonPressEvent += HandleMenuitem_ref_1500ButtonPressEvent; menuitem_ref_2000.ButtonPressEvent += HandleMenuitem_ref_2000ButtonPressEvent; menuitem2.ButtonPressEvent += HandleMenuitem2ButtonPressEvent; menuitem3_0.ButtonPressEvent += HandleMenuitem3_0ButtonPressEvent; menuitem3_1.ButtonPressEvent += HandleMenuitem3_1ButtonPressEvent; menuitem4.ButtonPressEvent += HandleMenuitem4ButtonPressEvent; menuitem5.ButtonPressEvent += HandleMenuitem5ButtonPressEvent; }
void OnClicked(int posX, int posY, Gdk.Event triggerEvent, uint button) { Cairo.Point p = GetGridPosition(posX, posY, scale: false, offset: false); if (EnableTileEditing && hoveringComponent == null) { if (!IsInBounds(posX, posY, scale: false, offset: false)) { return; } if (button == 1) // Left-click { RoomLayout.SetTile(p.X, p.Y, TilesetViewer.SelectedIndex); draggingTile = true; } else if (button == 3) // Right-click { TilesetViewer.SelectedIndex = RoomLayout.GetTile(p.X, p.Y); } } if (DrawRoomComponents) { if (hoveringComponent != null) { selectedComponent = hoveringComponent; hoveringComponent.Select(); if (button == 1) // Left click { draggingObject = true; } else if (button == 3) // Right click { Gtk.Menu menu = new Gtk.Menu(); foreach (Gtk.MenuItem item in selectedComponent.GetRightClickMenuItems()) { menu.Add(item); } RoomComponent comp = selectedComponent; if (comp.Deletable) { if (menu.Children.Length != 0) { menu.Add(new Gtk.SeparatorMenuItem()); } var deleteButton = new Gtk.MenuItem("Delete"); deleteButton.Activated += (sender, args) => { comp.Delete(); }; menu.Add(deleteButton); } menu.AttachToWidget(this, null); menu.ShowAll(); menu.PopupAtPointer(triggerEvent); } } } QueueDraw(); }
void ShowPopup(Gdk.EventButton evnt) { Gtk.TreeIter iter; bool hasSelection = Selection.GetSelected(out iter); PObject obj = null; if (hasSelection) { obj = (PObject)widget.treeStore.GetValue(iter, 1); } else { return; } var menu = new Gtk.Menu(); var newKey = new Gtk.MenuItem(GettextCatalog.GetString("New key")); menu.Append(newKey); newKey.Activated += delegate(object sender, EventArgs e) { var newObj = new PString(""); PObject parent; if (obj != null) { parent = obj.Parent; } else { Gtk.TreeIter parentIter; if (widget.treeStore.IterParent(out parentIter, iter)) { parent = (PObject)widget.treeStore.GetValue(parentIter, 1); } else { parent = widget.nsDictionary; } } if (parent is PArray) { var arr = (PArray)parent; arr.Add(newObj); return; } var dict = parent as PDictionary; if (dict == null) { return; } string name = "newNode"; while (dict.ContainsKey(name)) { name += "_"; } dict[name] = newObj; }; if (hasSelection && obj != null) { var removeKey = new Gtk.MenuItem(GettextCatalog.GetString("Remove key")); menu.Append(removeKey); removeKey.Activated += delegate(object sender, EventArgs e) { //the change event handler removes it from the store obj.Remove(); }; } if (widget.scheme != null) { menu.Append(new Gtk.SeparatorMenuItem()); var showDescItem = new Gtk.CheckMenuItem(GettextCatalog.GetString("Show descriptions")); showDescItem.Active = widget.ShowDescriptions; showDescItem.Activated += delegate { widget.ShowDescriptions = !widget.ShowDescriptions; }; menu.Append(showDescItem); } menu.ShowAll(); IdeApp.CommandService.ShowContextMenu(this, evnt, menu, this); }
/// <summary>Constructor</summary> public MenuItemView(Gtk.MenuItem item) { menuItem = item; menuItem.Activated += OnMenuClicked; }
protected virtual void OnExporerTreeviewButtonPressEvent(object o, Gtk.ButtonPressEventArgs args) { TreePath path; exporerTreeview.GetPathAtPos((int)args.Event.X, (int)args.Event.Y, out path); if (path != null) { if (args.Event.Button == 3) { Gtk.MenuItem addNewMenuItem = null; if (path.Depth > 1) { int index = path.Indices [1]; if ((index == 2 || index == 1) && path.Depth == 2) { /*TODO 3tk - at the moment user added datafields are disabled * Gtk.Menu jBox = new Gtk.Menu (); * if (index == 1) { * addNewMenuItem = new MenuItem ("add field"); * * } else { * addNewMenuItem = new MenuItem ("add parameter"); * } * jBox.Add (addNewMenuItem); * * addNewMenuItem.Activated += delegate(object sender, EventArgs e) { * PropertyFieldEditor pfe = new PropertyFieldEditor (); * pfe.Response += delegate(object oo, ResponseArgs argss) { * if (argss.ResponseId == ResponseType.Ok) { * if (index == 1){ * //DesignService.Report.Fields.Add (new PropertyDataField (){ Name = pfe.PropertyName}); * updateTreeNode(dataFieldsNode,designService.Report.DataFields); * * }else { * //DesignService.Report.Parameters.Add (new PropertyDataField< (){ Name = pfe.PropertyName, DefaultValue = pfe.DefaultValue }); * updateTreeNode(parametersNode,designService.Report.Parameters); * } * * pfe.Destroy (); * * }else { * pfe.Destroy (); * } * }; * pfe.Show (); * }; * * jBox.ShowAll (); * jBox.Popup (); */ } else if (index == 4 && path.Depth == 2) { Gtk.Menu jBox = new Gtk.Menu(); addNewMenuItem = new MenuItem("add image"); jBox.Add(addNewMenuItem); addNewMenuItem.Activated += delegate(object sender, EventArgs e) { Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the Monoreports file to open", null, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); var fileFilter = new FileFilter { Name = "Images" }; fileFilter.AddPattern("*.jpg"); fileFilter.AddPattern("*.png"); fileFilter.AddPattern("*.gif"); fileFilter.AddPattern("*.JPG"); fileFilter.AddPattern("*.PNG"); fileFilter.AddPattern("*.GIF"); fc.AddFilter(fileFilter); if (fc.Run() == (int)ResponseType.Accept) { System.IO.FileStream file = System.IO.File.OpenRead(fc.Filename); byte[] bytes = new byte[file.Length]; file.Read(bytes, 0, (int)file.Length); string fileName = System.IO.Path.GetFileName(fc.Filename); designService.Report.ResourceRepository.Add(fileName, bytes); designService.PixbufRepository.AddOrUpdatePixbufByName(fileName); file.Close(); } fc.Destroy(); updateTreeNode(imagesNode, designService.Report.ResourceRepository); }; jBox.ShowAll(); jBox.Popup(); } } } else if (args.Event.Button == 1) { if (path.Depth == 3) { int index = path.Indices [1]; if (index == 1) { Workspace.ShowInPropertyGrid(designService.Report.DataFields[path.Indices[2]]); } else if (index == 0) { Workspace.ShowInPropertyGrid(designService.Report.Parameters[path.Indices[2]]); } } } } }
public MainWindow() { XML gxml = new XML(null, "MultiMC.GTKGUI.MainWindow.glade", "mainVBox", null); gxml.Toplevel = this; gxml.Autoconnect(this); XML gxml2 = new XML(null, "MultiMC.GTKGUI.InstContextMenu.glade", "instContextMenu", null); gxml2.Autoconnect(this); /* * HACK: the nested menu isn't picked up by the first gxml object. It is probably a GTK# bug. * This is the fix - manually asking for the menu and connecting it. */ XML gxml3 = new XML(null, "MultiMC.GTKGUI.MainWindow.glade", "menunew", null); gxml3.Autoconnect(this); newInstButton.Menu = menunew; this.Add(mainVBox); ShowAll(); this.WidthRequest = 620; this.HeightRequest = 380; DeleteEvent += (o, args) => Application.Quit(); // Set up the instance icon view instListStore = new ListStore( typeof(string), typeof(Gdk.Pixbuf), typeof(Instance)); instView.Model = instListStore; instView.TextColumn = 0; instView.PixbufColumn = 1; instView.ItemWidth = -1; Gtk.CellRendererText crt = instView.Cells[0] as CellRendererText; crt.Editable = true; crt.Edited += (object o, EditedArgs args) => { int EditedIndex = int.Parse(args.Path); TreeIter iter; // don't allow bad names if (!Instance.NameIsValid(args.NewText)) { return; } System.Console.WriteLine("Path: " + args.Path + " New text: " + args.NewText); if (instListStore.GetIterFromString(out iter, args.Path)) { instListStore.SetValue(iter, 0, args.NewText); Instance inst = instListStore.GetValue(iter, 2) as Instance; inst.Name = args.NewText; } }; instView.Orientation = Orientation.Vertical; instView.ButtonPressEvent += (o, args) => { if (args.Event.Button == 3 && instView.GetPathAtPos((int)args.Event.X, (int)args.Event.Y) != null) { instView.SelectPath(instView.GetPathAtPos( (int)args.Event.X, (int)args.Event.Y)); instContextMenu.Popup(); } }; instView.KeyPressEvent += (object o, KeyPressEventArgs args) => { if (args.Event.Key == Gdk.Key.F2) { if (instView.SelectedItems.Count() != 0) { instView.SetCursor(instView.SelectedItems[0], instView.Cells[0], true); } } else if (args.Event.Key == Gdk.Key.Escape) { if (EscPressed != null) { EscPressed(this, EventArgs.Empty); } } }; // Set up the task list EventfulList <Task> tList = new EventfulList <Task>(); tList.Added += TaskAdded; tList.Removed += TaskRemoved; TaskList = tList; taskProgBars = new Dictionary <int, Box>(); // Set up the instance list EventfulList <Instance> iList = new EventfulList <Instance>(); iList.Added += InstAdded; iList.Removed += InstRemoved; InstanceList = iList; helpButton.Sensitive = false; if (OSUtils.OS == OSEnum.Linux) { Gtk.MenuItem openalRemoveItem = gxml2.GetWidget("removeOpenALMenuItem") as Gtk.MenuItem; openalRemoveItem.Visible = true; } }
public DemoMain() { window = new Gtk.Window("TestForm1"); Gtk.HBox hbox = new Gtk.HBox(false, 0); hbox1 = new Gtk.HBox(false, 0); Gtk.HBox hbox2 = new Gtk.HBox(false, 0); Gtk.HBox hbox3 = new Gtk.HBox(false, 0); hbox.Add(hbox1); window.SetDefaultSize(600, 400); window.DeleteEvent += new DeleteEventHandler(WindowDelete); button1 = new Gtk.Button("button1"); button1.Clicked += Button1Clicked; button2 = new Gtk.Button("button2"); button3 = new Gtk.Button("button3"); Gtk.Button button4 = new Gtk.Button("button4"); button4.Clicked += Button4Clicked; Gtk.Button button5 = new Gtk.Button("button5"); Gtk.Button button6 = new Gtk.Button("button6"); Gtk.Button button7 = new Gtk.Button("button7"); button7.Sensitive = false; scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]); hbox1.Add(hbox3); hbox1.Add(hbox2); hbox1.Add(button3); hbox1.Add(button2); button3.Accessible.Description = "help text 3"; button3.Sensitive = false; label1 = new Gtk.Label("label1"); textBox1 = new Gtk.Entry(); Gtk.Entry textBox2 = new Gtk.Entry(); textBox2.Visibility = false; textBox2.Sensitive = false; textBox2.IsEditable = false; textBox3 = new Gtk.TextView(); // TODO: scrollbars Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1"); Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2"); checkbox2.Sensitive = false; Gtk.TreeStore store = new Gtk.TreeStore(typeof(string), typeof(string)); Gtk.TreeIter [] iters = new Gtk.TreeIter [2]; iters [0] = store.AppendNode(); store.SetValues(iters [0], "item 1", "item 1 (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 1a", "item 1a (2)"); iters [0] = store.AppendNode(); store.SetValues(iters [0], "item 2", "item 2 (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 2a", "item 2a (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 2b", "item 2b (2)"); treeView1 = new Gtk.TreeView(store); AddTreeViewColumn(treeView1, 0, "column 1"); treeView1.CollapseAll(); treeView2 = new Gtk.TreeView(store); AddTreeViewColumn(treeView2, 0, "column 1"); AddTreeViewColumn(treeView2, 1, "column 2"); treeView2.CollapseAll(); treeView2.Accessible.Name = "treeView2"; tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string)); iters [0] = tableStore.AppendNode(); tableStore.SetValues(iters [0], "False", "Alice", "24", ""); iters [0] = tableStore.AppendNode(); tableStore.SetValues(iters [0], "True", "Bob", "28", ""); dataGridView1 = new Gtk.TreeView(tableStore); dataGridView1 = new Gtk.TreeView(tableStore); dataGridView1 = new Gtk.TreeView(tableStore); AddTreeViewColumn(dataGridView1, 0, "Gender"); AddTreeViewColumn(dataGridView1, 1, "Name"); AddTreeViewColumn(dataGridView1, 2, "Age"); dataGridView1.Accessible.Name = "dataGridView1"; hboxPanel = new Gtk.HBox(); Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove"); btnRemoveTextBox.Clicked += RemoveTextBoxClicked; Gtk.Button btnAddTextBox = new Gtk.Button("Add"); btnAddTextBox.Clicked += AddTextBoxClicked; txtCommand = new Gtk.Entry(); txtCommand.Accessible.Name = "txtCommand"; Gtk.Button btnRun = new Gtk.Button("Run"); btnRun.Clicked += btnRunClicked; hboxPanel.Add(btnRemoveTextBox); hboxPanel.Add(btnAddTextBox); Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string)); Gtk.TreeIter iter = treeStore.AppendNode(); treeStore.SetValue(iter, 0, "Item 0"); iter = treeStore.AppendNode(); treeStore.SetValue(iter, 0, "Item 1"); listView1 = new Gtk.TreeView(treeStore); AddTreeViewColumn(listView1, 0, "items"); listView1.Accessible.Name = "listView1"; listView1.ExpandAll(); hbox2.Add(button5); hbox2.Add(checkbox1); hbox2.Add(checkbox2); hbox2.Add(button4); hbox2.Accessible.Name = "groupBox2"; hbox3.Add(button7); hbox3.Add(button6); hbox3.Sensitive = false; hbox3.Accessible.Name = "groupBox3"; hbox.Add(textBox3); hbox.Add(textBox2); hbox.Add(textBox1); hbox.Add(label1); hbox.Add(button1); hbox.Add(treeView1); hbox.Add(treeView2); hbox.Add(listView1); hbox.Add(dataGridView1); hbox.Add(txtCommand); hbox.Add(btnRun); hbox.Add(hboxPanel); hbox.Add(scaleButton1); Gtk.Menu file = new Gtk.Menu(); file.Append(new Gtk.MenuItem("_New")); file.Append(new Gtk.MenuItem("_Open")); file.Append(new Gtk.CheckMenuItem("Check")); Gtk.MenuItem fileItem = new Gtk.MenuItem("File"); fileItem.Submenu = file; Gtk.Menu edit = new Gtk.Menu(); edit.Append(new Gtk.MenuItem("_Undo")); edit.Append(new Gtk.SeparatorMenuItem()); edit.Append(new Gtk.MenuItem("_Cut")); edit.Append(new Gtk.MenuItem("Copy")); edit.Append(new Gtk.MenuItem("_Paste")); Gtk.MenuItem editItem = new Gtk.MenuItem("Edit"); editItem.Submenu = edit; Gtk.MenuBar menuBar = new Gtk.MenuBar(); menuBar.Append(fileItem); menuBar.Append(editItem); hbox.Add(menuBar); hbox.Add(new Gtk.SpinButton(0, 100, 1)); hbox.Add(new Gtk.ToggleButton("ToggleButton")); Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100, 1, 10, 10); hbox.Add(new Gtk.VScrollbar(adj)); window.Add(hbox); window.ShowAll(); }
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); }
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++; } }
private void ConfigureDlg() { notebook1.ShowTabs = false; spinWeight.Sensitive = false; spinVolume.Sensitive = false; lblPercentForMaster.Visible = spinPercentForMaster.Visible = false; entryName.IsEditable = true; radioInfo.Active = true; ylabelCreationDate.Binding.AddFuncBinding(Entity, s => s.CreateDate.HasValue ? s.CreateDate.Value.ToString("dd.MM.yyyy HH:mm") : "", w => w.LabelProp).InitializeFromSource(); ylabelCreatedBy.Binding.AddFuncBinding <Nomenclature>(Entity, s => GetUserEmployeeName(s.CreatedBy), w => w.LabelProp).InitializeFromSource(); enumVAT.ItemsEnum = typeof(VAT); enumVAT.Binding.AddBinding(Entity, e => e.VAT, w => w.SelectedItem).InitializeFromSource(); enumType.ItemsEnum = typeof(NomenclatureCategory); enumType.Binding.AddBinding(Entity, e => e.Category, w => w.SelectedItem).InitializeFromSource(); enumTareVolume.ItemsEnum = typeof(TareVolume); enumTareVolume.Binding.AddBinding(Entity, e => e.TareVolume, w => w.SelectedItemOrNull).InitializeFromSource(); ycheckDisposableTare.Binding.AddBinding(Entity, e => e.IsDisposableTare, w => w.Active).InitializeFromSource(); yСolorBtnBottleCapColor.Binding.AddBinding(Entity, e => e.BottleCapColor, w => w.Color, new ColorTextToGdkColorConverter()).InitializeFromSource(); yСolorBtnBottleCapColor.ColorSet += YСolorBtnBottleCapColorOnColorSet; enumSaleCategory.Visible = Entity.Category == NomenclatureCategory.equipment; enumSaleCategory.ItemsEnum = typeof(SaleCategory); enumSaleCategory.Binding.AddBinding(Entity, e => e.SaleCategory, w => w.SelectedItemOrNull).InitializeFromSource(); enumDepositType.Visible = Entity.Category == NomenclatureCategory.deposit; enumDepositType.ItemsEnum = typeof(TypeOfDepositCategory); enumDepositType.Binding.AddBinding(Entity, e => e.TypeOfDepositCategory, w => w.SelectedItemOrNull).InitializeFromSource(); comboMobileCatalog.ItemsEnum = typeof(MobileCatalog); comboMobileCatalog.Binding.AddBinding(Entity, e => e.MobileCatalog, w => w.SelectedItem).InitializeFromSource(); lblSaleCategory.Visible = Nomenclature.GetCategoriesWithSaleCategory().Contains(Entity.Category); lblSubType.Visible = Entity.Category == NomenclatureCategory.deposit; entryName.Binding.AddBinding(Entity, e => e.Name, w => w.Text).InitializeFromSource(); yentryOfficialName.Binding.AddBinding(Entity, e => e.OfficialName, w => w.Text).InitializeFromSource(); var parallel = new ParallelEditing(yentryOfficialName); parallel.SubscribeOnChanges(entryName); parallel.GetParallelTextFunc = GenerateOfficialName; ycheckRentPriority.Binding.AddBinding(Entity, e => e.RentPriority, w => w.Active).InitializeFromSource(); checkNotReserve.Binding.AddBinding(Entity, e => e.DoNotReserve, w => w.Active).InitializeFromSource(); checkcanPrintPrice.Binding.AddBinding(Entity, e => e.CanPrintPrice, w => w.Active).InitializeFromSource(); labelCanPrintPrice.Visible = checkcanPrintPrice.Visible = Entity.Category == NomenclatureCategory.water && !Entity.IsDisposableTare; checkHide.Binding.AddBinding(Entity, e => e.Hide, w => w.Active).InitializeFromSource(); entryCode1c.Binding.AddBinding(Entity, e => e.Code1c, w => w.Text).InitializeFromSource(); yspinSumOfDamage.Binding.AddBinding(Entity, e => e.SumOfDamage, w => w.ValueAsDecimal).InitializeFromSource(); spinWeight.Binding.AddBinding(Entity, e => e.Weight, w => w.Value).InitializeFromSource(); spinVolume.Binding.AddBinding(Entity, e => e.Volume, w => w.Value).InitializeFromSource(); spinPercentForMaster.Binding.AddBinding(Entity, e => e.PercentForMaster, w => w.Value).InitializeFromSource(); checkSerial.Binding.AddBinding(Entity, e => e.IsSerial, w => w.Active).InitializeFromSource(); ycheckNewBottle.Binding.AddBinding(Entity, e => e.IsNewBottle, w => w.Active).InitializeFromSource(); ycheckDefectiveBottle.Binding.AddBinding(Entity, e => e.IsDefectiveBottle, w => w.Active).InitializeFromSource(); ycheckShabbyBottle.Binding.AddBinding(Entity, e => e.IsShabbyBottle, w => w.Active).InitializeFromSource(); chkIsDiler.Binding.AddBinding(Entity, e => e.IsDiler, w => w.Active).InitializeFromSource(); spinMinStockCount.Binding.AddBinding(Entity, e => e.MinStockCount, w => w.ValueAsDecimal).InitializeFromSource(); ycomboFuelTypes.SetRenderTextFunc <FuelType>(x => x.Name); ycomboFuelTypes.ItemsList = UoW.GetAll <FuelType>(); ycomboFuelTypes.Binding.AddBinding(Entity, e => e.FuelType, w => w.SelectedItem).InitializeFromSource(); ycomboFuelTypes.Visible = Entity.Category == NomenclatureCategory.fuel; ylblOnlineStore.Text = Entity.OnlineStore?.Name; yentryFolder1c.SubjectType = typeof(Folder1c); yentryFolder1c.Binding.AddBinding(Entity, e => e.Folder1C, w => w.Subject).InitializeFromSource(); yentryProductGroup.JournalButtons = Buttons.Add | Buttons.Edit; yentryProductGroup.RepresentationModel = new ProductGroupVM(UoW, new ProductGroupFilterViewModel()); yentryProductGroup.Binding.AddBinding(Entity, e => e.ProductGroup, w => w.Subject).InitializeFromSource(); referenceUnit.SubjectType = typeof(MeasurementUnits); referenceUnit.Binding.AddBinding(Entity, n => n.Unit, w => w.Subject).InitializeFromSource(); yentryrefEqupmentType.SubjectType = typeof(EquipmentType); yentryrefEqupmentType.Binding.AddBinding(Entity, e => e.Type, w => w.Subject).InitializeFromSource(); referenceColor.SubjectType = typeof(EquipmentColors); referenceColor.Binding.AddBinding(Entity, e => e.EquipmentColor, w => w.Subject).InitializeFromSource(); referenceRouteColumn.SubjectType = typeof(Domain.Logistic.RouteColumn); referenceRouteColumn.Binding.AddBinding(Entity, n => n.RouteListColumn, w => w.Subject).InitializeFromSource(); referenceManufacturer.SubjectType = typeof(Manufacturer); referenceManufacturer.Binding.AddBinding(Entity, e => e.Manufacturer, w => w.Subject).InitializeFromSource(); checkNoDeliver.Binding.AddBinding(Entity, e => e.NoDelivey, w => w.Active).InitializeFromSource(); yentryShortName.Binding.AddBinding(Entity, e => e.ShortName, w => w.Text, new NullToEmptyStringConverter()).InitializeFromSource(); yentryShortName.MaxLength = 220; checkIsArchive.Binding.AddBinding(Entity, e => e.IsArchive, w => w.Active).InitializeFromSource(); checkIsArchive.Sensitive = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_create_and_arc_nomenclatures"); entityviewmodelentryShipperCounterparty.SetEntityAutocompleteSelectorFactory( new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(QS.Project.Services.ServicesConfig.CommonServices) ); entityviewmodelentryShipperCounterparty.Binding.AddBinding(Entity, s => s.ShipperCounterparty, w => w.Subject).InitializeFromSource(); entityviewmodelentryShipperCounterparty.CanEditReference = true; yentryStorageCell.Binding.AddBinding(Entity, s => s.StorageCell, w => w.Text).InitializeFromSource(); yspinbuttonPurchasePrice.Binding.AddBinding(Entity, s => s.PurchasePrice, w => w.ValueAsDecimal).InitializeFromSource(); UpdateVisibilityForEshopParam(); #region Вкладка характиристики ytextDescription.Binding.AddBinding(Entity, e => e.Description, w => w.Buffer.Text).InitializeFromSource(); nomenclaturecharacteristicsview1.Uow = UoWGeneric; #endregion int currNomenclatureOfDependence = (Entity.DependsOnNomenclature == null ? 0 : Entity.DependsOnNomenclature.Id); dependsOnNomenclature.RepresentationModel = new NomenclatureDependsFromVM(Entity); dependsOnNomenclature.Binding.AddBinding(Entity, e => e.DependsOnNomenclature, w => w.Subject).InitializeFromSource(); ConfigureInputs(Entity.Category, Entity.TareVolume); pricesView.UoWGeneric = UoWGeneric; pricesView.Sensitive = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_create_and_arc_nomenclatures"); Imageslist.ImageButtonPressEvent += Imageslist_ImageButtonPressEvent; Entity.PropertyChanged += Entity_PropertyChanged; //make actions menu var menu = new Gtk.Menu(); var menuItem = new Gtk.MenuItem("Заменить все ссылки на номенклатуру..."); menuItem.Activated += MenuItem_ReplaceLinks_Activated;; menu.Add(menuItem); menuActions.Menu = menu; menu.ShowAll(); menuActions.Sensitive = !UoWGeneric.IsNew; }