public ButtonState(ChromeButton button, ChromeButtonState state, bool draw, Rectangle bounds, VisualStudioButton extraButton)
 {
     Button = button;
     State = state;
     Draw = draw;
     Bounds = bounds;
     ExtraButton = extraButton;
 }
 public ButtonState(ChromeButton button, ChromeButtonState state, bool draw, Rectangle bounds, VisualStudioButton extraButton)
 {
     Button      = button;
     State       = state;
     Draw        = draw;
     Bounds      = bounds;
     ExtraButton = extraButton;
 }
 private void SetOverButton(VisualStudioButton extraButton)
 {
     if (_overExtraButton != extraButton)
     {
         _overButton      = ChromeButton.None;
         _overExtraButton = extraButton;
         _formChrome.PaintNonClientArea();
     }
 }
 private void SetDownButton(VisualStudioButton extraButton)
 {
     if (_downExtraButton != extraButton)
     {
         _downButton      = ChromeButton.None;
         _downExtraButton = extraButton;
         _formChrome.PaintNonClientArea();
     }
 }
 private void SetOverButton(ChromeButton button)
 {
     if (_overButton != button)
     {
         _overButton      = button;
         _overExtraButton = null;
         _formChrome.PaintNonClientArea();
     }
 }
 private void SetDownButton(ChromeButton button)
 {
     if (_downButton != button)
     {
         _downButton      = button;
         _downExtraButton = null;
         _formChrome.PaintNonClientArea();
     }
 }
        public VisualStudioButtonPaintEventArgs(VisualStudioButton button, Graphics graphics, Rectangle bounds, Region clipRegion, bool isMaximized, bool isActive)
            : base(graphics, bounds, clipRegion, isMaximized, isActive)
        {
            if (button == null)
                throw new ArgumentNullException("button");

            Button = button;

            ChromeButtonState state = 0;
            if (button.IsOver)
                state = ChromeButtonState.Over;
            else if (button.IsDown)
                state = ChromeButtonState.Down;

            ForeColor = button.Chrome.GetForeColor(button.Enabled, state);
            BackColor = button.Chrome.GetBackColor(button.Enabled, state);
        }
        public VisualStudioButtonPaintEventArgs(VisualStudioButton button, Graphics graphics, Rectangle bounds, Region clipRegion, bool isMaximized, bool isActive)
            : base(graphics, bounds, clipRegion, isMaximized, isActive)
        {
            if (button == null)
            {
                throw new ArgumentNullException("button");
            }

            Button = button;

            ChromeButtonState state = 0;

            if (button.IsOver)
            {
                state = ChromeButtonState.Over;
            }
            else if (button.IsDown)
            {
                state = ChromeButtonState.Down;
            }

            ForeColor = button.Chrome.GetForeColor(button.Enabled, state);
            BackColor = button.Chrome.GetBackColor(button.Enabled, state);
        }
            private ButtonState GetButtonState(VisualStudioFormChrome parent, ref int offset, ChromeButton button, bool enabled, VisualStudioButton extraButton)
            {
                offset -= ButtonSize.Width;

                var bounds = new Rectangle(
                    offset,
                    parent._formChrome.AdjustedResizeBorderThickness.Top,
                    ButtonSize.Width,
                    ButtonSize.Height
                );

                var location = parent._formChrome.PointToClient(Cursor.Position);
                bool over = bounds.Contains(location);

                ChromeButtonState state;

                if (!enabled)
                {
                    state = ChromeButtonState.Disabled;
                }
                else if (parent.CaptureStart.HasValue)
                {
                    if (bounds.Contains(parent.CaptureStart.Value))
                        state = over ? ChromeButtonState.Down : ChromeButtonState.Over;
                    else
                        state = ChromeButtonState.Enabled;
                }
                else
                {
                    state = over ? ChromeButtonState.Over : ChromeButtonState.Enabled;
                }

                if (extraButton != null)
                {
                    extraButton.IsOver = false;
                    extraButton.IsDown = false;
                }

                if (state == ChromeButtonState.Over)
                {
                    OverButton = button;
                    OverExtraButton = extraButton;
                    if (extraButton != null)
                        extraButton.IsOver = true;
                }
                else if (state == ChromeButtonState.Down)
                {
                    DownButton = button;
                    DownExtraButton = extraButton;
                    if (extraButton != null)
                        extraButton.IsDown = true;
                }

                return new ButtonState(button, state, true, bounds, extraButton);
            }
            private ButtonState GetButtonState(VisualStudioFormChrome parent, ref int offset, ChromeButton button, bool enabled, VisualStudioButton extraButton)
            {
                offset -= ButtonSize.Width;

                var bounds = new Rectangle(
                    offset,
                    parent._formChrome.AdjustedResizeBorderThickness.Top,
                    ButtonSize.Width,
                    ButtonSize.Height
                    );

                var  location = parent._formChrome.PointToClient(Cursor.Position);
                bool over     = bounds.Contains(location);

                ChromeButtonState state;

                if (!enabled)
                {
                    state = ChromeButtonState.Disabled;
                }
                else if (parent.CaptureStart.HasValue)
                {
                    if (bounds.Contains(parent.CaptureStart.Value))
                    {
                        state = over ? ChromeButtonState.Down : ChromeButtonState.Over;
                    }
                    else
                    {
                        state = ChromeButtonState.Enabled;
                    }
                }
                else
                {
                    state = over ? ChromeButtonState.Over : ChromeButtonState.Enabled;
                }

                if (extraButton != null)
                {
                    extraButton.IsOver = false;
                    extraButton.IsDown = false;
                }

                if (state == ChromeButtonState.Over)
                {
                    OverButton      = button;
                    OverExtraButton = extraButton;
                    if (extraButton != null)
                    {
                        extraButton.IsOver = true;
                    }
                }
                else if (state == ChromeButtonState.Down)
                {
                    DownButton      = button;
                    DownExtraButton = extraButton;
                    if (extraButton != null)
                    {
                        extraButton.IsDown = true;
                    }
                }

                return(new ButtonState(button, state, true, bounds, extraButton));
            }
 private void SetOverButton(VisualStudioButton extraButton)
 {
     if (_overExtraButton != extraButton)
     {
         _overButton = ChromeButton.None;
         _overExtraButton = extraButton;
         _formChrome.PaintNonClientArea();
     }
 }
 private void SetOverButton(ChromeButton button)
 {
     if (_overButton != button)
     {
         _overButton = button;
         _overExtraButton = null;
         _formChrome.PaintNonClientArea();
     }
 }
 private void SetDownButton(VisualStudioButton extraButton)
 {
     if (_downExtraButton != extraButton)
     {
         _downButton = ChromeButton.None;
         _downExtraButton = extraButton;
         _formChrome.PaintNonClientArea();
     }
 }
 private void SetDownButton(ChromeButton button)
 {
     if (_downButton != button)
     {
         _downButton = button;
         _downExtraButton = null;
         _formChrome.PaintNonClientArea();
     }
 }