예제 #1
0
 /// <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));
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 internal UIAutoHideMainMenuItem(UIAutoHideMainMenu owner, UIMenuNode.Container containerNode)
 {
     Owner         = owner;
     ContainerNode = containerNode;
     DropDownItemsActionHandler = new UIActionHandler();
 }