public void Generate(MenuItemCollection menu) { var list = new List <IActionItem>(this); list.Sort(Compare); var lastSeparator = false; for (int i = 0; i < list.Count; i++) { var ai = list[i]; var isSeparator = (ai is ActionItemSeparator); if ((lastSeparator && isSeparator) || (isSeparator && (i == 0 || i == list.Count - 1))) { continue; } var mi = ai.Generate(menu.parent.Generator); if (mi != null) { menu.Add(mi); } lastSeparator = isSeparator; } }
protected MenuBar(Generator generator, Type type, bool initialize = true) : base(generator, type, initialize) { Items = new MenuItemCollection(Handler); }
public void CreateStandardMenu(MenuItemCollection menuItems, IEnumerable <Command> commands = null) { Handler.CreateStandardMenu(menuItems, commands ?? GetSystemCommands()); }
protected ContextMenu(Generator generator, Type type, bool initialize = true) : base(generator, type, initialize) { handler = (IContextMenu)this.Handler; menuItems = new MenuItemCollection(this, handler); }
protected ImageMenuItem(Generator generator, Type type, bool initialize = true) : base(generator, type, initialize) { menuItems = new MenuItemCollection(this, Handler); }
public ButtonMenuItem(Command command, Generator generator = null) : base(command, generator, typeof(IButtonMenuItem)) { Items = new MenuItemCollection(Handler); Image = command.Image; }
protected MenuBar(Generator generator, Type type, bool initialize = true) : base(generator, type, initialize) { handler = (IMenuBar)base.Handler; menuItems = new MenuItemCollection(this, handler); }