void SetupMenu() { var fileMenu = new Menu(); var exit = new MenuItem("E_xit"); exit.Clicked += delegate { Close(); }; fileMenu.Items.Add(exit); tone_menu = new Menu(); SetupToneMenu(); keyboard_menu = new Menu(); foreach (var km in available_keymaps) { var mi = new MenuItem(km.Name); mi.Clicked += (sender, e) => { keyboard.Clear(); this.keymap = km; FillKeyboard(keyboard); }; keyboard_menu.Items.Add(mi); } MainMenu = new Menu(); MainMenu.Items.Add(new MenuItem("_File") { SubMenu = fileMenu }); MainMenu.Items.Add(new MenuItem("_Tone") { SubMenu = tone_menu }); MainMenu.Items.Add(new MenuItem("_Keyboard") { SubMenu = keyboard_menu }); var devices = new MenuItem("_Devices"); var devMenu = new Menu(); devices.Clicked += delegate { devMenu.Items.Clear(); foreach (var output in midi.MidiAccess.Outputs) { var item = new CheckBoxMenuItem(output.Name) { Tag = output.Id, Checked = output.Id == midi.CurrentDeviceId }; item.Clicked += delegate { midi.ChangeOutputDevice((string)item.Tag); }; devMenu.Items.Add(item); } ; }; devices.SubMenu = devMenu; MainMenu.Items.Add(devices); }
public void SetDocuments(IDockContent[] docs) { this.documentslistwindow.Items.Clear(); foreach (var doc in docs) { var mi = new CheckBoxMenuItem(doc.TabText) { Checked = object.ReferenceEquals(this.titleBar.pane.Document, doc), Tag = doc }; mi.Clicked += Mi_Clicked; this.documentslistwindow.Items.Add(mi); } }
void CreateMenu() { Title = "MonoGame Pipeline"; Width = 800; Height = 600; // TODO: Implement click event handlers MainMenu = new Menu(); var fileMenu = new MenuItem() { Label = "File", SubMenu = new Menu() }; _newMenuItem = new MenuItem("New..."); _newMenuItem.Clicked += OnNewMenuClicked; _openMenuItem = new MenuItem("Open..."); _openMenuItem.Clicked += OnOpenMenuClicked; _closeMenuItem = new MenuItem("Close"); _closeMenuItem.Sensitive = false; _closeMenuItem.Clicked += OnCloseMenuClicked; _importMenuItem = new MenuItem("Import..."); _importMenuItem.Clicked += OnImportMenuClicked; _saveMenuItem = new MenuItem("Save"); _saveMenuItem.Clicked += OnSaveMenuClicked; _saveAsMenuItem = new MenuItem("Save As..."); _saveAsMenuItem.Clicked += OnSaveAsMenuClicked; _exitMenuItem = new MenuItem("Exit"); _exitMenuItem.Clicked += OnExitMenuClicked; fileMenu.SubMenu.Items.Add(_newMenuItem); fileMenu.SubMenu.Items.Add(_openMenuItem); fileMenu.SubMenu.Items.Add(_closeMenuItem); fileMenu.SubMenu.Items.Add(new SeparatorMenuItem()); fileMenu.SubMenu.Items.Add(_importMenuItem); fileMenu.SubMenu.Items.Add(new SeparatorMenuItem()); fileMenu.SubMenu.Items.Add(_saveMenuItem); fileMenu.SubMenu.Items.Add(_saveAsMenuItem); fileMenu.SubMenu.Items.Add(new SeparatorMenuItem()); fileMenu.SubMenu.Items.Add(_exitMenuItem); MainMenu.Items.Add(fileMenu); var editMenu = new MenuItem() { Label = "_Edit", SubMenu = new Menu() }; _undoMenuItem = new MenuItem("Undo"); _undoMenuItem.Clicked += OnUndoMenuClicked; _redoMenuItem = new MenuItem("Redo"); _redoMenuItem.Clicked += OnRedoMenuClicked; _newItemMenuItem = new MenuItem("New Item"); _addItemMenuItem = new MenuItem("Add Item"); _deleteMenuItem = new MenuItem("Delete"); editMenu.SubMenu.Items.Add(_undoMenuItem); editMenu.SubMenu.Items.Add(_redoMenuItem); editMenu.SubMenu.Items.Add(new SeparatorMenuItem()); editMenu.SubMenu.Items.Add(_newItemMenuItem); editMenu.SubMenu.Items.Add(_addItemMenuItem); editMenu.SubMenu.Items.Add(new SeparatorMenuItem()); editMenu.SubMenu.Items.Add(_deleteMenuItem); MainMenu.Items.Add(editMenu); _buildMenu = new MenuItem() { Label = "Build", SubMenu = new Menu() }; _buildMenuItem = new MenuItem("Build"); _buildMenuItem.Clicked += OnBuildMenuItemClicked; _rebuildMenuItem = new MenuItem("Rebuild"); _rebuildMenuItem.Clicked += OnRebuildMenuClicked; _cleanMenuItem = new MenuItem("Clean"); _cleanMenuItem.Clicked += OnCleanMenuClicked; _cancelSeparatorMenuItem = new SeparatorMenuItem(); _cancelBuildMenuItem = new MenuItem() { Label = "Cancel", Visible = false }; _cancelBuildMenuItem.Clicked += OnCancelMenuClicked; _debugMenuItem = new CheckBoxMenuItem("Debug Mode"); _buildMenu.SubMenu.Items.Add(_buildMenuItem); _buildMenu.SubMenu.Items.Add(_rebuildMenuItem); _buildMenu.SubMenu.Items.Add(_cleanMenuItem); _buildMenu.SubMenu.Items.Add(_cancelBuildMenuItem); _buildMenu.SubMenu.Items.Add(new SeparatorMenuItem()); _buildMenu.SubMenu.Items.Add(_debugMenuItem); MainMenu.Items.Add(_buildMenu); var helpMenu = new MenuItem() { Label = "Help", SubMenu = new Menu() }; var viewHelpMenu = new MenuItem("View Help"); viewHelpMenu.Clicked += OnViewHelpMenuClicked; var aboutMenu = new MenuItem("About"); aboutMenu.Clicked += OnAboutMenuClicked; helpMenu.SubMenu.Items.Add(viewHelpMenu); helpMenu.SubMenu.Items.Add(new SeparatorMenuItem()); helpMenu.SubMenu.Items.Add(aboutMenu); MainMenu.Items.Add(helpMenu); }