using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; namespace System.Windows.Forms { [Editor(typeof(RibbonQuickAccessToolbarItemCollectionEditor), typeof(UITypeEditor))] public class RibbonQuickAccessToolbarItemCollection : RibbonItemCollection { #region Fields #endregion /// /// Creates a new collection /// internal RibbonQuickAccessToolbarItemCollection(RibbonQuickAccessToolbar toolbar) { OwnerToolbar = toolbar; SetOwner(toolbar.Owner); } internal sealed override void SetOwner(Ribbon owner) { base.SetOwner(owner); } /// /// Gets the group that owns this item collection /// public RibbonQuickAccessToolbar OwnerToolbar { get; } /// /// /// Adds the specified item to the collection /// public override void Add(RibbonItem item) { item.MaxSizeMode = RibbonElementSizeMode.Compact; base.Add(item); } /// /// /// Adds the specified range of items /// /// Items to add public override void AddRange(IEnumerable items) { foreach (RibbonItem item in items) { item.MaxSizeMode = RibbonElementSizeMode.Compact; } base.AddRange(items); } /// /// Inserts the specified item at the desired index /// /// Desired index of the item /// Item to insert public override void Insert(int index, RibbonItem item) { item.MaxSizeMode = RibbonElementSizeMode.Compact; base.Insert(index, item); } } }