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