/// <summary> /// Creates a menu item with the caption and icon from the menu node. /// </summary> /// <param name="container"> /// The <see cref="UIMenuNode.Container"/> to initialize from. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="container"/> is null. /// </exception> public static LocalizedToolStripMenuItem CreateFrom(UIMenuNode.Container container) { if (container == null) { throw new ArgumentNullException(nameof(container)); } return(new LocalizedToolStripMenuItem(container.TextProvider, container.IconProvider, null, false)); }
public UIAutoHideMainMenuItem AddMenuItem(UIMenuNode.Container containerNode) { if (containerNode == null) { throw new ArgumentNullException(nameof(containerNode)); } UIAutoHideMainMenuItem menuItem = new UIAutoHideMainMenuItem(this, containerNode); MenuItems.Add(menuItem); return(menuItem); }
ToolStripMenuItem IUIMenuTreeVisitor <ToolStripMenuItem> .VisitContainer(UIMenuNode.Container container) { if (container.TextProvider == null && container.IconProvider == null) { return(null); } var menuItem = LocalizedToolStripMenuItem.CreateFrom(container); BuildMenu(container.Nodes, menuItem.DropDownItems); // No empty submenu items. if (menuItem.DropDownItems.Count == 0) { return(null); } return(menuItem); }
internal UIAutoHideMainMenuItem(UIAutoHideMainMenu owner, UIMenuNode.Container containerNode) { Owner = owner; ContainerNode = containerNode; DropDownItemsActionHandler = new UIActionHandler(); }