protected override void Context() { _toolBarName = "Simulation"; _buttonToAdd1 = A.Fake <IRibbonBarItem>(); _buttonToAdd2 = A.Fake <IRibbonBarItem>(); sut = CreateButtonGroup.WithCaption(_toolBarName).WithButton(_buttonToAdd1).WithButton(_buttonToAdd2); }
protected override bool SetCreateTypeInfo(IComponent pComponent) { if (pComponent is IRibbonPageItem) { IRibbonPageItem pItem = pComponent as IRibbonPageItem; pItem.LineDistance = 2; pItem.ColumnDistance = 2; //pItem.ShowBackgroud = true; } else if (pComponent is IRibbonBarItem) { IRibbonBarItem pItem = pComponent as IRibbonBarItem; pItem.Padding = new Padding(3, 3, 3, 2); } else if (pComponent is ITextBoxItem) { //ITextBoxItem pItem = pComponent as ITextBoxItem; //pItem.Size = new Size(100, 21); BaseItem baseItem = pComponent as BaseItem; if (baseItem != null) { this.Size = new Size(100, 21); } } // return(base.SetCreateTypeInfo(pComponent)); }
protected override void Context() { _toolBarName = "Simulation"; _buttonToAdd1 = A.Fake <IRibbonBarItem>(); _buttonToAdd2 = A.Fake <IRibbonBarItem>(); sut = new ButtonGroup { Caption = _toolBarName }; }
public RibbonBarMirrorPopupPanel(IRibbonBarItem ribbonBarItem) { this.m_pRibbonBarItem = ribbonBarItem; ((ISetOwnerHelper)this).SetOwner(ribbonBarItem as IOwner); // base.Width = this.m_pRibbonBarItem.Width; base.Height = this.m_pRibbonBarItem.Height; base.BackColor = System.Drawing.Color.Transparent; }
private void addSubMenusToBarSubItem(BarSubItem barSubItem, IRibbonBarItem ribbonBarItem) { if (barSubItem.ItemLinks.Count == ribbonBarItem.AllMenuItems().Count()) { return; } foreach (var menuElement in ribbonBarItem.AllMenuItems()) { barSubItem.ItemLinks.Add(_barItemMapper.MapFrom(_ribbonBarManager, menuElement)); } }
public RibbonBarMirrorPopupPanelItem(IRibbonBarItem ribbonBarItem) { this.m_pRibbonBarItem = ribbonBarItem; ((ISetOwnerHelper)this).SetOwner(ribbonBarItem as IOwner); // this.Size = this.m_pRibbonBarItem.DisplayRectangle.Size; //if (this.m_Entity != null) //{ // this.m_Entity.Width = this.m_pRibbonBarItem.Width; // this.m_Entity.Height = this.m_pRibbonBarItem.Height; // this.m_Entity.BackColor = System.Drawing.Color.Transparent; //} }
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 RibbonBarPopup(IRibbonBarItem ribbonBarItem) { this.m_RibbonBarMirrorPopupPanel = new RibbonBarMirrorPopupPanelItem(ribbonBarItem); // this.m_ToolStripControlHost = new ToolStripControlHost(new BaseItemHost(this.m_RibbonBarMirrorPopupPanel) { Size = this.m_RibbonBarMirrorPopupPanel.Size, BackColor = System.Drawing.Color.Transparent }); this.m_RibbonBarMirrorPopupPanel.Entity = this.m_ToolStripControlHost.Control; this.m_ToolStripControlHost.Dock = DockStyle.Fill; //this.m_ToolStripControlHost.BackColor = base.BackColor; this.m_ToolStripControlHost.Margin = new Padding(0); this.m_ToolStripControlHost.Padding = new Padding(0); base.Items.Add(this.m_ToolStripControlHost); // this.Margin = new Padding(0); this.Padding = new Padding(3); this.DropShadowEnabled = false; this.ShowItemToolTips = false; // ((ISetOwnerHelper)(this.m_ToolStripControlHost.Control)).SetOwner(this); }
private void addSubMenusToBarButtonItem(BarButtonItem barButtonItem, IRibbonBarItem ribbonBarItem) { if (!ribbonBarItem.AllMenuItems().Any()) { return; } //we have a popup element to create for the given baritem try { _ribbonBarManager.BeginUpdate(); var popupMenu = new PopupMenu(_ribbonBarManager); barButtonItem.DropDownControl = popupMenu; foreach (var menuElement in ribbonBarItem.AllMenuItems()) { popupMenu.ItemLinks.Add(_barItemMapper.MapFrom(_ribbonBarManager, menuElement)); } barButtonItem.ButtonStyle = BarButtonStyle.DropDown; popupMenu.Ribbon = _ribbonBarManager.Ribbon; } finally { _ribbonBarManager.EndUpdate(); } }
public void AddButton(IRibbonBarItem buttonToAdd) { _buttons.Add(buttonToAdd); }
public static IButtonGroup WithButton(this IButtonGroup buttonGroup, IRibbonBarItem ribbonBarItem) { buttonGroup.AddButton(ribbonBarItem); return(buttonGroup); }
public static IRibbonBarItem AsGroupStarter(this IRibbonBarItem ribbonBarItem) { ribbonBarItem.BeginGroup = true; return(ribbonBarItem); }
public static IRibbonBarItem WithStyle(this IRibbonBarItem ribbonBarItem, ItemStyle itemStyle) { ribbonBarItem.ItemStyle = itemStyle; return(ribbonBarItem); }
public static IRibbonBarItem WithSubItem(this IRibbonBarItem ribbonBarItem, IMenuBarItem subElement) { ribbonBarItem.AddMenuElement(subElement); return(ribbonBarItem); }
public static IRibbonBarItem WithIcon(this IRibbonBarItem ribbonBarItem, ApplicationIcon icon) { ribbonBarItem.Icon = icon; return(ribbonBarItem); }
public static IRibbonBarItem WithCaption(this IRibbonBarItem ribbonBarItem, string caption) { ribbonBarItem.Caption = caption; return(ribbonBarItem); }