Exemple #1
0
        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;
            }
        }
Exemple #2
0
 protected MenuBar(Generator generator, Type type, bool initialize = true)
     : base(generator, type, initialize)
 {
     Items = new MenuItemCollection(Handler);
 }
Exemple #3
0
 public void CreateStandardMenu(MenuItemCollection menuItems, IEnumerable <Command> commands = null)
 {
     Handler.CreateStandardMenu(menuItems, commands ?? GetSystemCommands());
 }
Exemple #4
0
 protected ContextMenu(Generator generator, Type type, bool initialize = true)
     : base(generator, type, initialize)
 {
     handler   = (IContextMenu)this.Handler;
     menuItems = new MenuItemCollection(this, handler);
 }
Exemple #5
0
 protected ImageMenuItem(Generator generator, Type type, bool initialize = true)
     : base(generator, type, initialize)
 {
     menuItems = new MenuItemCollection(this, Handler);
 }
Exemple #6
0
 public ButtonMenuItem(Command command, Generator generator = null)
     : base(command, generator, typeof(IButtonMenuItem))
 {
     Items = new MenuItemCollection(Handler);
     Image = command.Image;
 }
Exemple #7
0
 protected MenuBar(Generator generator, Type type, bool initialize = true)
     : base(generator, type, initialize)
 {
     handler   = (IMenuBar)base.Handler;
     menuItems = new MenuItemCollection(this, handler);
 }