Exemplo n.º 1
0
        public void ActivateMenu(IMenuBarItem menuBarItem)
        {
            var menuBarButton = menuBarItem as MenuBarButton;

            if (menuBarButton == null)
            {
                return;
            }
            var barItem = _mapper.MapFrom(new BarManager(), menuBarButton);

            if (!barItem.Enabled)
            {
                return;
            }
            menuBarButton.Click();
        }
        public BarItem MapFrom(IRibbonBarItem ribbonBarItem)
        {
            var barItem = _barItemMapper.MapFrom(_ribbonBarManager, ribbonBarItem.MenuBarItem);

            barItem.Caption = ribbonBarItem.Caption;
            var barButtonItem = barItem as BarButtonItem;

            if (barButtonItem != null)
            {
                addSubMenusToBarButtonItem(barButtonItem, ribbonBarItem);
            }
            else
            {
                addSubMenusToBarSubItem(barItem.DowncastTo <BarSubItem>(), ribbonBarItem);
            }

            barItem.RibbonStyle = mapStyleFrom(ribbonBarItem.ItemStyle);
            barItem.UpdateIcon(ribbonBarItem.Icon);

            return(barItem);
        }
        public void AddButton(IMenuBarItem menuBarItem)
        {
            var button = _barItemMapper.MapFrom(_barManager, menuBarItem);

            //required to set the image in the top menu
            if (button.ImageIndex >= 0)
            {
                button.Glyph      = _allImages.Images[button.ImageIndex];
                button.PaintStyle = BarItemPaintStyle.CaptionGlyph;
            }

            _barMenu.AddItem(button);
        }
Exemplo n.º 4
0
 public void AddQuickAccessButton(IMenuBarItem menuBarItem)
 {
     _barManager.Ribbon.Toolbar.ItemLinks.Add(_barItemMapper.MapFrom(_barManager, menuBarItem));
 }