private void m_gameObjectsMenuButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(m_scenePath)) { return; } MetroButton btn = sender as MetroButton; if (btn == null) { return; } MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; menuItem = new ToolStripMenuItem("Add new Game Object"); menuItem.Click += new EventHandler(menuItem_gameObjectAdd_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Remove all Game Objects"); menuItem.Click += new EventHandler(menuItem_gameObjectsRemove_Click); menu.Items.Add(menuItem); menu.Show(btn, new Point(0, btn.Height)); }
private void RecordTypeGridView_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var hitTest = gridRecordTypes.HitTest(e.X, e.Y); var cm = new MetroContextMenu(Container); if (hitTest.RowIndex > -1) { _rowIdxSel = hitTest.RowIndex; gridRecordTypes.ClearSelection(); gridRecordTypes.Rows[_rowIdxSel].Selected = true; cm.Items.Add("Edit Type", Resources.edit_dark, editRecordTypeMenuItem_Click); cm.Items.Add("Delete Type", Resources.trash_dark, deleteRecordTypeMenuItem_Click); cm.Items.Add("-"); } cm.Items.Add("Add Type", Resources.plus_dark, addRecordTypeMenuItem_Click); cm.Show(gridRecordTypes, gridRecordTypes.PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y))); } }
private void listAttachments_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var cm = new MetroContextMenu(Container); var hitTest = listAttachments.HitTest(e.X, e.Y); _attachmentsSelIdx = -1; if (hitTest.Item != null) { _attachmentsSelIdx = hitTest.Item.Index; } if (_attachmentsSelIdx > -1) { cm.Items.Add("Download Attachment", Theme == MetroThemeStyle.Dark ? Resources.download_light : Resources.download_dark, downloadAttachmentMenuItem_Click); cm.Items.Add("Delete Attachment", Theme == MetroThemeStyle.Dark ? Resources.trash_light : Resources.trash_dark, deleteAttachmentMenuItem_Click); cm.Items.Add("-"); //horizontal separator on context menu } cm.Items.Add("Add Attachment", Theme == MetroThemeStyle.Dark ? Resources.plus_light : Resources.plus_dark, addAttachmentMenuItem_Click); cm.Show(listAttachments, listAttachments.PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y))); } }
private void SetupClickListeners() { void ManageRecordsHandler(object sender, EventArgs args) { Program.SwitchPrimaryForm(new ManageRecords(_dbSettings, _user)); } void ManageRecordTypesHandler(object sender, EventArgs args) { Program.SwitchPrimaryForm(new ManageRecordTypes(_dbSettings, _user)); } void ManageUserAccountsHandler(object sender, EventArgs args) { Program.SwitchPrimaryForm(new ManageUserAccounts(_dbSettings, _user)); } btnImport.Click += (sender, args) => Program.SwitchPrimaryForm(new ImportRecords(_dbSettings, _user)); btnOptions.Click += (sender, args) => ShowOptions(); btnManage.Click += (sender, args) => _ctxMenuManage.Show(btnManage, new Point(0, btnManage.Height)); lblRecCount.Click += ManageRecordsHandler; lblRecTypes.Click += ManageRecordTypesHandler; lblUserAcc.Click += ManageUserAccountsHandler; tileRecords.Click += ManageRecordsHandler; tileRecTypes.Click += ManageRecordTypesHandler; tileUserAccts.Click += ManageUserAccountsHandler; _ctxMenuManage.Items.Add("Manage Records", null, ManageRecordsHandler); _ctxMenuManage.Items.Add("Manage Record Types", null, ManageRecordTypesHandler); _ctxMenuManage.Items.Add("Manage User Accounts", null, ManageUserAccountsHandler); }
private void addComponentButton_Click(object sender, EventArgs e) { MetroButton btn = sender as MetroButton; if (btn == null) { return; } List <string> components = SceneViewPlugin.ListComponents(); if (components == null || components.Count == 0) { return; } MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; foreach (string c in components) { menuItem = new ToolStripMenuItem(c); menuItem.Click += new EventHandler(menuItem_addNewComponent_Click); menu.Items.Add(menuItem); } menu.Show(btn, new Point(0, btn.Height)); }
private void m_gameObjectsTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { MainForm mainForm = FindForm() as MainForm; if (mainForm == null) { return; } TreeNode node = e.Node; if (e.Button == MouseButtons.Left) { if (node != null && node.Tag is int) { mainForm.ExploreGameObjectProperties((int)node.Tag, IsGameObjectsPrefabsMode); } else { mainForm.ExploreGameObjectProperties(0, false); } } else if (e.Button == MouseButtons.Right) { MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; menuItem = new ToolStripMenuItem("Remove"); menuItem.Tag = node.Tag; menuItem.Click += new System.EventHandler(menuItem_nodeRemove_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Add new Game Object"); menuItem.Tag = node.Tag; menuItem.Click += new System.EventHandler(menuItem_nodeAdd_Click); menu.Items.Add(menuItem); if (IsGameObjectsPrefabsMode) { menuItem = new ToolStripMenuItem("Instantiate on scene"); menuItem.Tag = node.Text; menuItem.Click += new System.EventHandler(menuItem_nodeInstantiate_Click); menu.Items.Add(menuItem); } menu.Show(m_gameObjectsTree, e.Location); } }
private void gridFieldAssignment_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var hitTest = gridFieldAssignment.HitTest(e.X, e.Y); gridFieldAssignment.ClearSelection(); gridFieldAssignment.Rows[hitTest.RowIndex].Selected = true; var cm = new MetroContextMenu(Container); cm.Items.Add("Delete Row", Resources.trash_dark, deleteToolStrip_Click); cm.Show(gridFieldAssignment, gridFieldAssignment.PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y))); } }
private void m_assetsMenuButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(m_scenePath)) { return; } MetroButton btn = sender as MetroButton; if (btn == null) { return; } MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; menuItem = new ToolStripMenuItem("Textures"); menuItem.Click += new EventHandler(menuItem_textures_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Shaders"); menuItem.Click += new EventHandler(menuItem_shaders_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Sounds"); menuItem.Click += new EventHandler(menuItem_sounds_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Music"); menuItem.Click += new EventHandler(menuItem_music_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Fonts"); menuItem.Click += new EventHandler(menuItem_fonts_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Custom Assets"); menuItem.Click += new EventHandler(menuItem_custom_Click); menu.Items.Add(menuItem); menu.Show(btn, new Point(0, btn.Height)); }
private void btn_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { MetroButton btn = sender as MetroButton; MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; menuItem = new ToolStripMenuItem("Remove from project"); menuItem.Tag = btn.Tag; menuItem.Click += new EventHandler(menuItem_removeFromProject_Click); menu.Items.Add(menuItem); menu.Show(btn, new Point(btn.Width, 0)); } }
private void m_sceneMenuButton_Click(object sender, EventArgs e) { MetroButton btn = sender as MetroButton; if (btn == null) { return; } MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; if (string.IsNullOrEmpty(m_scenePath)) { menuItem = new ToolStripMenuItem("New Scene"); menuItem.Click += new EventHandler(menuItem_newScene_Click); menu.Items.Add(menuItem); } else { menuItem = new ToolStripMenuItem("New Scene"); menuItem.Click += new EventHandler(menuItem_newScene_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Save Scene"); menuItem.Click += new EventHandler(menuItem_saveScene_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Save Scene As..."); menuItem.Click += new EventHandler(menuItem_saveSceneAs_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Reload Scene"); menuItem.Click += new EventHandler(menuItem_reloadScene_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Close Scene"); menuItem.Click += new EventHandler(menuItem_closeScene_Click); menu.Items.Add(menuItem); } menu.Show(btn, new Point(0, btn.Height)); }
private void MetroGrid1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var m = new MetroContextMenu(metroGrid1.Container); var terminate = new ToolStripMenuItem(); terminate.Text = "Terminate"; terminate.Click += TerminateToolStripMenuItem_Click; m.Items.Add(terminate); var test = metroGrid1.HitTest(e.X, e.Y); if (test.RowIndex >= 0) { LastProcess = metroGrid1.Rows[test.RowIndex].Cells["ProcessName"].Value.ToString(); } m.Show(metroGrid1, new Point(e.X, e.Y)); } }
private void tile_MouseUp(object sender, MouseEventArgs e) { MetroTileIcon tile = sender as MetroTileIcon; if (tile == null) { return; } string path = tile.Tag as string; if (e.Button == MouseButtons.Left) { if (Directory.Exists(path)) { ViewPath = path; } else if (File.Exists(path)) { OpenFile(path); } } else if (e.Button == MouseButtons.Right) { MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; menuItem = new ToolStripMenuItem("Rename"); menuItem.Tag = path; menuItem.Click += new EventHandler(menuItem_rename_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Delete"); menuItem.Tag = path; menuItem.Click += new EventHandler(menuItem_delete_Click); menu.Items.Add(menuItem); menu.Show(tile, e.Location); } }
private void componentButton_Click(object sender, EventArgs e) { MetroButton btn = sender as MetroButton; if (btn == null) { return; } MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; menuItem = new ToolStripMenuItem("Remove Component"); menuItem.Tag = btn.Text; menuItem.Click += new EventHandler(menuItem_removeComponent_Click); menu.Items.Add(menuItem); menu.Show(btn, new Point(0, btn.Height)); }
private void m_optionsTile_Click(object sender, EventArgs e) { MainForm mainForm = FindForm() as MainForm; if (mainForm == null || mainForm.ProjectModel == null) { return; } MetroContextMenu menu = new MetroContextMenu(null); MetroSkinManager.ApplyMetroStyle(menu); ToolStripMenuItem menuItem; menuItem = new ToolStripMenuItem("Build scene view plugin"); menuItem.Click += new EventHandler(menuItem_buildSceneViewPlugin_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Rebuild scene view plugin"); menuItem.Click += new EventHandler(menuItem_rebuildSceneViewPlugin_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("New C++ component"); menuItem.Click += new EventHandler(menuItem_newCppComponent_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("New C++ custom asset"); menuItem.Click += new EventHandler(menuItem_newCppCustomAsset_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Add C++ file"); menuItem.Click += new EventHandler(menuItem_addCppFile_Click); menu.Items.Add(menuItem); menuItem = new ToolStripMenuItem("Update main C++ file"); menuItem.Click += new EventHandler(menuItem_updateMainCppFile_Click); menu.Items.Add(menuItem); menu.Show(m_optionsTile, new Point(m_optionsTile.Width, 0)); }
private void gridUsers_MouseClick(object sender, MouseEventArgs e) { if (_user != null && e.Button == MouseButtons.Right) { var hitTest = gridUsers.HitTest(e.X, e.Y); var cm = new MetroContextMenu(Container); if (hitTest.RowIndex >= 0) { _rowIdUsers = hitTest.RowIndex; gridUsers.ClearSelection(); gridUsers.Rows[_rowIdUsers].Selected = true; cm.Items.Add("Edit User", Resources.edit_dark, editUsersMenuItem_Click); cm.Items.Add("-"); } cm.Items.Add("Add User", Resources.plus_dark, addUserMenuItem_Click); cm.Show(gridUsers, gridUsers.PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y))); } }
private void RefreshRateButton_Click(object sender, EventArgs e) { var m = new MetroContextMenu(refreshRateButton.Container); var fast = new ToolStripMenuItem(); fast.Text = "Fast (0.5s)"; fast.Click += FastToolStripMenuItem_Click; var normal = new ToolStripMenuItem(); normal.Text = "Normal (1s)"; normal.Click += NormalToolStripMenuItem_Click; var slow = new ToolStripMenuItem(); slow.Text = "Slow (2s)"; slow.Click += SlowToolStripMenuItem_Click; if (ProcessManager.Interval == 500) { fast.Checked = true; } else if (ProcessManager.Interval == 1000) { normal.Checked = true; } else { slow.Checked = true; } m.Items.Add(fast); m.Items.Add(normal); m.Items.Add(slow); m.Show(metroGrid1, new Point(refreshRateButton.Width, refreshRateButton.Height)); }
public void ShowMenu() { //menu.Font = MetroFonts.Link(FontSize, FontWeight); menu.Show(this, 0, Height); }