// TitleBarMinimizeButton.cs
// Copyright (c) 2018 Bentley Systems, Incorporated. All Rights Reserved.

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Haestad.Support.Support;

namespace Haestad.Framework.UI.Integration
{
    /// <summary>
    /// Class represents the minimize button on an application parent form title bar.
    /// </summary>
    internal class TitleBarMinimizeButton : TitleBarButton 
    {
        #region Constructor
        public TitleBarMinimizeButton(EventHandler clickEventHandler, ITitleBarColorInformation titleBarColorInformation, ToolTip toolTip, double sizeFactor)
            : base(clickEventHandler, titleBarColorInformation, toolTip, sizeFactor)
        {
        }
        #endregion

        #region Protected Override Methods
        protected override void OnPaint(PaintEventArgs pevent)
        {
            base.OnPaint(pevent);

            double BOUNDS_BUFFER_PERECENT = 0.2;
            double TOP_OFFSET_PERCENT = 0.45;
            double WIDTH_CONTRACTION_PERCENT_LEFT_RIGHT = 0.05;
            double BOTTOM_OFFSET_PERCENT = 0.05;

            if (RibbonExternalConfiguration.Instance.Windows10StyleEnabled)
            {
                BOUNDS_BUFFER_PERECENT = 0.1;
                TOP_OFFSET_PERCENT = 0.4;
                WIDTH_CONTRACTION_PERCENT_LEFT_RIGHT = 0.4;
                BOTTOM_OFFSET_PERCENT = 0.4;
            }

            using (Brush foreBrush = new SolidBrush(ForeColor))
            {
                DrawOffsetRect(DrawRectangle, pevent.Graphics, foreBrush, BOUNDS_BUFFER_PERECENT,
                    WIDTH_CONTRACTION_PERCENT_LEFT_RIGHT, WIDTH_CONTRACTION_PERCENT_LEFT_RIGHT, TOP_OFFSET_PERCENT, BOTTOM_OFFSET_PERCENT);
            }
        }
        #endregion

        #region Protected Override Properties
        protected override string ToolTipText
        {
            get
            {
                return TextManager.Current["hfui_titleBarMinimizeButtonToolTip"];
            }
        }
        #endregion
    }
}
