// Copyright (C) Stichting Deltares 2016. All rights reserved. // // This file is part of Ringtoets. // // Ringtoets 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.Windows.Forms; using Core.Common.Gui.ContextMenu; 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() { contextMenu.Items.Add(StubItem()); return this; } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddDeleteItem() { contextMenu.Items.Add(StubItem()); return this; } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddDeleteChildrenItem() { contextMenu.Items.Add(StubItem()); return this; } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddExpandAllItem() { contextMenu.Items.Add(StubItem()); return this; } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddCollapseAllItem() { contextMenu.Items.Add(StubItem()); return this; } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddOpenItem() { contextMenu.Items.Add(StubItem()); return this; } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddExportItem() { contextMenu.Items.Add(StubItem()); return this; } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddImportItem() { contextMenu.Items.Add(StubItem()); return this; } /// /// Adds a dummy to the . /// /// The . public IContextMenuBuilder AddPropertiesItem() { contextMenu.Items.Add(StubItem()); return this; } /// /// 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 static ToolStripItem StubItem() { return new StrictContextMenuItem(string.Empty, string.Empty, null, (sender, args) => { }); } } }