// Copyright (C) Stichting Deltares 2019. All rights reserved. // // This file is part of Riskeer. // // Riskeer is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using Core.Common.Gui.ContextMenu; using Core.Common.Gui.Plugin; namespace Core.Common.Gui.TestUtil.ContextMenu { /// /// This class can be used for easily testing the custom items which are added to a context menu. /// public class CustomItemsOnlyContextMenuBuilder : IContextMenuBuilder { /// /// The context menu which is build. /// private readonly ContextMenuStrip contextMenu = new ContextMenuStrip(); /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddRenameItem() { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddDeleteItem() { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddDeleteChildrenItem() { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddExpandAllItem() { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddCollapseAllItem() { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddOpenItem() { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddExportItem() { return AddStubItem(); } /// /// Adds a dummy to the . /// /// An enumeration of instances, representing one or more /// supported import actions. /// The . public IContextMenuBuilder AddImportItem(IEnumerable importInfos = null) { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The text of the import item. /// The tooltip of the import item. /// The image of the import item. /// An enumeration of instances, representing one or more /// supported import actions. /// The . public IContextMenuBuilder AddImportItem(string text, string toolTip, Image image, IEnumerable importInfos = null) { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddUpdateItem() { return AddStubItem(); } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddPropertiesItem() { return AddStubItem(); } /// /// Adds a toolstrip separator. /// /// The . public IContextMenuBuilder AddSeparator() { contextMenu.Items.Add(new ToolStripSeparator()); return this; } /// /// Adds a dummy to the . /// /// The custom to add to the . /// The . public IContextMenuBuilder AddCustomItem(StrictContextMenuItem item) { contextMenu.Items.Add(item); return this; } /// /// Obtain the , which has been constructed by using . /// /// The constructed . public ContextMenuStrip Build() { return contextMenu; } private IContextMenuBuilder AddStubItem() { ToolStripItem toolStripItem = new StrictContextMenuItem(string.Empty, string.Empty, null, (sender, args) => {}); contextMenu.Items.Add(toolStripItem); return this; } } }