/// <summary>
        /// Adds the specified item to the collection
        /// </summary>
        public new void Add(RibbonButton item)
        {
            CheckRestrictions(item as RibbonButton);

            item.SetOwner(Owner);
            item.SetOwnerPanel(OwnerPanel);
            item.SetOwnerTab(OwnerTab);

            base.Add(item);
        }
 /// <summary>
 /// Draws the button as a selected button
 /// </summary>
 /// <param name="g"></param>
 /// <param name="button"></param>
 public void DrawButtonSelected(Graphics g, RibbonButton button)
 {
     DrawButtonSelected(g, button.Bounds, ButtonCorners(button));
 }
        /// <summary>
        /// Checks for the restrictions that buttons should have on the RibbonButton List
        /// </summary>
        /// <param name="button"></param>
        private void CheckRestrictions(RibbonButton button)
        {
            if (button == null)
                throw new ApplicationException("The RibbonButtonList only accepts button in the Buttons collection");

            //if (!string.IsNullOrEmpty(button.Text))
            //    throw new ApplicationException("The buttons on the RibbonButtonList should have no text");

            if (button.Style != RibbonButtonStyle.Normal)
                throw new ApplicationException("The only style supported by the RibbonButtonList is Normal");
        }
        /// <summary>
        /// Draws the arrow of buttons
        /// </summary>
        /// <param name="g"></param>
        /// <param name="button"></param>
        public void DrawButtonDropDownArrow(Graphics g, RibbonButton button, Rectangle textLayout)
        {
            Rectangle bounds = Rectangle.Empty;

            if (button.SizeMode == RibbonElementSizeMode.Large || button.SizeMode == RibbonElementSizeMode.Overflow)
            {

                bounds = LargeButtonDropDownArrowBounds(g, button.Owner.Font, button.Text, textLayout);

            }
            else
            {
                bounds = new Rectangle(
                    button.Bounds.Right - button.Owner.ItemMargin.Right - arrowSize.Width,
                    button.Bounds.Top + (button.Bounds.Height - arrowSize.Height) / 2,
                    arrowSize.Width, arrowSize.Height);
            }

            DrawArrowShaded(g, bounds, Direction.Down, button.Enabled);
        }
        /// <summary>
        /// Determines buttonface corners
        /// </summary>
        /// <param name="button"></param>
        /// <returns></returns>
        private Corners ButtonFaceRounding(RibbonButton button)
        {
            if (!(button.OwnerItem is RibbonItemGroup))
            {
                if (button.SizeMode == RibbonElementSizeMode.Large)
                {
                    return Corners.North;
                }
                else
                {
                    return Corners.West;
                }
            }
            else
            {
                Corners c = Corners.None;
                RibbonItemGroup g = button.OwnerItem as RibbonItemGroup;
                if (button == g.FirstItem)
                {
                    c |= Corners.West;
                }

                return c;
            }
        }
        /// <summary>
        /// Gets the corners to round on the specified button
        /// </summary>
        /// <param name="r"></param>
        /// <param name="button"></param>
        /// <returns></returns>
        private Corners ButtonCorners(RibbonButton button)
        {
            if (!(button.OwnerItem is RibbonItemGroup))
            {
                return Corners.All;
            }
            else
            {
                RibbonItemGroup g = button.OwnerItem as RibbonItemGroup;
                Corners c = Corners.None;
                if (button == g.FirstItem)
                {
                    c |= Corners.West;
                }

                if (button == g.LastItem)
                {
                    c |= Corners.East;
                }

                return c;
            }
        }
        /// <summary>
        /// Draws a SplitDropDown button in selected state
        /// </summary>
        /// <param name="e"></param>
        /// <param name="button"></param>
        public void DrawSplitButtonSelected(RibbonItemRenderEventArgs e, RibbonButton button)
        {
            Rectangle outerR = Rectangle.FromLTRB(
                button.DropDownBounds.Left,
                button.DropDownBounds.Top,
                button.DropDownBounds.Right - 1,
                button.DropDownBounds.Bottom - 1);

            Rectangle innerR = Rectangle.FromLTRB(
                outerR.Left + 1,
                outerR.Top + 1,
                outerR.Right - 1,
                outerR.Bottom - 1);

            Rectangle faceOuterR = Rectangle.FromLTRB(
                button.ButtonFaceBounds.Left,
                button.ButtonFaceBounds.Top,
                button.ButtonFaceBounds.Right - 1,
                button.ButtonFaceBounds.Bottom - 1);

            Rectangle faceInnerR = Rectangle.FromLTRB(
                faceOuterR.Left + 1,
                faceOuterR.Top + 1,
                faceOuterR.Right + (button.SizeMode == RibbonElementSizeMode.Large ? -1 : 0),
                faceOuterR.Bottom + (button.SizeMode == RibbonElementSizeMode.Large ? 0 : -1));

            Corners faceCorners = ButtonFaceRounding(button);
            Corners ddCorners = ButtonDdRounding(button);

            GraphicsPath outer = RoundRectangle(outerR, 3, ddCorners);
            GraphicsPath inner = RoundRectangle(innerR, 2, ddCorners);
            GraphicsPath faceOuter = RoundRectangle(faceOuterR, 3, faceCorners);
            GraphicsPath faceInner = RoundRectangle(faceInnerR, 2, faceCorners);

            using (SolidBrush b = new SolidBrush(Color.FromArgb(150, Color.White)))
            {
                e.Graphics.FillPath(b, inner);
            }

            using (Pen p = new Pen(button.Pressed ? ColorTable.ButtonPressedBorderOut : ColorTable.ButtonSelectedBorderOut))
            {
                e.Graphics.DrawPath(p, outer);
            }

            using (Pen p = new Pen(button.Pressed ? ColorTable.ButtonPressedBorderIn : ColorTable.ButtonSelectedBorderIn))
            {
                e.Graphics.DrawPath(p, faceInner);
            }

            outer.Dispose(); inner.Dispose(); faceOuter.Dispose(); faceInner.Dispose();
        }
 /// <summary>
 /// Draws a SplitDropDown button in pressed state
 /// </summary>
 /// <param name="e"></param>
 /// <param name="button"></param>
 public void DrawSplitButtonPressed(RibbonItemRenderEventArgs e, RibbonButton button)
 {
 }