// RibbonCommandUICollection.cs
// Copyright (c) 2016 Bentley Systems, Incorporated. All Rights Reserved.

using System.Collections.Generic;

namespace Haestad.Framework.UI.Integration
{
    /// <summary>
    /// Class groups related commands to manage certain grouped command behaviors (e.g., enable/disable for a group, toggle behaviors etc).
    /// Derived RibbonUICommand implementations can call back on a reference to their owner group, in order to discover related commands.
    /// </summary>
    public class RibbonCommandUICollection : IRibbonUICommandCollection
    {
        #region Constructor
        public RibbonCommandUICollection()
        {
        }
        #endregion

        #region Public Methods
        public virtual void AddCommand(IRibbonUICommand ribbonUICommand)
        {
            RelatedCommands.Add(ribbonUICommand);
        }
        #endregion

        #region Public Properties
        public IList<IRibbonUICommand> RelatedCommands
        {
            get
            {
                if (m_relatedCommands == null)
                    m_relatedCommands = new List<IRibbonUICommand>(DEFAULT_LIST_SIZE);
                return m_relatedCommands;
            }
        }
        #endregion

        #region Private Fields
        private IList<IRibbonUICommand> m_relatedCommands;
        #endregion

        #region Private Constants
        private const int DEFAULT_LIST_SIZE = 16;
        #endregion
    }
}
